[gtk/bin-removal: 42/50] Use gtk_combo_box_set_child throughout



commit cf6db039541c9b82ac720792795d002102660740
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun May 3 12:19:17 2020 -0400

    Use gtk_combo_box_set_child throughout

 demos/gtk-demo/combobox.c        |  3 +--
 docs/tools/widgets.c             | 10 +++++-----
 gtk/a11y/gtkcomboboxaccessible.c |  4 ++--
 gtk/gtkcellrenderercombo.c       |  4 ++--
 gtk/gtkcomboboxtext.c            |  2 +-
 gtk/gtkprinteroptionwidget.c     |  8 ++++----
 tests/testcombo.c                |  2 +-
 7 files changed, 16 insertions(+), 17 deletions(-)
---
diff --git a/demos/gtk-demo/combobox.c b/demos/gtk-demo/combobox.c
index 1fd1d7bcb9..946267cc66 100644
--- a/demos/gtk-demo/combobox.c
+++ b/demos/gtk-demo/combobox.c
@@ -421,8 +421,7 @@ do_combobox (GtkWidget *do_widget)
     entry = g_object_new (TYPE_MASK_ENTRY, NULL);
     MASK_ENTRY (entry)->mask = "^([0-9]*|One|Two|2\302\275|Three)$";
 
-    gtk_container_remove (GTK_CONTAINER (combo), gtk_bin_get_child (GTK_BIN (combo)));
-    gtk_container_add (GTK_CONTAINER (combo), entry);
+    gtk_combo_box_set_child (GTK_COMBO_BOX (combo), entry);
 
     /* A combobox with string IDs */
     frame = gtk_frame_new ("String IDs");
diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c
index 9eaa0ce268..4fd3bd4303 100644
--- a/docs/tools/widgets.c
+++ b/docs/tools/widgets.c
@@ -307,13 +307,13 @@ create_combo_box_entry (void)
 
   model = (GtkTreeModel *)gtk_list_store_new (1, G_TYPE_STRING);
   widget = g_object_new (GTK_TYPE_COMBO_BOX,
-                        "has-entry", TRUE,
-                        "model", model,
-                        "entry-text-column", 0,
-                        NULL);
+                         "has-entry", TRUE,
+                         "model", model,
+                         "entry-text-column", 0,
+                         NULL);
   g_object_unref (model);
 
-  child = gtk_bin_get_child (GTK_BIN (widget));
+  child = gtk_combo_box_get_child (GTK_COMBO_BOX (widget));
   gtk_editable_set_text (GTK_EDITABLE (child), "Combo Box Entry");
   gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
   gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
diff --git a/gtk/a11y/gtkcomboboxaccessible.c b/gtk/a11y/gtkcomboboxaccessible.c
index b98a71a6f2..65298261ac 100644
--- a/gtk/a11y/gtkcomboboxaccessible.c
+++ b/gtk/a11y/gtkcomboboxaccessible.c
@@ -80,7 +80,7 @@ gtk_combo_box_accessible_initialize (AtkObject *obj,
       accessible->priv->popup_set = TRUE;
     }
   if (gtk_combo_box_get_has_entry (combo_box))
-    atk_object_set_parent (gtk_widget_get_accessible (gtk_bin_get_child (GTK_BIN (combo_box))), obj);
+    atk_object_set_parent (gtk_widget_get_accessible (gtk_combo_box_get_child (GTK_COMBO_BOX (combo_box))), 
obj);
 
   obj->role = ATK_ROLE_COMBO_BOX;
 }
@@ -181,7 +181,7 @@ gtk_combo_box_accessible_ref_child (AtkObject *obj,
     }
   else if (i == 1 && gtk_combo_box_get_has_entry (GTK_COMBO_BOX (widget)))
     {
-      child = gtk_widget_get_accessible (gtk_bin_get_child (GTK_BIN (widget)));
+      child = gtk_widget_get_accessible (gtk_combo_box_get_child (GTK_COMBO_BOX (widget)));
     }
   else
     {
diff --git a/gtk/gtkcellrenderercombo.c b/gtk/gtkcellrenderercombo.c
index 1e333a68d1..61de046f04 100644
--- a/gtk/gtkcellrenderercombo.c
+++ b/gtk/gtkcellrenderercombo.c
@@ -373,7 +373,7 @@ gtk_cell_renderer_combo_editing_done (GtkCellEditable *combo,
 
   if (gtk_combo_box_get_has_entry (GTK_COMBO_BOX (combo)))
     {
-      entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combo)));
+      entry = GTK_ENTRY (gtk_combo_box_get_child (GTK_COMBO_BOX (combo)));
       new_text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (entry)));
     }
   else 
@@ -469,7 +469,7 @@ gtk_cell_renderer_combo_start_editing (GtkCellRenderer     *cell,
 
       g_object_get (cell, "text", &text, NULL);
       if (text)
-       gtk_editable_set_text (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (combo))), text);
+       gtk_editable_set_text (GTK_EDITABLE (gtk_combo_box_get_child (GTK_COMBO_BOX (combo))), text);
       g_free (text);
     }
   else
diff --git a/gtk/gtkcomboboxtext.c b/gtk/gtkcomboboxtext.c
index bbfd426430..ddb8be2853 100644
--- a/gtk/gtkcomboboxtext.c
+++ b/gtk/gtkcomboboxtext.c
@@ -593,7 +593,7 @@ gtk_combo_box_text_get_active_text (GtkComboBoxText *combo_box)
    {
      GtkWidget *entry;
 
-     entry = gtk_bin_get_child (GTK_BIN (combo_box));
+     entry = gtk_combo_box_get_child (GTK_COMBO_BOX (combo_box));
      text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (entry)));
    }
   else if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo_box), &iter))
diff --git a/gtk/gtkprinteroptionwidget.c b/gtk/gtkprinteroptionwidget.c
index cdf434bc75..7cff48186d 100644
--- a/gtk/gtkprinteroptionwidget.c
+++ b/gtk/gtkprinteroptionwidget.c
@@ -393,7 +393,7 @@ combo_box_get (GtkWidget *combo, gboolean *custom)
     {
       if (gtk_combo_box_get_has_entry (GTK_COMBO_BOX (combo)))
         {
-          value = g_strdup (gtk_editable_get_text (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (combo)))));
+          value = g_strdup (gtk_editable_get_text (GTK_EDITABLE (gtk_combo_box_get_child (GTK_COMBO_BOX 
(combo)))));
           *custom = TRUE;
         }
 
@@ -672,7 +672,7 @@ combo_changed_cb (GtkWidget              *combo,
         {
           GtkEntry *entry;
          
-         entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combo)));
+         entry = GTK_ENTRY (gtk_combo_box_get_child (GTK_COMBO_BOX (combo)));
 
           gtk_editable_set_text (GTK_EDITABLE (entry), filtered_val);
        }
@@ -808,7 +808,7 @@ construct_widgets (GtkPrinterOptionWidget *widget)
            {
               GtkEntry *entry;
 
-             entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->combo)));
+             entry = GTK_ENTRY (gtk_combo_box_get_child (GTK_COMBO_BOX (priv->combo)));
 
               gtk_entry_set_visibility (entry, FALSE); 
            }
@@ -981,7 +981,7 @@ update_widgets (GtkPrinterOptionWidget *widget)
       {
         GtkEntry *entry;
 
-        entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->combo)));
+        entry = GTK_ENTRY (gtk_combo_box_get_child (GTK_COMBO_BOX (priv->combo)));
         if (gtk_printer_option_has_choice (source, source->value))
           combo_box_set (priv->combo, source->value);
         else
diff --git a/tests/testcombo.c b/tests/testcombo.c
index 51aae6a300..139f6df5b6 100644
--- a/tests/testcombo.c
+++ b/tests/testcombo.c
@@ -1112,7 +1112,7 @@ main (int argc, char **argv)
         displayed_row_changed (GTK_COMBO_BOX (combobox), GTK_CELL_VIEW (tmp));
         g_signal_connect (combobox, "changed", G_CALLBACK (displayed_row_changed), tmp);
 
-        gtk_container_add (GTK_CONTAINER (combobox), tmp);
+        gtk_combo_box_set_child (GTK_COMBO_BOX (combobox), tmp);
 
         /* GtkComboBox tree */
         tmp = gtk_frame_new ("GtkComboBox (tree)");


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