[gnome-control-center] sharing: Don't use gtk_widget_show_all
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] sharing: Don't use gtk_widget_show_all
- Date: Thu, 18 Oct 2018 01:23:53 +0000 (UTC)
commit c058f15d1048804971e85e44c7668d3a40a17000
Author: Robert Ancell <robert ancell canonical com>
Date: Mon Oct 15 11:32:03 2018 +1300
sharing: Don't use gtk_widget_show_all
It is removed in GTK+ 4
panels/sharing/cc-sharing-networks.c | 17 +++++++++++------
panels/sharing/cc-sharing-panel.c | 22 +++++++++++++---------
2 files changed, 24 insertions(+), 15 deletions(-)
---
diff --git a/panels/sharing/cc-sharing-networks.c b/panels/sharing/cc-sharing-networks.c
index 628530ed5..6ea58900a 100644
--- a/panels/sharing/cc-sharing-networks.c
+++ b/panels/sharing/cc-sharing-networks.c
@@ -209,6 +209,7 @@ cc_sharing_networks_new_row (const char *uuid,
row = gtk_list_box_row_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_widget_show (box);
gtk_container_set_border_width (GTK_CONTAINER (box), 3);
gtk_widget_set_margin_start (box, 6);
gtk_container_add (GTK_CONTAINER (row), box);
@@ -222,16 +223,19 @@ cc_sharing_networks_new_row (const char *uuid,
}
w = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
+ gtk_widget_show (w);
gtk_widget_set_margin_end (w, 12);
gtk_container_add (GTK_CONTAINER (box), w);
/* Label */
w = gtk_label_new (network_name);
+ gtk_widget_show (w);
gtk_widget_set_margin_end (w, 12);
gtk_container_add (GTK_CONTAINER (box), w);
/* Remove button */
w = gtk_button_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR);
+ gtk_widget_show (w);
gtk_button_set_relief (GTK_BUTTON (w), GTK_RELIEF_NONE);
gtk_widget_set_margin_top (w, 3);
gtk_widget_set_margin_bottom (w, 3);
@@ -244,8 +248,6 @@ cc_sharing_networks_new_row (const char *uuid,
g_object_set_data_full (G_OBJECT (row), "uuid", g_strdup (uuid), g_free);
- gtk_widget_show_all (row);
-
return row;
}
@@ -256,23 +258,27 @@ cc_sharing_networks_new_current_row (CcSharingNetworks *self)
row = gtk_list_box_row_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_widget_show (box);
gtk_container_set_border_width (GTK_CONTAINER (box), 3);
gtk_widget_set_margin_start (box, 6);
gtk_container_add (GTK_CONTAINER (row), box);
/* Icon */
w = gtk_image_new_from_icon_name ("image-missing", GTK_ICON_SIZE_MENU);
+ gtk_widget_show (w);
gtk_widget_set_margin_end (w, 12);
gtk_container_add (GTK_CONTAINER (box), w);
self->current_icon = w;
/* Label */
w = gtk_label_new ("");
+ gtk_widget_show (w);
gtk_container_add (GTK_CONTAINER (box), w);
gtk_widget_set_margin_end (w, 12);
self->current_label = w;
w = gtk_switch_new ();
+ gtk_widget_show (w);
gtk_widget_set_margin_top (w, 3);
gtk_widget_set_margin_bottom (w, 3);
gtk_widget_set_margin_end (w, 12);
@@ -283,8 +289,6 @@ cc_sharing_networks_new_current_row (CcSharingNetworks *self)
self->current_switch = w;
g_object_set_data (G_OBJECT (w), "row", row);
- gtk_widget_show_all (box);
-
return row;
}
@@ -295,18 +299,18 @@ cc_sharing_networks_new_no_network_row (CcSharingNetworks *self)
row = gtk_list_box_row_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_widget_show (box);
gtk_container_set_border_width (GTK_CONTAINER (box), 12);
gtk_container_add (GTK_CONTAINER (row), box);
/* Label */
w = gtk_label_new (_("No networks selected for sharing"));
+ gtk_widget_show (w);
gtk_widget_set_hexpand (w, TRUE);
gtk_widget_set_halign (w, GTK_ALIGN_CENTER);
gtk_style_context_add_class (gtk_widget_get_style_context (w), "dim-label");
gtk_container_add (GTK_CONTAINER (box), w);
- gtk_widget_show_all (box);
-
return row;
}
@@ -380,6 +384,7 @@ cc_sharing_update_networks_box (CcSharingNetworks *self)
net->network_name,
net->carrier_type,
self);
+ gtk_widget_show (row);
gtk_list_box_insert (GTK_LIST_BOX (self->listbox), row, -1);
}
diff --git a/panels/sharing/cc-sharing-panel.c b/panels/sharing/cc-sharing-panel.c
index 6334c2e50..058271695 100644
--- a/panels/sharing/cc-sharing-panel.c
+++ b/panels/sharing/cc-sharing-panel.c
@@ -562,6 +562,7 @@ cc_sharing_panel_new_media_sharing_row (const char *uri_or_path,
row = gtk_list_box_row_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_widget_show (box);
gtk_container_set_border_width (GTK_CONTAINER (box), 3);
gtk_widget_set_margin_start (box, 6);
gtk_container_add (GTK_CONTAINER (row), box);
@@ -578,16 +579,19 @@ cc_sharing_panel_new_media_sharing_row (const char *uri_or_path,
icon = special_directory_get_gicon (dir);
w = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU);
+ gtk_widget_show (w);
gtk_widget_set_margin_end (w, 12);
gtk_container_add (GTK_CONTAINER (box), w);
/* Label */
basename = g_filename_display_basename (path);
w = gtk_label_new (basename);
+ gtk_widget_show (w);
gtk_container_add (GTK_CONTAINER (box), w);
/* Remove button */
w = gtk_button_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR);
+ gtk_widget_show (w);
gtk_button_set_relief (GTK_BUTTON (w), GTK_RELIEF_NONE);
gtk_widget_set_margin_top (w, 3);
gtk_widget_set_margin_bottom (w, 3);
@@ -600,8 +604,6 @@ cc_sharing_panel_new_media_sharing_row (const char *uri_or_path,
g_object_set_data_full (G_OBJECT (row), "path", g_steal_pointer (&path), g_free);
- gtk_widget_show_all (row);
-
return row;
}
@@ -612,10 +614,12 @@ cc_sharing_panel_new_add_media_sharing_row (CcSharingPanel *self)
row = gtk_list_box_row_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_widget_show (box);
gtk_container_set_border_width (GTK_CONTAINER (box), 3);
gtk_container_add (GTK_CONTAINER (row), box);
w = gtk_image_new_from_icon_name ("list-add-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR);
+ gtk_widget_show (w);
gtk_container_add (GTK_CONTAINER (box), w);
gtk_widget_set_hexpand (w, TRUE);
gtk_widget_set_margin_top (w, 6);
@@ -624,7 +628,6 @@ cc_sharing_panel_new_add_media_sharing_row (CcSharingPanel *self)
g_object_set_data (G_OBJECT (w), "row", row);
g_object_set_data (G_OBJECT (row), "is-add", GINT_TO_POINTER (1));
- gtk_widget_show_all (row);
return row;
}
@@ -634,7 +637,7 @@ cc_sharing_panel_setup_media_sharing_dialog (CcSharingPanel *self)
{
g_auto(GStrv) folders = NULL;
GStrv list;
- GtkWidget *networks, *w;
+ GtkWidget *row, *networks, *w;
g_autofree gchar *path = NULL;
path = g_find_program_in_path ("rygel");
@@ -658,15 +661,15 @@ cc_sharing_panel_setup_media_sharing_dialog (CcSharingPanel *self)
list = folders;
while (list && *list)
{
- GtkWidget *row;
-
row = cc_sharing_panel_new_media_sharing_row (*list, self);
+ gtk_widget_show (row);
gtk_list_box_insert (GTK_LIST_BOX (self->shared_folders_listbox), row, -1);
list++;
}
- gtk_list_box_insert (GTK_LIST_BOX (self->shared_folders_listbox),
- cc_sharing_panel_new_add_media_sharing_row (self), -1);
+ row = cc_sharing_panel_new_add_media_sharing_row (self);
+ gtk_widget_show (row);
+ gtk_list_box_insert (GTK_LIST_BOX (self->shared_folders_listbox), row, -1);
cc_list_box_adjust_scrolling (GTK_LIST_BOX (self->shared_folders_listbox));
@@ -1275,12 +1278,13 @@ cc_sharing_panel_init (CcSharingPanel *self)
/* create the master switch */
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ gtk_widget_show (box);
self->master_switch = gtk_switch_new ();
+ gtk_widget_show (self->master_switch);
atk_object_set_name (ATK_OBJECT (gtk_widget_get_accessible (self->master_switch)), _("Sharing"));
gtk_widget_set_valign (self->master_switch, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (box), self->master_switch, FALSE, FALSE, 4);
- gtk_widget_show_all (box);
/* start the panel in the disabled state */
gtk_switch_set_active (GTK_SWITCH (self->master_switch), FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]