[nautilus/dbus-trash] properties-window: Keep alive properties window if called through DBus



commit f52ad0072166dd15835bffcc23015be341ab86e6
Author: Carlos Soriano <csoriano redhat com>
Date:   Tue Aug 7 12:40:42 2018 +0200

    properties-window: Keep alive properties window if called through DBus
    
    The properties window can be used from within Nautilus, and therefore a
    dialog window makes sense, or from outside Nautilus, such as the
    FileManager dbus free desktop standard.
    
    In the later, used for integration with things like desktop icons
    extensions, we need to keep the application alive since GApplication
    would close the application if no application window is alive after a
    timeout.
    
    To fix this, this work makes the window hint a regular window if used
    from those cases.

 src/nautilus-properties-window.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 9543d4105..942b194d7 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -5032,10 +5032,25 @@ create_properties_window (StartupData *startup_data)
 {
     NautilusPropertiesWindow *window;
     GList *l;
+    gint hint;
+
+    /* If activated through DBus there could be no other Nautilus window open,
+     * making it just a dialog would fire the timeout of GApplication and close
+     * the window after a few seconds
+     */
+    if (startup_data->parent_window)
+    {
+       hint = GDK_WINDOW_TYPE_HINT_DIALOG;
+    }
+    else
+    {
+        g_print ("SETTING TYPE HINT\n");
+       hint = GDK_WINDOW_TYPE_HINT_NORMAL;
+    }
 
     window = NAUTILUS_PROPERTIES_WINDOW (gtk_widget_new (NAUTILUS_TYPE_PROPERTIES_WINDOW,
                                                          "use-header-bar", TRUE,
-                                                         "type-hint", GDK_WINDOW_TYPE_HINT_DIALOG,
+                                                         "type-hint", hint,
                                                          "modal", TRUE,
                                                          NULL));
 


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