[gnome-control-center] region: Don't use gtk_widget_show_all



commit 5368c1cb71112a67b0b096aa0af98e8da7e51d50
Author: Robert Ancell <robert ancell canonical com>
Date:   Thu Oct 11 15:47:14 2018 +1300

    region: Don't use gtk_widget_show_all
    
    It is removed in GTK+ 4

 panels/region/cc-format-chooser.c | 18 +++++++++++++-----
 panels/region/cc-input-chooser.c  | 15 +++++++++------
 2 files changed, 22 insertions(+), 11 deletions(-)
---
diff --git a/panels/region/cc-format-chooser.c b/panels/region/cc-format-chooser.c
index 550373056..6b10bec6a 100644
--- a/panels/region/cc-format-chooser.c
+++ b/panels/region/cc-format-chooser.c
@@ -191,7 +191,7 @@ sort_regions (gconstpointer a,
 static GtkWidget *
 padded_label_new (char *text, gboolean narrow)
 {
-        GtkWidget *widget;
+        GtkWidget *widget, *label;
 
         widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
         gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
@@ -199,7 +199,9 @@ padded_label_new (char *text, gboolean narrow)
         gtk_widget_set_margin_bottom (widget, 10);
         gtk_widget_set_margin_start (widget, narrow ? 10 : 80);
         gtk_widget_set_margin_end (widget, narrow ? 10 : 80);
-        gtk_container_add (GTK_CONTAINER (widget), gtk_label_new (text));
+        label = gtk_label_new (text);
+        gtk_widget_show (label);
+        gtk_container_add (GTK_CONTAINER (widget), label);
 
         return widget;
 }
@@ -222,11 +224,14 @@ region_widget_new (const gchar *locale_id,
         locale_untranslated_name = gnome_get_country_from_locale (locale_id, "C");
 
         row = gtk_list_box_row_new ();
+        gtk_widget_show (row);
         box = padded_label_new (locale_name, is_extra);
+        gtk_widget_show (box);
         gtk_container_add (GTK_CONTAINER (row), box);
 
         /* We add a check on each side of the label to keep it centered. */
         check = gtk_image_new ();
+        gtk_widget_show (check);
         gtk_image_set_from_icon_name (GTK_IMAGE (check), "object-select-symbolic", GTK_ICON_SIZE_MENU);
         gtk_widget_set_opacity (check, 0.0);
         g_object_set (check, "icon-size", GTK_ICON_SIZE_MENU, NULL);
@@ -234,6 +239,7 @@ region_widget_new (const gchar *locale_id,
         gtk_box_reorder_child (GTK_BOX (box), check, 0);
 
         check = gtk_image_new ();
+        gtk_widget_show (check);
         gtk_image_set_from_icon_name (GTK_IMAGE (check), "object-select-symbolic", GTK_ICON_SIZE_MENU);
         gtk_widget_set_opacity (check, 0.0);
         g_object_set (check, "icon-size", GTK_ICON_SIZE_MENU, NULL);
@@ -257,10 +263,12 @@ more_widget_new (void)
 
         row = gtk_list_box_row_new ();
         box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
+        gtk_widget_show (box);
         gtk_container_add (GTK_CONTAINER (row), box);
         gtk_widget_set_tooltip_text (box, _("Moreā€¦"));
 
         arrow = gtk_image_new_from_icon_name ("view-more-symbolic", GTK_ICON_SIZE_MENU);
+        gtk_widget_show (arrow);
         gtk_style_context_add_class (gtk_widget_get_style_context (arrow), "dim-label");
         gtk_widget_set_hexpand (arrow, TRUE);
         gtk_widget_set_margin_top (box, 10);
@@ -303,13 +311,12 @@ add_regions (CcFormatChooser *chooser,
                 if (!widget)
                   continue;
 
+                gtk_widget_show (widget);
                 gtk_container_add (GTK_CONTAINER (chooser->region_listbox), widget);
         }
 
         gtk_container_add (GTK_CONTAINER (chooser->region_listbox), GTK_WIDGET (chooser->more_item));
 
-        gtk_widget_show_all (chooser->region_listbox);
-
         chooser->adding = FALSE;
 }
 
@@ -494,9 +501,10 @@ cc_format_chooser_init (CcFormatChooser *chooser)
         gtk_widget_init_template (GTK_WIDGET (chooser));
 
         chooser->more_item = more_widget_new ();
+        gtk_widget_show (GTK_WIDGET (chooser->more_item));
         /* We ref-sink here so we can reuse this widget multiple times */
         chooser->no_results = g_object_ref_sink (no_results_widget_new ());
-        gtk_widget_show_all (chooser->no_results);
+        gtk_widget_show (chooser->no_results);
 
         gtk_list_box_set_sort_func (GTK_LIST_BOX (chooser->region_listbox),
                                     (GtkListBoxSortFunc)sort_regions, chooser, NULL);
diff --git a/panels/region/cc-input-chooser.c b/panels/region/cc-input-chooser.c
index db4bf5558..818611671 100644
--- a/panels/region/cc-input-chooser.c
+++ b/panels/region/cc-input-chooser.c
@@ -137,10 +137,12 @@ padded_label_new (const gchar        *text,
   if (direction == ROW_TRAVEL_DIRECTION_BACKWARD)
     {
       arrow = gtk_image_new_from_icon_name ("go-previous-symbolic", GTK_ICON_SIZE_MENU);
+      gtk_widget_show (arrow);
       gtk_container_add (GTK_CONTAINER (widget), arrow);
     }
 
   label = gtk_label_new (text);
+  gtk_widget_show (label);
   gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_MIDDLE);
   gtk_widget_set_hexpand (label, TRUE);
   gtk_widget_set_halign (label, alignment);
@@ -152,6 +154,7 @@ padded_label_new (const gchar        *text,
   if (direction == ROW_TRAVEL_DIRECTION_FORWARD)
     {
       arrow = gtk_image_new_from_icon_name ("go-next-symbolic", GTK_ICON_SIZE_MENU);
+      gtk_widget_show (arrow);
       gtk_container_add (GTK_CONTAINER (widget), arrow);
     }
 
@@ -313,6 +316,7 @@ show_input_sources_for_locale (CcInputChooser *chooser,
   if (!info->back_row)
     {
       info->back_row = g_object_ref_sink (back_row_new (info->name));
+      gtk_widget_show (GTK_WIDGET (info->back_row));
       g_object_set_data (G_OBJECT (info->back_row), "back", GINT_TO_POINTER (TRUE));
       g_object_set_data (G_OBJECT (info->back_row), "locale-info", info);
     }
@@ -320,8 +324,6 @@ show_input_sources_for_locale (CcInputChooser *chooser,
 
   add_input_source_rows_for_locale (chooser, info);
 
-  gtk_widget_show_all (chooser->input_listbox);
-
   gtk_adjustment_set_value (chooser->adjustment,
                             gtk_adjustment_get_lower (chooser->adjustment));
   gtk_list_box_set_header_func (GTK_LIST_BOX (chooser->input_listbox), cc_list_box_update_header_func, NULL, 
NULL);
@@ -364,6 +366,7 @@ show_locale_rows (CcInputChooser *chooser)
       if (!info->locale_row)
         {
           info->locale_row = g_object_ref_sink (locale_row_new (info->name));
+          gtk_widget_show (GTK_WIDGET (info->locale_row));
           g_object_set_data (G_OBJECT (info->locale_row), "locale-info", info);
 
           if (!chooser->showing_extra &&
@@ -376,8 +379,6 @@ show_locale_rows (CcInputChooser *chooser)
 
   gtk_container_add (GTK_CONTAINER (chooser->input_listbox), GTK_WIDGET (chooser->more_row));
 
-  gtk_widget_show_all (chooser->input_listbox);
-
   gtk_adjustment_set_value (chooser->adjustment,
                             gtk_adjustment_get_lower (chooser->adjustment));
   gtk_list_box_set_header_func (GTK_LIST_BOX (chooser->input_listbox), cc_list_box_update_header_func, NULL, 
NULL);
@@ -666,7 +667,8 @@ add_default_row (CcInputChooser *chooser,
   info->default_input_source_row = input_source_row_new (chooser, type, id);
   if (info->default_input_source_row)
     {
-      g_object_ref_sink (info->default_input_source_row);
+      gtk_widget_show (GTK_WIDGET (info->default_input_source_row));
+      g_object_ref_sink (GTK_WIDGET (info->default_input_source_row));
       g_object_set_data (G_OBJECT (info->default_input_source_row), "default", GINT_TO_POINTER (TRUE));
       g_object_set_data (G_OBJECT (info->default_input_source_row), "locale-info", info);
     }
@@ -698,6 +700,7 @@ add_rows_to_table (CcInputChooser *chooser,
       if (g_strcmp0 (id, default_id))
         {
           row = input_source_row_new (chooser, type, id);
+          gtk_widget_show (GTK_WIDGET (row));
           if (row)
             {
               g_object_set_data (G_OBJECT (row), "locale-info", info);
@@ -1010,7 +1013,7 @@ cc_input_chooser_init (CcInputChooser *chooser)
 
   chooser->more_row = g_object_ref_sink (more_row_new ());
   chooser->no_results = g_object_ref_sink (no_results_widget_new ());
-  gtk_widget_show_all (chooser->no_results);
+  gtk_widget_show (chooser->no_results);
 
   gtk_list_box_set_filter_func (GTK_LIST_BOX (chooser->input_listbox), list_filter, chooser, NULL);
   gtk_list_box_set_sort_func (GTK_LIST_BOX (chooser->input_listbox), (GtkListBoxSortFunc)list_sort, chooser, 
NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]