[nautilus/wip/antoniof/gnome-42: 46/72] Revert "general: Stop using GtkWindow API which is gone in GTK4"




commit 1621f21a2befe2bcfa25906e3e8a49e44ee49b51
Author: António Fernandes <antoniof gnome org>
Date:   Fri Feb 11 19:01:55 2022 +0000

    Revert "general: Stop using GtkWindow API which is gone in GTK4"
    
    This reverts commit 996ca51a4b18067e6185aad7080d9e0606868db8.

 src/nautilus-autorun-software.c | 9 +++++++++
 src/nautilus-file-operations.c  | 7 +++++++
 src/nautilus-window.c           | 2 ++
 3 files changed, 18 insertions(+)
---
diff --git a/src/nautilus-autorun-software.c b/src/nautilus-autorun-software.c
index 0496be5b5..edf0a35fb 100644
--- a/src/nautilus-autorun-software.c
+++ b/src/nautilus-autorun-software.c
@@ -156,6 +156,10 @@ out:
                                                      GTK_BUTTONS_OK,
                                                      _("Oops! There was a problem running this software."));
         gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", error_string);
+        /* This is required because we don't show dialogs in the
+         *  window picker and if the window pops under another window
+         *  there is no way to get it back. */
+        gtk_window_set_keep_above (GTK_WINDOW (dialog), TRUE);
 
         g_signal_connect (dialog,
                           "response",
@@ -199,6 +203,11 @@ present_autorun_for_software_dialog (GMount *mount)
                                               "%s",
                                               _("If you don’t trust this location or aren’t sure, press 
Cancel."));
 
+    /* This is required because we don't show dialogs in the
+     *  window picker and if the window pops under another window
+     *  there is no way to get it back. */
+    gtk_window_set_keep_above (GTK_WINDOW (dialog), TRUE);
+
     /* TODO: in a star trek future add support for verifying
      * software on media (e.g. if it has a certificate, check it
      * etc.)
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c
index 7af3865aa..746ac2956 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -1418,6 +1418,13 @@ do_run_simple_dialog (gpointer _data)
 
         timestamp = nautilus_file_operations_dbus_data_get_timestamp (data->dbus_data);
 
+        /* Assuming this is used for desktop implementations, we want the
+         * dialog to be centered on the screen rather than the parent window,
+         * which could extend to all monitors. This is the case for
+         * gnome-flashback.
+         */
+        gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
+
         if (nautilus_file_operations_dbus_data_get_parent_handle (data->dbus_data) != NULL)
         {
             g_signal_connect (dialog, "realize", G_CALLBACK (dialog_realize_cb), data->dbus_data);
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 162537dca..014d3a18c 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -2009,6 +2009,8 @@ notebook_create_window_cb (GtkNotebook *notebook,
     g_object_set_data (G_OBJECT (slot), "dnd-window-slot",
                        GINT_TO_POINTER (TRUE));
 
+    gtk_window_set_position (GTK_WINDOW (new_window), GTK_WIN_POS_MOUSE);
+
     return GTK_NOTEBOOK (new_window->notebook);
 }
 


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