[nautilus] Make file properties dialog transient for its parent window



commit 22ced2ec1729dbbaa74ca4a831badcfd5cd30ded
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Aug 23 12:42:19 2015 -0500

    Make file properties dialog transient for its parent window
    
    So they don't appear as separate application windows in the GNOME Shell
    overview, and to avoid warnings from GTK+.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=753996

 src/nautilus-properties-window.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index dea8b0f..5ebf43d 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -155,6 +155,7 @@ typedef struct {
        GList *original_files;
        GList *target_files;
        GtkWidget *parent_widget;
+       GtkWindow *parent_window;
        char *startup_id;
        char *pending_key;
        GHashTable *pending_files;
@@ -4424,6 +4425,7 @@ startup_data_new (GList *original_files,
                  GList *target_files,
                  const char *pending_key,
                  GtkWidget *parent_widget,
+                 GtkWindow *parent_window,
                  const char *startup_id)
 {
        StartupData *data;
@@ -4433,6 +4435,7 @@ startup_data_new (GList *original_files,
        data->original_files = nautilus_file_list_copy (original_files);
        data->target_files = nautilus_file_list_copy (target_files);
        data->parent_widget = parent_widget;
+       data->parent_window = parent_window;
        data->startup_id = g_strdup (startup_id);
        data->pending_key = g_strdup (pending_key);
        data->pending_files = g_hash_table_new (g_direct_hash,
@@ -4588,6 +4591,10 @@ create_properties_window (StartupData *startup_data)
                                       gtk_widget_get_screen (startup_data->parent_widget));
        }
 
+       if (startup_data->parent_window) {
+               gtk_window_set_transient_for (GTK_WINDOW (window), startup_data->parent_window);
+       }
+
        if (startup_data->startup_id) {
                gtk_window_set_startup_id (GTK_WINDOW (window), startup_data->startup_id);
        }
@@ -4855,10 +4862,17 @@ nautilus_properties_window_present (GList       *original_files,
 
        target_files = get_target_file_list (original_files);
 
+       if (parent_widget) {
+               parent_window = gtk_widget_get_ancestor (parent_widget, GTK_TYPE_WINDOW);
+       } else {
+               parent_window = NULL;
+       }
+
        startup_data = startup_data_new (original_files, 
                                         target_files,
                                         pending_key,
                                         parent_widget,
+                                        GTK_WINDOW (parent_window),
                                         startup_id);
 
        nautilus_file_list_free (target_files);
@@ -4872,10 +4886,7 @@ nautilus_properties_window_present (GList       *original_files,
        if (parent_widget) {
                g_signal_connect (parent_widget, "destroy",
                                  G_CALLBACK (parent_widget_destroyed_callback), startup_data);
-
-               parent_window = gtk_widget_get_ancestor (parent_widget, GTK_TYPE_WINDOW);
-       } else
-               parent_window = NULL;
+       }
 
        eel_timed_wait_start
                (cancel_create_properties_window_callback,


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