[gnome-software: 25/110] Remove leftover GtkContainer APIs




commit 4d4a40b99f3965f086472465b5482bb66b656d2b
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sun Aug 22 18:28:49 2021 -0300

    Remove leftover GtkContainer APIs
    
    Most of it doesn't need any kind of replacement.
    
    GtkStack now provides specific API to set the 'needs-attention'
    property of children.

 src/gs-common.c        | 15 +--------------
 src/gs-details-page.c  |  4 ----
 src/gs-overview-page.c |  4 ----
 src/gs-page.c          |  2 --
 src/gs-rounded-bin.c   |  6 ------
 src/gs-shell.c         |  6 +++---
 src/gs-updates-page.c  |  4 ----
 7 files changed, 4 insertions(+), 37 deletions(-)
---
diff --git a/src/gs-common.c b/src/gs-common.c
index 03ddec467..17bbdb33f 100644
--- a/src/gs-common.c
+++ b/src/gs-common.c
@@ -453,13 +453,6 @@ gs_utils_widget_set_css (GtkWidget *widget, GtkCssProvider **provider, const gch
                                        GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
 }
 
-static void
-do_not_expand (GtkWidget *child, gpointer data)
-{
-       gtk_container_child_set (GTK_CONTAINER (gtk_widget_get_parent (child)),
-                                child, "expand", FALSE, "fill", FALSE, NULL);
-}
-
 static gboolean
 unset_focus (GtkWidget *widget, GdkEvent *event, gpointer data)
 {
@@ -479,7 +472,7 @@ static void
 insert_details_widget (GtkMessageDialog *dialog, const gchar *details)
 {
        GtkWidget *message_area, *sw, *label;
-       GtkWidget *box, *tv;
+       GtkWidget *tv;
        GtkWidget *child;
        GtkTextBuffer *buffer;
        g_autoptr(GString) msg = NULL;
@@ -499,12 +492,6 @@ insert_details_widget (GtkMessageDialog *dialog, const gchar *details)
 
        message_area = gtk_message_dialog_get_message_area (dialog);
        g_assert (GTK_IS_BOX (message_area));
-       /* make the hbox expand */
-       box = gtk_widget_get_parent (message_area);
-       gtk_container_child_set (GTK_CONTAINER (gtk_widget_get_parent (box)), box,
-                                "expand", TRUE, "fill", TRUE, NULL);
-       /* make the labels not expand */
-       gtk_container_foreach (GTK_CONTAINER (message_area), do_not_expand, NULL);
 
        /* Find the secondary label and set its width_chars.   */
        /* Otherwise the label will tend to expand vertically. */
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index ce2178a8c..ea626080e 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -2063,7 +2063,6 @@ gs_details_page_setup (GsPage *page,
                        GError **error)
 {
        GsDetailsPage *self = GS_DETAILS_PAGE (page);
-       GtkAdjustment *adj;
 
        g_return_val_if_fail (GS_IS_DETAILS_PAGE (self), FALSE);
 
@@ -2080,9 +2079,6 @@ gs_details_page_setup (GsPage *page,
        gtk_list_box_set_sort_func (GTK_LIST_BOX (self->origin_popover_list_box),
                                    origin_popover_list_sort_func,
                                    NULL, NULL);
-
-       adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (self->scrolledwindow_details));
-       gtk_container_set_focus_vadjustment (GTK_CONTAINER (self->box_details), adj);
        return TRUE;
 }
 
diff --git a/src/gs-overview-page.c b/src/gs-overview-page.c
index 6b3e5f1e0..7c08a8849 100644
--- a/src/gs-overview-page.c
+++ b/src/gs-overview-page.c
@@ -585,7 +585,6 @@ gs_overview_page_setup (GsPage *page,
                         GError **error)
 {
        GsOverviewPage *self = GS_OVERVIEW_PAGE (page);
-       GtkAdjustment *adj;
        GtkWidget *tile;
        gint i;
        g_autofree gchar *text = NULL;
@@ -622,9 +621,6 @@ gs_overview_page_setup (GsPage *page,
        /* avoid a ref cycle */
        self->shell = shell;
 
-       adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (self->scrolledwindow_overview));
-       gtk_container_set_focus_vadjustment (GTK_CONTAINER (self->box_overview), adj);
-
        for (i = 0; i < N_TILES; i++) {
                tile = gs_summary_tile_new (NULL);
                gtk_flow_box_insert (GTK_FLOW_BOX (self->box_popular), tile, -1);
diff --git a/src/gs-page.c b/src/gs-page.c
index d8d583db1..09ba0710a 100644
--- a/src/gs-page.c
+++ b/src/gs-page.c
@@ -113,7 +113,6 @@ gs_page_show_update_message (GsPageHelper *helper, AsScreenshot *ss)
                gtk_widget_set_margin_end (ssimg, 24);
                content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
                gtk_box_append (GTK_BOX (content_area), ssimg);
-               gtk_container_child_set (GTK_CONTAINER (content_area), ssimg, "pack-type", GTK_PACK_END, 
NULL);
        }
 
        /* handle this async */
@@ -385,7 +384,6 @@ gs_page_needs_user_action (GsPageHelper *helper, AsScreenshot *ss)
        gtk_widget_set_margin_end (ssimg, 24);
        content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
        gtk_box_append (GTK_BOX (content_area), ssimg);
-       gtk_container_child_set (GTK_CONTAINER (content_area), ssimg, "pack-type", GTK_PACK_END, NULL);
 
        /* handle this async */
        g_signal_connect (dialog, "response",
diff --git a/src/gs-rounded-bin.c b/src/gs-rounded-bin.c
index b44e5f229..79eb8faa9 100644
--- a/src/gs-rounded-bin.c
+++ b/src/gs-rounded-bin.c
@@ -212,12 +212,6 @@ gs_rounded_bin_draw (GtkWidget *widget,
                gtk_render_frame (ctx, surface_ctx, xy, xy, w, h);
        }
 
-       if (gtk_bin_get_child (GTK_BIN (widget)) != NULL) {
-               gtk_container_propagate_draw (GTK_CONTAINER (widget),
-                                             gtk_bin_get_child (GTK_BIN (widget)),
-                                             surface_ctx);
-       }
-
        cairo_set_source_surface (cr, surface, 0.0, 0.0);
        cairo_rectangle (cr, xy + r, xy, w - r * 2.0, r);
        cairo_rectangle (cr, xy + r, xy + h - r, w - r * 2.0, r);
diff --git a/src/gs-shell.c b/src/gs-shell.c
index f49a8b87e..8cb123e5a 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -2160,6 +2160,7 @@ updates_page_notify_counter_cb (GObject    *obj,
 {
        GsPage *page = GS_PAGE (obj);
        GsShell *shell = GS_SHELL (user_data);
+       GtkStackPage *stack_page;
        gboolean needs_attention;
 
        /* Update the needs-attention child property of the page in the
@@ -2169,9 +2170,8 @@ updates_page_notify_counter_cb (GObject    *obj,
         * property and a child property. */
        needs_attention = (gs_page_get_counter (page) > 0);
 
-       gtk_container_child_set (GTK_CONTAINER (shell->stack_main), GTK_WIDGET (page),
-                                "needs-attention", needs_attention,
-                                NULL);
+       stack_page = gtk_stack_get_page (shell->stack_main, GTK_WIDGET (page));
+       gtk_stack_page_set_needs_attention (stack_page, needs_attention);
 }
 
 static void
diff --git a/src/gs-updates-page.c b/src/gs-updates-page.c
index f07cb100a..8173a529a 100644
--- a/src/gs-updates-page.c
+++ b/src/gs-updates-page.c
@@ -1299,12 +1299,8 @@ gs_updates_page_setup (GsPage *page,
        adw_squeezer_add (ADW_SQUEEZER (self->header_checking_label), widget);
 
        gtk_box_prepend (GTK_BOX (self->header_start_box), self->header_checking_label);
-       gtk_container_child_set(GTK_CONTAINER (self->header_start_box), self->header_checking_label,
-                               "pack-type", GTK_PACK_END, NULL);
        self->header_spinner_start = gtk_spinner_new ();
        gtk_box_prepend (GTK_BOX (self->header_start_box), self->header_spinner_start);
-       gtk_container_child_set (GTK_CONTAINER (self->header_start_box), self->header_spinner_start,
-                                "pack-type", GTK_PACK_END, NULL);
 
        /* setup update details window */
        self->button_refresh = gtk_button_new_from_icon_name ("view-refresh-symbolic", GTK_ICON_SIZE_MENU);


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