[d-feet] ExecuteMethodDialog: set_transient_for()



commit 1754912def0edbcff90dad3bcd340032c68ab5ee
Author: Will Thompson <wjt endlessm com>
Date:   Fri Nov 24 15:40:43 2017 +0000

    ExecuteMethodDialog: set_transient_for()
    
    Without this, we see:
    
        Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
    
    You currently cannot actually interact with the toplevel application
    window while an ExecuteMethodDialog is visible; this change also makes
    this fact visible to the user.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=734514

 src/dfeet/executemethoddialog.py |    3 ++-
 src/dfeet/introspection.py       |    4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/dfeet/executemethoddialog.py b/src/dfeet/executemethoddialog.py
index 92dc94d..aa80da8 100644
--- a/src/dfeet/executemethoddialog.py
+++ b/src/dfeet/executemethoddialog.py
@@ -7,7 +7,7 @@ from dfeet.uiloader import UILoader
 
 
 class ExecuteMethodDialog:
-    def __init__(self, data_dir, connection, connection_is_bus, bus_name, method_obj):
+    def __init__(self, data_dir, connection, connection_is_bus, bus_name, method_obj, parent_window):
         signal_dict = {
             'execute_dbus_method_cb': self.execute_cb,
             'execute_dialog_close_cb': self.close_cb
@@ -20,6 +20,7 @@ class ExecuteMethodDialog:
 
         ui = UILoader(data_dir, UILoader.UI_EXECUTEDIALOG)
         self.dialog = ui.get_root_widget()
+        self.dialog.set_transient_for(parent_window)
         self.label_method_name = ui.get_widget('label_method_name')
         self.label_object_path = ui.get_widget('label_object_path')
         self.label_interface = ui.get_widget('label_interface')
diff --git a/src/dfeet/introspection.py b/src/dfeet/introspection.py
index c6c9144..a0bb75c 100644
--- a/src/dfeet/introspection.py
+++ b/src/dfeet/introspection.py
@@ -97,8 +97,10 @@ class AddressInfo():
 
         if isinstance(obj, DBusMethod):
             # execute the selected method
+            parent_window = self.introspect_box.get_toplevel()
             dialog = ExecuteMethodDialog(
-                self.data_dir, self.connection, self.connection_is_bus, self.name, obj)
+                self.data_dir, self.connection, self.connection_is_bus, self.name, obj,
+                parent_window)
             dialog.run()
         elif isinstance(obj, DBusProperty):
             # update the selected property (TODO: do this async)


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