iconview: Derive from GtkWidget

GtkIconView is not a container.
This commit is contained in:
Matthias Clasen 2020-05-07 00:47:25 -04:00
parent 825e98dcca
commit 253a39c6e9
5 changed files with 70 additions and 103 deletions

View File

@ -852,7 +852,7 @@ _gtk_icon_view_item_accessible_class_init (GtkIconViewItemAccessibleClass *klass
static void atk_component_interface_init (AtkComponentIface *iface);
static void atk_selection_interface_init (AtkSelectionIface *iface);
G_DEFINE_TYPE_WITH_CODE (GtkIconViewAccessible, gtk_icon_view_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE,
G_DEFINE_TYPE_WITH_CODE (GtkIconViewAccessible, gtk_icon_view_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
G_ADD_PRIVATE (GtkIconViewAccessible)
G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init))

View File

@ -22,7 +22,7 @@
#error "Only <gtk/gtk-a11y.h> can be included directly."
#endif
#include <gtk/a11y/gtkcontaineraccessible.h>
#include <gtk/a11y/gtkwidgetaccessible.h>
G_BEGIN_DECLS
@ -39,14 +39,14 @@ typedef struct _GtkIconViewAccessiblePrivate GtkIconViewAccessiblePrivate;
struct _GtkIconViewAccessible
{
GtkContainerAccessible parent;
GtkWidgetAccessible parent;
GtkIconViewAccessiblePrivate *priv;
};
struct _GtkIconViewAccessibleClass
{
GtkContainerAccessibleClass parent_class;
GtkWidgetAccessibleClass parent_class;
};
GDK_AVAILABLE_IN_ALL

View File

@ -181,12 +181,8 @@ static gboolean gtk_icon_view_key_pressed (GtkEventControl
GdkModifierType state,
GtkWidget *widget);
/* GtkContainer vfuncs */
static void gtk_icon_view_remove (GtkContainer *container,
static void gtk_icon_view_remove (GtkIconView *icon_view,
GtkWidget *widget);
static void gtk_icon_view_forall (GtkContainer *container,
GtkCallback callback,
gpointer callback_data);
/* GtkIconView vfuncs */
static void gtk_icon_view_real_select_all (GtkIconView *icon_view);
@ -326,7 +322,7 @@ static void gtk_icon_view_buildable_custom_tag_end (GtkBuildable *bu
static guint icon_view_signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE_WITH_CODE (GtkIconView, gtk_icon_view, GTK_TYPE_CONTAINER,
G_DEFINE_TYPE_WITH_CODE (GtkIconView, gtk_icon_view, GTK_TYPE_WIDGET,
G_ADD_PRIVATE (GtkIconView)
G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT,
gtk_icon_view_cell_layout_init)
@ -339,7 +335,6 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
gobject_class->constructed = gtk_icon_view_constructed;
gobject_class->dispose = gtk_icon_view_dispose;
@ -353,9 +348,6 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
widget_class->focus = gtk_widget_focus_self;
widget_class->grab_focus = gtk_widget_grab_focus_self;
container_class->remove = gtk_icon_view_remove;
container_class->forall = gtk_icon_view_forall;
klass->select_all = gtk_icon_view_real_select_all;
klass->unselect_all = gtk_icon_view_real_unselect_all;
klass->select_cursor_item = gtk_icon_view_real_select_cursor_item;
@ -1904,15 +1896,12 @@ gtk_icon_view_leave(GtkEventController *controller,
}
static void
gtk_icon_view_remove (GtkContainer *container,
gtk_icon_view_remove (GtkIconView *icon_view,
GtkWidget *widget)
{
GtkIconView *icon_view;
GtkIconViewChild *child = NULL;
GList *tmp_list;
icon_view = GTK_ICON_VIEW (container);
tmp_list = icon_view->priv->children;
while (tmp_list)
{
@ -1931,27 +1920,6 @@ gtk_icon_view_remove (GtkContainer *container,
}
}
static void
gtk_icon_view_forall (GtkContainer *container,
GtkCallback callback,
gpointer callback_data)
{
GtkIconView *icon_view;
GtkIconViewChild *child = NULL;
GList *tmp_list;
icon_view = GTK_ICON_VIEW (container);
tmp_list = icon_view->priv->children;
while (tmp_list)
{
child = tmp_list->data;
tmp_list = tmp_list->next;
(* callback) (child->widget, callback_data);
}
}
static void
gtk_icon_view_item_selected_changed (GtkIconView *icon_view,
GtkIconViewItem *item)
@ -2006,8 +1974,7 @@ gtk_icon_view_remove_editable (GtkCellArea *area,
if (gtk_widget_has_focus (GTK_WIDGET (editable)))
gtk_widget_grab_focus (GTK_WIDGET (icon_view));
gtk_container_remove (GTK_CONTAINER (icon_view),
GTK_WIDGET (editable));
gtk_icon_view_remove (icon_view, GTK_WIDGET (editable));
path = gtk_tree_path_new_from_string (gtk_cell_area_get_current_path_string (area));
gtk_icon_view_queue_draw_path (icon_view, path);

View File

@ -22,7 +22,7 @@
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkcontainer.h>
#include <gtk/gtkwidget.h>
#include <gtk/gtktreemodel.h>
#include <gtk/gtkcellrenderer.h>
#include <gtk/gtkcellarea.h>

View File

@ -44,14 +44,14 @@ typedef struct _GtkIconViewPrivate GtkIconViewPrivate;
struct _GtkIconView
{
GtkContainer parent;
GtkWidget parent;
GtkIconViewPrivate *priv;
};
struct _GtkIconViewClass
{
GtkContainerClass parent_class;
GtkWidgetClass parent_class;
void (* item_activated) (GtkIconView *icon_view,
GtkTreePath *path);