listlistmodel: Drop item_type

We are using G_TYPE_OBJECT throughout, so there
is no need for GtkListListModel to do anything else.

Update all callers.
This commit is contained in:
Matthias Clasen 2020-07-26 14:37:55 -04:00
parent 32b8fe40bb
commit 06c6d62629
3 changed files with 14 additions and 26 deletions

View File

@ -36,7 +36,6 @@ struct _GtkListListModel
{
GObject parent_instance;
GType item_type;
guint n_items;
gpointer (* get_first) (gpointer);
gpointer (* get_next) (gpointer, gpointer);
@ -55,9 +54,7 @@ struct _GtkListListModelClass
static GType
gtk_list_list_model_get_item_type (GListModel *list)
{
GtkListListModel *self = GTK_LIST_LIST_MODEL (list);
return self->item_type;
return G_TYPE_OBJECT;
}
static guint
@ -143,8 +140,7 @@ gtk_list_list_model_init (GtkListListModel *self)
}
GtkListListModel *
gtk_list_list_model_new (GType item_type,
gpointer (* get_first) (gpointer),
gtk_list_list_model_new (gpointer (* get_first) (gpointer),
gpointer (* get_next) (gpointer, gpointer),
gpointer (* get_previous) (gpointer, gpointer),
gpointer (* get_last) (gpointer),
@ -161,8 +157,7 @@ gtk_list_list_model_new (GType item_type,
item = get_next (item, data))
n_items++;
return gtk_list_list_model_new_with_size (item_type,
n_items,
return gtk_list_list_model_new_with_size (n_items,
get_first,
get_next,
get_previous,
@ -173,8 +168,7 @@ gtk_list_list_model_new (GType item_type,
}
GtkListListModel *
gtk_list_list_model_new_with_size (GType item_type,
guint n_items,
gtk_list_list_model_new_with_size (guint n_items,
gpointer (* get_first) (gpointer),
gpointer (* get_next) (gpointer, gpointer),
gpointer (* get_previous) (gpointer, gpointer),
@ -185,7 +179,6 @@ gtk_list_list_model_new_with_size (GType item_type,
{
GtkListListModel *result;
g_return_val_if_fail (g_type_is_a (item_type, G_TYPE_OBJECT), NULL);
g_return_val_if_fail (get_first != NULL, NULL);
g_return_val_if_fail (get_next != NULL, NULL);
g_return_val_if_fail (get_previous != NULL, NULL);
@ -193,7 +186,6 @@ gtk_list_list_model_new_with_size (GType item_type,
result = g_object_new (GTK_TYPE_LIST_LIST_MODEL, NULL);
result->item_type = item_type;
result->n_items = n_items;
result->get_first = get_first;
result->get_next = get_next;

View File

@ -37,8 +37,7 @@ typedef struct _GtkListListModelClass GtkListListModelClass;
GType gtk_list_list_model_get_type (void) G_GNUC_CONST;
GtkListListModel * gtk_list_list_model_new (GType item_type,
gpointer (* get_first) (gpointer),
GtkListListModel * gtk_list_list_model_new (gpointer (* get_first) (gpointer),
gpointer (* get_next) (gpointer, gpointer),
gpointer (* get_previous) (gpointer, gpointer),
gpointer (* get_last) (gpointer),
@ -46,8 +45,7 @@ GtkListListModel * gtk_list_list_model_new (GType
gpointer data,
GDestroyNotify notify);
GtkListListModel * gtk_list_list_model_new_with_size (GType item_type,
guint n_items,
GtkListListModel * gtk_list_list_model_new_with_size (guint n_items,
gpointer (* get_first) (gpointer),
gpointer (* get_next) (gpointer, gpointer),
gpointer (* get_previous) (gpointer, gpointer),

View File

@ -11535,8 +11535,7 @@ gtk_widget_observe_children (GtkWidget *widget)
if (priv->children_observer)
return g_object_ref (G_LIST_MODEL (priv->children_observer));
priv->children_observer = gtk_list_list_model_new (GTK_TYPE_WIDGET,
(gpointer) gtk_widget_get_first_child,
priv->children_observer = gtk_list_list_model_new ((gpointer) gtk_widget_get_first_child,
(gpointer) gtk_widget_get_next_sibling,
(gpointer) gtk_widget_get_prev_sibling,
(gpointer) gtk_widget_get_last_child,
@ -11622,14 +11621,13 @@ gtk_widget_observe_controllers (GtkWidget *widget)
if (priv->controller_observer)
return g_object_ref (G_LIST_MODEL (priv->controller_observer));
priv->controller_observer = gtk_list_list_model_new (GTK_TYPE_EVENT_CONTROLLER,
gtk_widget_controller_list_get_first,
gtk_widget_controller_list_get_next,
gtk_widget_controller_list_get_prev,
NULL,
(gpointer) g_object_ref,
widget,
gtk_widget_controller_observer_destroyed);
priv->controller_observer = gtk_list_list_model_new (gtk_widget_controller_list_get_first,
gtk_widget_controller_list_get_next,
gtk_widget_controller_list_get_prev,
NULL,
(gpointer) g_object_ref,
widget,
gtk_widget_controller_observer_destroyed);
return G_LIST_MODEL (priv->controller_observer);
}