Stop using GtkFunctionsListItemFactory

This was an early attempt at a factory, and has been
superseded by GtkSignalsListItemFactory. Port all users
the the newer one.
This commit is contained in:
Matthias Clasen 2020-06-29 16:37:14 -04:00
parent 7170fdebb9
commit c267a75eef
4 changed files with 35 additions and 30 deletions

View File

@ -194,8 +194,8 @@ create_weather_model (void)
}
static void
setup_widget (GtkListItem *list_item,
gpointer unused)
setup_widget (GtkSignalListItemFactory *factory,
GtkListItem *list_item)
{
GtkWidget *box, *child;
@ -218,8 +218,8 @@ setup_widget (GtkListItem *list_item,
}
static void
bind_widget (GtkListItem *list_item,
gpointer unused)
bind_widget (GtkSignalListItemFactory *factory,
GtkListItem *list_item)
{
GtkWidget *box, *child;
GtkWeatherInfo *info;
@ -282,11 +282,12 @@ create_weather_view (void)
{
GtkWidget *listview;
GListModel *model, *selection;
GtkListItemFactory *factory;
listview = gtk_list_view_new_with_factory (
gtk_functions_list_item_factory_new (setup_widget,
bind_widget,
NULL, NULL));
factory = gtk_signal_list_item_factory_new ();
g_signal_connect (factory, "setup", G_CALLBACK (setup_widget), NULL);
g_signal_connect (factory, "bind", G_CALLBACK (bind_widget), NULL);
listview = gtk_list_view_new_with_factory (factory);
gtk_orientable_set_orientation (GTK_ORIENTABLE (listview), GTK_ORIENTATION_HORIZONTAL);
gtk_list_view_set_show_separators (GTK_LIST_VIEW (listview), TRUE);
model = create_weather_model ();

View File

@ -22,9 +22,10 @@
#include <gtk/gtkbinlayout.h>
#include <gtk/gtkbox.h>
#include <gtk/gtkfilechooserdialog.h>
#include <gtk/gtkfunctionslistitemfactory.h>
#include <gtk/gtksignallistitemfactory.h>
#include <gtk/gtklabel.h>
#include <gtk/gtklistbox.h>
#include <gtk/gtklistitem.h>
#include <gtk/gtklistview.h>
#include <gtk/gtkliststore.h>
#include <gtk/gtkmessagedialog.h>
@ -302,8 +303,8 @@ node_name (GskRenderNode *node)
}
static void
setup_widget_for_render_node (GtkListItem *list_item,
gpointer unused)
setup_widget_for_render_node (GtkSignalListItemFactory *factory,
GtkListItem *list_item)
{
GtkWidget *expander, *box, *child;
@ -324,8 +325,8 @@ setup_widget_for_render_node (GtkListItem *list_item,
}
static void
bind_widget_for_render_node (GtkListItem *list_item,
gpointer unused)
bind_widget_for_render_node (GtkSignalListItemFactory *factory,
GtkListItem *list_item)
{
GdkPaintable *paintable;
GskRenderNode *node;
@ -1291,9 +1292,10 @@ gtk_inspector_recorder_init (GtkInspectorRecorder *recorder)
priv->render_node_selection = gtk_single_selection_new (G_LIST_MODEL (priv->render_node_model));
g_signal_connect (priv->render_node_selection, "notify::selected-item", G_CALLBACK (render_node_list_selection_changed), recorder);
factory = gtk_functions_list_item_factory_new (setup_widget_for_render_node,
bind_widget_for_render_node,
NULL, NULL);
factory = gtk_signal_list_item_factory_new ();
g_signal_connect (factory, "setup", G_CALLBACK (setup_widget_for_render_node), NULL);
g_signal_connect (factory, "bind", G_CALLBACK (bind_widget_for_render_node), NULL);
gtk_list_view_set_factory (GTK_LIST_VIEW (priv->render_node_list), factory);
g_object_unref (factory);
gtk_list_view_set_model (GTK_LIST_VIEW (priv->render_node_list),

View File

@ -9,8 +9,8 @@
#endif
static void
setup_list_item (GtkListItem *list_item,
gpointer unused)
setup_list_item (GtkSignalListItemFactory *factory,
GtkListItem *list_item)
{
GtkWidget *label = gtk_label_new ("");
@ -18,8 +18,8 @@ setup_list_item (GtkListItem *list_item,
}
static void
bind_list_item (GtkListItem *list_item,
gpointer unused)
bind_list_item (GtkSignalListItemFactory *factory,
GtkListItem *list_item)
{
GtkWidget *label;
gpointer item;
@ -118,6 +118,7 @@ main (int argc,
GtkSortListModel *sort;
GtkSorter *sorter;
guint i;
GtkListItemFactory *factory;
gtk_init ();
@ -145,10 +146,11 @@ main (int argc,
gtk_widget_set_vexpand (sw, TRUE);
gtk_box_append (GTK_BOX (vbox), sw);
listview = gtk_list_view_new_with_factory (
gtk_functions_list_item_factory_new (setup_list_item,
bind_list_item,
NULL, NULL));
factory = gtk_signal_list_item_factory_new ();
g_signal_connect (factory, "setup", G_CALLBACK (setup_list_item), NULL);
g_signal_connect (factory, "bind", G_CALLBACK (bind_list_item), NULL);
listview = gtk_list_view_new_with_factory (factory);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), listview);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);

View File

@ -486,8 +486,8 @@ row_data_free (gpointer _data)
}
static void
setup_widget (GtkListItem *list_item,
gpointer unused)
setup_widget (GtkSignalListItemFactory *factory,
GtkListItem *list_item)
{
GtkWidget *box, *child;
RowData *data;
@ -601,6 +601,7 @@ main (int argc, char *argv[])
FileInfoSelection *selectionmodel;
GFile *root;
GListModel *toplevels;
GtkListItemFactory *factory;
gtk_init ();
@ -618,10 +619,9 @@ main (int argc, char *argv[])
gtk_search_entry_set_key_capture_widget (GTK_SEARCH_ENTRY (search_entry), sw);
gtk_box_append (GTK_BOX (vbox), sw);
listview = gtk_grid_view_new_with_factory (
gtk_functions_list_item_factory_new (setup_widget,
NULL,
NULL, NULL));
factory = gtk_signal_list_item_factory_new ();
g_signal_connect (factory, "setup", G_CALLBACK (setup_widget), NULL);
listview = gtk_grid_view_new_with_factory (factory);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), listview);
if (argc > 1)