[file-roller/wip/gtk4: 3/54] gtk4: removed use of gtk_container_add




commit 28af47ca26b799b8e3a45dc75b1a3494900f4f95
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Mon Sep 26 22:32:18 2022 +0200

    gtk4: removed use of gtk_container_add

 src/dlg-add.c                 |  2 +-
 src/dlg-ask-password.c        |  6 +++---
 src/dlg-delete.c              |  4 +---
 src/dlg-password.c            |  3 +--
 src/dlg-prop.c                |  4 +---
 src/dlg-update.c              |  2 +-
 src/fr-file-selector-dialog.c |  4 ++--
 src/fr-new-archive-dialog.c   |  2 +-
 src/fr-window.c               | 10 +++++-----
 src/gtk-utils.c               |  8 +++-----
 10 files changed, 19 insertions(+), 26 deletions(-)
---
diff --git a/src/dlg-add.c b/src/dlg-add.c
index dc6580f2..022dde0d 100644
--- a/src/dlg-add.c
+++ b/src/dlg-add.c
@@ -750,7 +750,7 @@ load_options_activate_cb (GSimpleAction *action,
                                         "modal", TRUE,
                                         "use-header-bar", _gtk_settings_get_dialogs_use_header (),
                                         NULL);
-       gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (aod_data->dialog))),
+       gtk_box_append (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (aod_data->dialog))),
                           _gtk_builder_get_widget (aod_data->builder, "add_options_dialog"));
 
        gtk_dialog_add_buttons (GTK_DIALOG (aod_data->dialog),
diff --git a/src/dlg-ask-password.c b/src/dlg-ask-password.c
index b57008aa..88eacf18 100644
--- a/src/dlg-ask-password.c
+++ b/src/dlg-ask-password.c
@@ -114,8 +114,8 @@ dlg_ask_password__common (FrWindow       *window,
                                     "modal", TRUE,
                                     "use-header-bar", _gtk_settings_get_dialogs_use_header (),
                                     NULL);
-       gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (data->dialog))),
-                          GET_WIDGET ("password_vbox"));
+       gtk_box_append (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (data->dialog))),
+                       GET_WIDGET ("password_vbox"));
        gtk_dialog_add_buttons (GTK_DIALOG (data->dialog),
                                _GTK_LABEL_CANCEL, GTK_RESPONSE_CANCEL,
                                _("_OK"), GTK_RESPONSE_OK,
@@ -151,7 +151,7 @@ dlg_ask_password__common (FrWindow       *window,
 
                info_bar = gtk_info_bar_new ();
                label = gtk_label_new (_("Wrong password."));
-               gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (info_bar))), 
label);
+               gtk_box_append (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (info_bar))), label);
                gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_ERROR);
                gtk_box_pack_start (GTK_BOX (GET_WIDGET ("error_box")), info_bar, TRUE, TRUE, 0);
                gtk_widget_show_all (GET_WIDGET ("error_box"));
diff --git a/src/dlg-delete.c b/src/dlg-delete.c
index 6d620fff..8655322b 100644
--- a/src/dlg-delete.c
+++ b/src/dlg-delete.c
@@ -109,7 +109,6 @@ dlg_delete__common (FrWindow *window,
                    GList    *selected_files)
 {
        DialogData *data;
-       GtkWidget  *content_area;
        GtkWidget  *delete_box;
        GtkWidget  *ok_button;
 
@@ -142,8 +141,7 @@ dlg_delete__common (FrWindow *window,
        data->d_files_radio = _gtk_builder_get_widget (data->builder, "d_files_radio");
        data->d_files_entry = _gtk_builder_get_widget (data->builder, "d_files_entry");
 
-       content_area = gtk_dialog_get_content_area (GTK_DIALOG (data->dialog));
-       gtk_container_add (GTK_CONTAINER (content_area), delete_box);
+       gtk_box_append (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (data->dialog))), delete_box);
 
        /* Set widgets data. */
 
diff --git a/src/dlg-password.c b/src/dlg-password.c
index 9cb319ec..1f9980b3 100644
--- a/src/dlg-password.c
+++ b/src/dlg-password.c
@@ -91,8 +91,7 @@ dlg_password (GtkWidget *widget,
                                     "use-header-bar", _gtk_settings_get_dialogs_use_header (),
                                     NULL);
        content_area = gtk_dialog_get_content_area (GTK_DIALOG (data->dialog));
-       gtk_container_add (GTK_CONTAINER (content_area),
-                          GET_WIDGET ("password_vbox"));
+       gtk_box_append (GTK_BOX (content_area), GET_WIDGET ("password_vbox"));
        gtk_dialog_add_buttons (GTK_DIALOG (data->dialog),
                                _GTK_LABEL_CANCEL, GTK_RESPONSE_CANCEL,
                                _GTK_LABEL_SAVE, GTK_RESPONSE_OK,
diff --git a/src/dlg-prop.c b/src/dlg-prop.c
index 94266215..54898831 100644
--- a/src/dlg-prop.c
+++ b/src/dlg-prop.c
@@ -49,7 +49,6 @@ void
 dlg_prop (FrWindow *window)
 {
        DialogData *data;
-       GtkWidget  *content_area;
        GtkWidget  *label;
        GtkWidget  *table;
        GFile      *parent;
@@ -77,8 +76,7 @@ dlg_prop (FrWindow *window)
                                       "use-header-bar", _gtk_settings_get_dialogs_use_header (),
                                       NULL);
 
-       content_area = gtk_dialog_get_content_area (GTK_DIALOG (data->dialog));
-       gtk_container_add (GTK_CONTAINER (content_area), table);
+       gtk_box_append (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (data->dialog))), table);
 
        /* Set widgets data. */
 
diff --git a/src/dlg-update.c b/src/dlg-update.c
index ee272423..657063c3 100644
--- a/src/dlg-update.c
+++ b/src/dlg-update.c
@@ -321,7 +321,7 @@ dlg_update (FrWindow *window)
                                                  NULL);
        content = _gtk_builder_get_widget (data->builder, "update_files_dialog_content");
        gtk_widget_set_vexpand (content, TRUE);
-       gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG 
(data->update_files_dialog))), content);
+       gtk_box_append (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (data->update_files_dialog))), 
content);
 
        gtk_dialog_add_button (GTK_DIALOG (data->update_files_dialog ), _GTK_LABEL_CANCEL, 
GTK_RESPONSE_CANCEL);
        gtk_dialog_add_button (GTK_DIALOG (data->update_files_dialog ), _("_Update"), DIALOG_RESPONSE_UPDATE);
diff --git a/src/fr-file-selector-dialog.c b/src/fr-file-selector-dialog.c
index e519ceab..f74486b4 100644
--- a/src/fr-file-selector-dialog.c
+++ b/src/fr-file-selector-dialog.c
@@ -758,10 +758,10 @@ fr_file_selector_dialog_set_extra_widget (FrFileSelectorDialog *self,
                                          GtkWidget            *extra_widget)
 {
        if (self->extra_widget != NULL)
-               gtk_container_remove (GTK_CONTAINER (GET_WIDGET ("extra_widget_container")), 
self->extra_widget);
+               gtk_box_remove (GTK_BOX (GET_WIDGET ("extra_widget_container")), self->extra_widget);
        self->extra_widget = extra_widget;
        if (self->extra_widget != NULL)
-               gtk_container_add (GTK_CONTAINER (GET_WIDGET ("extra_widget_container")), self->extra_widget);
+               gtk_box_append (GTK_BOX (GET_WIDGET ("extra_widget_container")), self->extra_widget);
 }
 
 
diff --git a/src/fr-new-archive-dialog.c b/src/fr-new-archive-dialog.c
index 5f55d237..6f81276d 100644
--- a/src/fr-new-archive-dialog.c
+++ b/src/fr-new-archive-dialog.c
@@ -211,7 +211,7 @@ _fr_new_archive_dialog_construct (FrNewArchiveDialog *self,
        _g_object_unref (self->original_file);
        self->original_file = _g_object_ref (original_file);
 
-       gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (self))), GET_WIDGET 
("content"));
+       gtk_box_append (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), GET_WIDGET ("content"));
 
        gtk_dialog_add_button (GTK_DIALOG (self), _GTK_LABEL_CANCEL, GTK_RESPONSE_CANCEL);
        switch (action) {
diff --git a/src/fr-window.c b/src/fr-window.c
index 30bf0a89..634c92da 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -5557,7 +5557,7 @@ fr_window_construct (FrWindow *window)
        /* Create the application. */
 
        private->layout = gtk_grid_new ();
-       gtk_container_add (GTK_CONTAINER (window), private->layout);
+       gtk_window_set_child (GTK_WINDOW (window), private->layout);
        gtk_widget_show (private->layout);
 
        gtk_window_set_title (GTK_WINDOW (window), _("Archive Manager"));
@@ -5720,7 +5720,7 @@ fr_window_construct (FrWindow *window)
        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (list_scrolled_window),
                                        GTK_POLICY_AUTOMATIC,
                                        GTK_POLICY_AUTOMATIC);
-       gtk_container_add (GTK_CONTAINER (list_scrolled_window), private->list_view);
+       gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (list_scrolled_window), private->list_view);
 
        /* filter bar */
 
@@ -5737,7 +5737,7 @@ fr_window_construct (FrWindow *window)
                          G_CALLBACK (filter_entry_stop_search_cb),
                          window);
        gtk_search_bar_connect_entry (GTK_SEARCH_BAR (private->filter_bar), GTK_ENTRY 
(private->filter_entry));
-       gtk_container_add (GTK_CONTAINER (private->filter_bar), filter_box);
+       gtk_search_bar_set_child (GTK_SEARCH_BAR (private->filter_bar), filter_box);
        gtk_box_pack_start (GTK_BOX (filter_box), private->filter_entry, TRUE, TRUE, 0);
        gtk_widget_show_all (private->filter_bar);
        fr_window_attach (FR_WINDOW (window), private->filter_bar, FR_WINDOW_AREA_FILTERBAR);
@@ -5785,7 +5785,7 @@ fr_window_construct (FrWindow *window)
        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (tree_scrolled_window),
                                        GTK_POLICY_AUTOMATIC,
                                        GTK_POLICY_AUTOMATIC);
-       gtk_container_add (GTK_CONTAINER (tree_scrolled_window), private->tree_view);
+       gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (tree_scrolled_window), private->tree_view);
 
        /* side pane */
 
@@ -8142,7 +8142,7 @@ fr_window_view_last_output (FrWindow   *window,
        vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
        gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
 
-       gtk_container_add (GTK_CONTAINER (scrolled), text_view);
+       gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), text_view);
        gtk_box_pack_start (GTK_BOX (vbox), scrolled,
                            TRUE, TRUE, 0);
 
diff --git a/src/gtk-utils.c b/src/gtk-utils.c
index 551f34a3..0047120f 100644
--- a/src/gtk-utils.c
+++ b/src/gtk-utils.c
@@ -101,7 +101,6 @@ _gtk_request_dialog_run (GtkWindow      *parent,
        GtkWidget  *dialog;
        GtkWidget  *label;
        GtkWidget  *entry;
-       GtkWidget  *content_area;
        GtkWidget  *request_box;
        char       *result;
 
@@ -116,8 +115,7 @@ _gtk_request_dialog_run (GtkWindow      *parent,
        gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
        gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), (flags & GTK_DIALOG_DESTROY_WITH_PARENT));
        gtk_window_set_title (GTK_WINDOW (dialog), title);
-       content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
-       gtk_container_add (GTK_CONTAINER (content_area), request_box);
+       gtk_box_append (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), request_box);
        g_object_weak_ref (G_OBJECT (request_box), (GWeakNotify) g_object_unref, builder);
 
        if (flags & GTK_DIALOG_MODAL)
@@ -217,7 +215,7 @@ _gtk_error_dialog_new (GtkWindow      *parent,
 
                text_view = gtk_text_view_new ();
                gtk_label_set_mnemonic_widget (GTK_LABEL (label), text_view);
-               gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
+               gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), text_view);
 
                text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
                gtk_text_buffer_create_tag (text_buffer, "monospace",
@@ -528,7 +526,7 @@ _gtk_header_bar_create_image_toggle_button (const char       *icon_name,
        g_return_val_if_fail (action_name != NULL, NULL);
 
        button = gtk_toggle_button_new ();
-       gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name (icon_name, 
GTK_ICON_SIZE_MENU));
+       gtk_button_set_child (GTK_BUTTON (button), gtk_image_new_from_icon_name (icon_name, 
GTK_ICON_SIZE_MENU));
        _gtk_menu_button_set_style_for_header_bar (button);
        gtk_actionable_set_action_name (GTK_ACTIONABLE (button), action_name);
        if (tooltip != NULL)


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