[nautilus/wip/antoniof/switch-to-gtk4: 13/36] general: GtkWidget::get_toplevel() -> GtkWidget::get_root()




commit a21f5a8f742b54802f04539760010f0531774e05
Author: António Fernandes <antoniof gnome org>
Date:   Sun Dec 19 21:52:50 2021 +0000

    general: GtkWidget::get_toplevel() -> GtkWidget::get_root()

 eel/eel-stock-dialogs.c          |  2 +-
 src/nautilus-dnd.c               |  2 +-
 src/nautilus-list-view.c         |  2 +-
 src/nautilus-location-entry.c    |  4 ++--
 src/nautilus-places-view.c       |  8 ++++----
 src/nautilus-properties-window.c |  8 ++++----
 src/nautilus-search-popover.c    |  4 ++--
 src/nautilus-trash-bar.c         |  6 +++---
 src/nautilus-window-slot-dnd.c   | 12 ++++++------
 src/nautilus-x-content-bar.c     |  2 +-
 10 files changed, 25 insertions(+), 25 deletions(-)
---
diff --git a/eel/eel-stock-dialogs.c b/eel/eel-stock-dialogs.c
index eb1f542fa..b651bc05a 100644
--- a/eel/eel-stock-dialogs.c
+++ b/eel/eel-stock-dialogs.c
@@ -334,7 +334,7 @@ eel_show_simple_dialog (GtkWidget     *parent,
     chosen_parent = NULL;
     if (parent != NULL)
     {
-        top_widget = gtk_widget_get_toplevel (parent);
+        top_widget = GTK_WIDGET (gtk_widget_get_root (parent));
         if (GTK_IS_WINDOW (top_widget))
         {
             chosen_parent = top_widget;
diff --git a/src/nautilus-dnd.c b/src/nautilus-dnd.c
index 7477f0af8..a1e9ff128 100644
--- a/src/nautilus-dnd.c
+++ b/src/nautilus-dnd.c
@@ -413,7 +413,7 @@ nautilus_drag_get_source_data (GdkDragContext *context)
         NautilusWindowSlot *active_slot;
         NautilusView *view;
 
-        window = NAUTILUS_WINDOW (gtk_widget_get_toplevel (source_widget));
+        window = NAUTILUS_WINDOW (gtk_widget_get_root (source_widget));
         active_slot = nautilus_window_get_active_slot (window);
         view = nautilus_window_slot_get_current_view (active_slot);
         if (NAUTILUS_IS_LIST_VIEW (view))
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index f27962527..4333854ae 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -3285,7 +3285,7 @@ create_column_editor (NautilusListView *view)
 
     window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
     gtk_window_set_transient_for (GTK_WINDOW (window),
-                                  GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view))));
+                                  GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (view))));
 
     file = nautilus_files_view_get_directory_as_file (NAUTILUS_FILES_VIEW (view));
     name = nautilus_file_get_display_name (file);
diff --git a/src/nautilus-location-entry.c b/src/nautilus-location-entry.c
index e90c55d2d..62e588b2f 100644
--- a/src/nautilus-location-entry.c
+++ b/src/nautilus-location-entry.c
@@ -301,7 +301,7 @@ drag_data_received_callback (GtkWidget        *widget,
 {
     char **names;
     int name_count;
-    GtkWidget *window;
+    GtkRoot *window;
     char *prompt;
     char *detail;
     GtkDialog *dialog;
@@ -320,7 +320,7 @@ drag_data_received_callback (GtkWidget        *widget,
         return;
     }
 
-    window = gtk_widget_get_toplevel (widget);
+    window = gtk_widget_get_root (widget);
 
     op_data = g_new0 (OpenWindowsOnDragData, 1);
     op_data->self = g_object_ref (self);
diff --git a/src/nautilus-places-view.c b/src/nautilus-places-view.c
index 366b5b147..45e69dbf4 100644
--- a/src/nautilus-places-view.c
+++ b/src/nautilus-places-view.c
@@ -95,12 +95,12 @@ open_location_cb (NautilusPlacesView         *view,
     if (slot)
     {
         NautilusFile *file;
-        GtkWidget *window;
+        GtkRoot *window;
         char *path;
 
         path = "other-locations:///";
         file = nautilus_file_get (location);
-        window = gtk_widget_get_toplevel (GTK_WIDGET (view));
+        window = gtk_widget_get_root (GTK_WIDGET (view));
 
         nautilus_mime_activate_file (GTK_WINDOW (window),
                                      NAUTILUS_WINDOW_SLOT (slot),
@@ -123,9 +123,9 @@ show_error_message_cb (NautilusGtkPlacesView *view,
                        const gchar           *secondary)
 {
     GtkWidget *dialog;
-    GtkWidget *window;
+    GtkRoot *window;
 
-    window = gtk_widget_get_toplevel (GTK_WIDGET (view));
+    window = gtk_widget_get_root (GTK_WIDGET (view));
 
     dialog = gtk_message_dialog_new (GTK_WINDOW (window),
                                      GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 5ed5328ec..88d3182c8 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -526,7 +526,7 @@ nautilus_properties_window_drag_data_received (GtkWidget        *widget,
     GtkWindow *window;
 
     image = GTK_IMAGE (widget);
-    window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (image)));
+    window = GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (image)));
 
     uris = g_strsplit ((const gchar *) gtk_selection_data_get_data (selection_data), "\r\n", 0);
     exactly_one = uris[0] != NULL && (uris[1] == NULL || uris[1][0] == '\0');
@@ -4440,7 +4440,7 @@ add_clicked_cb (GtkButton *button,
                                    g_app_info_get_display_name (info), error->message);
         show_dialog (_("Could not add application"),
                      message,
-                     GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))),
+                     GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))),
                      GTK_MESSAGE_ERROR);
     }
     else
@@ -4468,7 +4468,7 @@ forget_clicked_cb (GtkButton *button,
         {
             show_dialog (_("Could not forget association"),
                          error->message,
-                         GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))),
+                         GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))),
                          GTK_MESSAGE_ERROR);
         }
 
@@ -4513,7 +4513,7 @@ set_as_default_clicked_cb (GtkButton *button,
                                    g_app_info_get_display_name (info), error->message);
         show_dialog (_("Could not set as default"),
                      message,
-                     GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))),
+                     GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))),
                      GTK_MESSAGE_ERROR);
     }
 
diff --git a/src/nautilus-search-popover.c b/src/nautilus-search-popover.c
index 034be9229..bab56ddca 100644
--- a/src/nautilus-search-popover.c
+++ b/src/nautilus-search-popover.c
@@ -586,7 +586,7 @@ show_other_types_dialog (NautilusSearchPopover *popover)
     GtkListStore *store;
     GtkTreeViewColumn *column;
     GtkCellRenderer *renderer;
-    GtkWidget *toplevel;
+    GtkRoot *toplevel;
     GtkTreeSelection *selection;
 
     mime_infos = g_content_types_get_registered ();
@@ -615,7 +615,7 @@ show_other_types_dialog (NautilusSearchPopover *popover)
     }
     g_list_free (mime_infos);
 
-    toplevel = gtk_widget_get_toplevel (GTK_WIDGET (popover));
+    toplevel = gtk_widget_get_root (GTK_WIDGET (popover));
     dialog = gtk_dialog_new_with_buttons (_("Select type"),
                                           GTK_WINDOW (toplevel),
                                           GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT | 
GTK_DIALOG_USE_HEADER_BAR,
diff --git a/src/nautilus-trash-bar.c b/src/nautilus-trash-bar.c
index 42bdfd69c..08631f571 100644
--- a/src/nautilus-trash-bar.c
+++ b/src/nautilus-trash-bar.c
@@ -162,10 +162,10 @@ trash_bar_response_cb (GtkInfoBar *infobar,
                        gpointer    user_data)
 {
     NautilusTrashBar *bar;
-    GtkWidget *window;
+    GtkRoot *window;
 
     bar = NAUTILUS_TRASH_BAR (user_data);
-    window = gtk_widget_get_toplevel (GTK_WIDGET (bar));
+    window = gtk_widget_get_root (GTK_WIDGET (bar));
 
     switch (response_id)
     {
@@ -193,7 +193,7 @@ trash_bar_response_cb (GtkInfoBar *infobar,
 
         case TRASH_BAR_RESPONSE_EMPTY:
         {
-            nautilus_file_operations_empty_trash (window, TRUE, NULL);
+            nautilus_file_operations_empty_trash (GTK_WIDGET (window), TRUE, NULL);
         }
         break;
 
diff --git a/src/nautilus-window-slot-dnd.c b/src/nautilus-window-slot-dnd.c
index 254084cb1..ccec73b60 100644
--- a/src/nautilus-window-slot-dnd.c
+++ b/src/nautilus-window-slot-dnd.c
@@ -83,14 +83,14 @@ static void
 switch_location (NautilusDragSlotProxyInfo *drag_info)
 {
     GFile *location;
-    GtkWidget *window;
+    GtkRoot *window;
 
     if (drag_info->target_file == NULL)
     {
         return;
     }
 
-    window = gtk_widget_get_toplevel (drag_info->widget);
+    window = gtk_widget_get_root (drag_info->widget);
     g_assert (NAUTILUS_IS_WINDOW (window));
 
     location = nautilus_file_get_location (drag_info->target_file);
@@ -153,7 +153,7 @@ slot_proxy_drag_motion (GtkWidget      *widget,
 {
     NautilusDragSlotProxyInfo *drag_info;
     NautilusWindowSlot *target_slot;
-    GtkWidget *window;
+    GtkRoot *window;
     GdkAtom target;
     int action;
     char *target_uri;
@@ -172,7 +172,7 @@ slot_proxy_drag_motion (GtkWidget      *widget,
         goto out;
     }
 
-    window = gtk_widget_get_toplevel (widget);
+    window = gtk_widget_get_root (widget);
     g_assert (NAUTILUS_IS_WINDOW (window));
 
     if (!drag_info->have_data)
@@ -360,7 +360,7 @@ slot_proxy_handle_drop (GtkWidget                 *widget,
                         unsigned int               time,
                         NautilusDragSlotProxyInfo *drag_info)
 {
-    GtkWidget *window;
+    GtkRoot *window;
     NautilusWindowSlot *target_slot;
     NautilusFilesView *target_view;
     char *target_uri;
@@ -375,7 +375,7 @@ slot_proxy_handle_drop (GtkWidget                 *widget,
         return;
     }
 
-    window = gtk_widget_get_toplevel (widget);
+    window = gtk_widget_get_root (widget);
     g_assert (NAUTILUS_IS_WINDOW (window));
 
     if (drag_info->target_slot != NULL)
diff --git a/src/nautilus-x-content-bar.c b/src/nautilus-x-content-bar.c
index 85dd0d061..837ebe122 100644
--- a/src/nautilus-x-content-bar.c
+++ b/src/nautilus-x-content-bar.c
@@ -78,7 +78,7 @@ content_bar_response_cb (GtkInfoBar *infobar,
     if (default_app != NULL)
     {
         nautilus_launch_application_for_mount (default_app, bar->mount,
-                                               GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (bar))));
+                                               GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (bar))));
         g_object_unref (default_app);
     }
 }


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