diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-05-08 02:19:18 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-05-11 22:21:39 -0400 |
commit | 88141103cdf5fd294b19d4473245f42201aa6b93 (patch) | |
tree | 362ab942aad3cb7da2158ca34e865e00a14489c5 /gtk/gtkplacesview.c | |
parent | ff91ce9eb45f0aac43b218b05cbf8e5b89ed8e32 (diff) | |
download | gtk+-88141103cdf5fd294b19d4473245f42201aa6b93.tar.gz |
Don't use container api on GtkListBox
Diffstat (limited to 'gtk/gtkplacesview.c')
-rw-r--r-- | gtk/gtkplacesview.c | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/gtk/gtkplacesview.c b/gtk/gtkplacesview.c index fa4ac5201a..94ca0d09e7 100644 --- a/gtk/gtkplacesview.c +++ b/gtk/gtkplacesview.c @@ -548,8 +548,8 @@ populate_servers (GtkPlacesView *view) } /* clear previous items */ - while ((child = gtk_widget_get_first_child (view->recent_servers_listbox))) - gtk_container_remove (GTK_CONTAINER (view->recent_servers_listbox), child); + while ((child = gtk_widget_get_first_child (GTK_WIDGET (view->recent_servers_listbox)))) + gtk_list_box_remove (GTK_LIST_BOX (view->listbox), child); gtk_list_store_clear (view->completion_store); @@ -606,7 +606,7 @@ populate_servers (GtkPlacesView *view) gtk_grid_attach (GTK_GRID (grid), button, 1, 0, 1, 2); gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), grid); - gtk_container_add (GTK_CONTAINER (view->recent_servers_listbox), row); + gtk_list_box_insert (GTK_LIST_BOX (view->recent_servers_listbox), row, -1); /* custom data */ data = g_new0 (RemoveServerData, 1); @@ -631,27 +631,24 @@ populate_servers (GtkPlacesView *view) static void update_view_mode (GtkPlacesView *view) { - GList *children; - GList *l; + GtkWidget *child; gboolean show_listbox; show_listbox = FALSE; /* drives */ - children = gtk_container_get_children (GTK_CONTAINER (view->listbox)); - - for (l = children; l; l = l->next) + for (child = gtk_widget_get_first_child (GTK_WIDGET (view->listbox)); + child != NULL; + child = gtk_widget_get_next_sibling (child)) { /* GtkListBox filter rows by changing their GtkWidget::child-visible property */ - if (gtk_widget_get_child_visible (l->data)) + if (gtk_widget_get_child_visible (child)) { show_listbox = TRUE; break; } } - g_list_free (children); - if (!show_listbox && view->search_query && view->search_query[0] != '\0') @@ -698,7 +695,7 @@ insert_row (GtkPlacesView *view, gtk_places_view_row_set_path_size_group (GTK_PLACES_VIEW_ROW (row), view->path_size_group); gtk_places_view_row_set_space_size_group (GTK_PLACES_VIEW_ROW (row), view->space_size_group); - gtk_container_add (GTK_CONTAINER (view->listbox), row); + gtk_list_box_insert (GTK_LIST_BOX (view->listbox), row, -1); } static void @@ -838,23 +835,21 @@ add_file (GtkPlacesView *view, static gboolean has_networks (GtkPlacesView *view) { - GList *l; - GList *children; + GtkWidget *child; gboolean has_network = FALSE; - children = gtk_container_get_children (GTK_CONTAINER (view->listbox)); - for (l = children; l != NULL; l = l->next) + for (child = gtk_widget_get_first_child (GTK_WIDGET (view->listbox)); + child != NULL; + child = gtk_widget_get_next_sibling (child)) { - if (GPOINTER_TO_INT (g_object_get_data (l->data, "is-network")) == TRUE && - g_object_get_data (l->data, "is-placeholder") == NULL) + if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (child), "is-network")) && + g_object_get_data (G_OBJECT (child), "is-placeholder") == NULL) { has_network = TRUE; break; } } - g_list_free (children); - return has_network; } @@ -879,7 +874,7 @@ update_network_state (GtkPlacesView *view) /* mark the row as placeholder, so it always goes first */ g_object_set_data (G_OBJECT (view->network_placeholder), "is-placeholder", GINT_TO_POINTER (TRUE)); - gtk_container_add (GTK_CONTAINER (view->listbox), view->network_placeholder); + gtk_list_box_insert (GTK_LIST_BOX (view->listbox), view->network_placeholder, -1); } if (gtk_places_view_get_fetching_networks (view)) @@ -1093,8 +1088,8 @@ update_places (GtkPlacesView *view) GtkWidget *child; /* Clear all previously added items */ - while ((child = gtk_widget_get_first_child (view->listbox))) - gtk_container_remove (GTK_CONTAINER (view->listbox), child); + while ((child = gtk_widget_get_first_child (GTK_WIDGET (view->listbox)))) + gtk_list_box_remove (GTK_LIST_BOX (view->listbox), child); view->network_placeholder = NULL; /* Inform clients that we started loading */ |