[gtranslator: 12/15] Remove remaining uses of container_add for boxes




commit ca6288aa204082e1ccd7d69480fa74242e884323
Author: Maximiliano Sandoval R <msandova gnome org>
Date:   Wed Mar 16 12:12:38 2022 +0100

    Remove remaining uses of container_add for boxes

 plugins/dictionary/gtr-dict-panel.c |  2 +-
 src/gtr-dl-teams.c                  |  8 ++++----
 src/gtr-filter-selection.c          |  9 +++++----
 src/gtr-tab.c                       |  3 ++-
 src/gtr-utils.c                     | 12 ++++++++++++
 src/gtr-utils.h                     |  4 ++++
 6 files changed, 28 insertions(+), 10 deletions(-)
---
diff --git a/plugins/dictionary/gtr-dict-panel.c b/plugins/dictionary/gtr-dict-panel.c
index 0b2e3473..226ddc16 100644
--- a/plugins/dictionary/gtr-dict-panel.c
+++ b/plugins/dictionary/gtr-dict-panel.c
@@ -523,7 +523,7 @@ gtr_dict_panel_init (GtrDictPanel * panel)
   g_signal_connect (panel->priv->defbox, "link-clicked",
                     G_CALLBACK (gtr_dict_panel_link_clicked), panel);
 
-  gtk_container_add (GTK_CONTAINER (vbox), panel->priv->defbox);
+  gtk_box_append (G_BOX (vbox), panel->priv->defbox);
   gtk_widget_show (panel->priv->defbox);
 
   /* Sidebar */
diff --git a/src/gtr-dl-teams.c b/src/gtr-dl-teams.c
index f98f7a77..3884dd2f 100644
--- a/src/gtr-dl-teams.c
+++ b/src/gtr-dl-teams.c
@@ -872,14 +872,14 @@ gtr_dl_teams_init (GtrDlTeams *self)
   gtk_widget_set_name (priv->teams_combobox, "combo_teams");
   gtr_filter_selection_set_text (GTR_FILTER_SELECTION (priv->teams_combobox), _("Translation Team"));
 
-  gtk_container_add (GTK_CONTAINER (priv->select_box), priv->teams_combobox);
+  gtk_box_append (GTK_BOX (priv->select_box), priv->teams_combobox);
   gtk_widget_set_sensitive (priv->teams_combobox, FALSE);
 
   priv->modules_combobox = GTK_WIDGET (gtr_filter_selection_new ());
   gtk_widget_set_name (priv->modules_combobox, "combo_modules");
   gtr_filter_selection_set_text (GTR_FILTER_SELECTION (priv->modules_combobox), _("Module"));
 
-  gtk_container_add (GTK_CONTAINER (priv->select_box), priv->modules_combobox);
+  gtk_box_append (GTK_BOX (priv->select_box), priv->modules_combobox);
   gtk_widget_set_sensitive (priv->modules_combobox, FALSE);
 
   g_signal_connect (priv->open_button,
@@ -890,12 +890,12 @@ gtr_dl_teams_init (GtrDlTeams *self)
   /* Add empty combo boxes for DL domains and branches and hide them */
   priv->domains_combobox = gtk_combo_box_text_new ();
   gtk_widget_set_name (priv->domains_combobox, "combo_domains");
-  gtk_container_add (GTK_CONTAINER (priv->select_box), priv->domains_combobox);
+  gtk_box_append (GTK_BOX (priv->select_box), priv->domains_combobox);
   gtk_widget_hide (priv->domains_combobox);
 
   priv->branches_combobox = gtk_combo_box_text_new ();
   gtk_widget_set_name (priv->branches_combobox, "combo_branches");
-  gtk_container_add (GTK_CONTAINER (priv->select_box), priv->branches_combobox);
+  gtk_box_append (GTK_BOX (priv->select_box), priv->branches_combobox);
   gtk_widget_hide (priv->branches_combobox);
 
   /* Load teams and modules automatically */
diff --git a/src/gtr-filter-selection.c b/src/gtr-filter-selection.c
index 73235e1c..8c0a1852 100644
--- a/src/gtr-filter-selection.c
+++ b/src/gtr-filter-selection.c
@@ -21,6 +21,7 @@
 #endif
 
 #include "gtr-filter-selection.h"
+#include "gtr-utils.h"
 
 typedef struct
 {
@@ -80,7 +81,7 @@ filter_option (GtkEditable        *entry,
   while (children)
     {
       GtkWidget *w = GTK_WIDGET (children->data);
-      gtk_container_remove (GTK_CONTAINER (priv->option_list), w);
+      gtk_list_box_remove (GTK_LIST_BOX (priv->option_list), w);
       children = g_list_next (children);
     }
 
@@ -95,7 +96,7 @@ filter_option (GtkEditable        *entry,
 
       child = gtk_label_new (opt->desc);
       gtk_label_set_xalign (GTK_LABEL (child), 0.0);
-      gtk_container_add (GTK_CONTAINER (priv->option_list), child);
+      gtk_list_box_append (GTK_LIST_BOX (priv->option_list), child);
     }
   gtk_widget_show_all (priv->option_list);
 }
@@ -209,7 +210,7 @@ gtr_filter_selection_set_options_full (GtrFilterSelection *self,
   while (children)
     {
       GtkWidget *w = GTK_WIDGET (children->data);
-      gtk_container_remove (GTK_CONTAINER (priv->option_list), w);
+      gtk_list_box_remove (GTK_LIST_BOX (priv->option_list), w);
       children = g_list_next (children);
     }
 
@@ -218,7 +219,7 @@ gtr_filter_selection_set_options_full (GtrFilterSelection *self,
       GtrFilterOption *opt = (GtrFilterOption *)o->data;
       GtkWidget *child = gtk_label_new (opt->desc);
       gtk_label_set_xalign (GTK_LABEL (child), 0.0);
-      gtk_container_add (GTK_CONTAINER (priv->option_list), child);
+      gtk_list_box_append (GTK_LIST_BOX (priv->option_list), child);
     }
 
   gtk_widget_show_all (priv->option_list);
diff --git a/src/gtr-tab.c b/src/gtr-tab.c
index e730bb61..b22d2355 100644
--- a/src/gtr-tab.c
+++ b/src/gtr-tab.c
@@ -47,6 +47,7 @@
 #include "gtr-window.h"
 #include "gtr-progress.h"
 #include "gtr-actions.h"
+#include "gtr-utils.h"
 
 #include <glib.h>
 #include <glib-object.h>
@@ -786,7 +787,7 @@ gtr_tab_init (GtrTab * tab)
   priv->find_replace_flag = FALSE;
   priv->progress = gtr_progress_new ();
   gtk_widget_show (GTK_WIDGET (priv->progress));
-  gtk_container_add (GTK_CONTAINER (priv->progress_box), GTK_WIDGET (priv->progress));
+  gtk_box_append (GTK_BOX (priv->progress_box), GTK_WIDGET (priv->progress));
 
   g_signal_connect (priv->progress_eventbox, "button-press-event",
                     G_CALLBACK (show_hide_revealer), tab);
diff --git a/src/gtr-utils.c b/src/gtr-utils.c
index 8e5d549a..c89d1514 100644
--- a/src/gtr-utils.c
+++ b/src/gtr-utils.c
@@ -806,3 +806,15 @@ gtk_box_append (GtkBox *box, GtkWidget *child)
 {
   gtk_container_add (GTK_CONTAINER (box), child);
 }
+
+void
+gtk_list_box_append (GtkListBox *box, GtkWidget *child)
+{
+  gtk_container_add (GTK_CONTAINER (box), child);
+}
+
+void
+gtk_list_box_remove (GtkListBox *box, GtkWidget *child)
+{
+  gtk_container_remove (GTK_CONTAINER (box), child);
+}
diff --git a/src/gtr-utils.h b/src/gtr-utils.h
index eac14a96..10aea191 100644
--- a/src/gtr-utils.h
+++ b/src/gtr-utils.h
@@ -82,4 +82,8 @@ void gtr_utils_menu_position_under_tree_view (GtkMenu * menu,
      gchar * pango_font_description_to_css (PangoFontDescription *desc);
 
      void gtk_box_append (GtkBox *box, GtkWidget *child);
+
+     void gtk_list_box_append (GtkListBox *box, GtkWidget *child);
+
+     void gtk_list_box_remove (GtkListBox *box, GtkWidget *child);
 #endif


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