[gnome-software: 31/110] Replace gtk_widget_get_toplevel() by gtk_widget_get_root()




commit 696df18fe7fb3d2ce960dab39f028285ae04e781
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sun Aug 22 21:11:11 2021 -0300

    Replace gtk_widget_get_toplevel() by gtk_widget_get_root()

 src/gs-app-context-bar.c | 6 +++---
 src/gs-review-row.c      | 6 +++---
 src/gs-updates-section.c | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/src/gs-app-context-bar.c b/src/gs-app-context-bar.c
index 714ad85cc..466c1747c 100644
--- a/src/gs-app-context-bar.c
+++ b/src/gs-app-context-bar.c
@@ -750,9 +750,9 @@ tile_clicked_cb (GtkWidget *widget,
 {
        GsAppContextBar *self = GS_APP_CONTEXT_BAR (user_data);
        GtkWindow *dialog;
-       GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
+       GtkRoot *root = gtk_widget_get_root (widget);
 
-       if (GTK_IS_WINDOW (toplevel)) {
+       if (GTK_IS_WINDOW (root)) {
                if (widget == self->tiles[STORAGE_TILE].tile)
                        dialog = GTK_WINDOW (gs_storage_context_dialog_new (self->app));
                else if (widget == self->tiles[SAFETY_TILE].tile)
@@ -764,7 +764,7 @@ tile_clicked_cb (GtkWidget *widget,
                else
                        g_assert_not_reached ();
 
-               gtk_window_set_transient_for (dialog, GTK_WINDOW (toplevel));
+               gtk_window_set_transient_for (dialog, GTK_WINDOW (root));
                gtk_widget_show (GTK_WIDGET (dialog));
        }
 }
diff --git a/src/gs-review-row.c b/src/gs-review-row.c
index faaa8eeef..0f9b98fd5 100644
--- a/src/gs-review-row.c
+++ b/src/gs-review-row.c
@@ -212,7 +212,7 @@ static void
 gs_review_row_button_clicked_report_cb (GtkButton *button, GsReviewRow *row)
 {
        GtkWidget *dialog;
-       GtkWidget *toplevel;
+       GtkRoot *root;
        GtkWidget *widget;
        g_autoptr(GString) str = NULL;
 
@@ -227,8 +227,8 @@ gs_review_row_button_clicked_report_cb (GtkButton *button, GsReviewRow *row)
        g_string_append (str, _("Once reported, a review will be hidden until "
                                "it has been checked by an administrator."));
 
-       toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button));
-       dialog = gtk_message_dialog_new (GTK_WINDOW (toplevel),
+       root = gtk_widget_get_root (GTK_WIDGET (button));
+       dialog = gtk_message_dialog_new (GTK_WINDOW (root),
                                         GTK_DIALOG_MODAL |
                                         GTK_DIALOG_DESTROY_WITH_PARENT |
                                         GTK_DIALOG_USE_HEADER_BAR,
diff --git a/src/gs-updates-section.c b/src/gs-updates-section.c
index e6203f126..5edd774bd 100644
--- a/src/gs-updates-section.c
+++ b/src/gs-updates-section.c
@@ -66,15 +66,15 @@ gs_updates_section_get_list (GsUpdatesSection *self)
 static gboolean
 _listbox_keynav_failed_cb (GsAppRow *app_row, GtkDirectionType direction)
 {
-       GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (app_row));
+       GtkRoot *root = gtk_widget_get_root (GTK_WIDGET (app_row));
 
-       if (!toplevel)
+       if (!root)
                return FALSE;
 
        if (direction != GTK_DIR_UP && direction != GTK_DIR_DOWN)
                return FALSE;
 
-       return gtk_widget_child_focus (toplevel, direction == GTK_DIR_UP ? GTK_DIR_TAB_BACKWARD : 
GTK_DIR_TAB_FORWARD);
+       return gtk_widget_child_focus (GTK_WIDGET (root), direction == GTK_DIR_UP ? GTK_DIR_TAB_BACKWARD : 
GTK_DIR_TAB_FORWARD);
 }
 
 static void


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