Google
  Web www.spinics.net

[PATCH] virt-manager: set proper parents for dialogs

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


Hi,
the attached patch is a first attempt to make virt-manager better usable
under tiling window managers like awesome[1]. The problem is that
virt-manager opens dialogs without a parent set (like passing NULL as
the first argument of gtk_message_dialog_new). This patch is a first
attempt on fixing that for some of them. This way dialogs like the about
dialog get displayed in the middle of the main window instead of
floating. Does this look like the right thing to do? 
Cheers,
 -- Guido

[1] http://awesome.naquadah.org/
# HG changeset patch
# User Guido Günther <agx@xxxxxxxxxxx>
# Date 1241793452 -7200
# Node ID 357e834adb137baf32276d013188230eb14c73de
# Parent  5b61bd10a66b91d40ad5652a8f39b14273175292
Add a proper parent to dialogs.

diff -r 5b61bd10a66b -r 357e834adb13 src/virtManager/about.py
--- a/src/virtManager/about.py	Thu May 07 19:22:33 2009 +0100
+++ b/src/virtManager/about.py	Fri May 08 16:37:32 2009 +0200
@@ -43,9 +43,10 @@
             "on_vmm_about_response": self.close,
             })
 
-    def show(self):
+    def show(self, parent):
         dialog = self.window.get_widget("vmm-about")
         dialog.set_version(self.config.get_appversion())
+        dialog.set_transient_for(parent)
         dialog.show_all()
         dialog.present()
 
diff -r 5b61bd10a66b -r 357e834adb13 src/virtManager/connect.py
--- a/src/virtManager/connect.py	Thu May 07 19:22:33 2009 +0100
+++ b/src/virtManager/connect.py	Fri May 08 16:37:32 2009 +0200
@@ -102,8 +102,9 @@
         self.window.get_widget("vmm-open-connection").hide()
         self.stop_browse()
 
-    def show(self):
+    def show(self, parent):
         win = self.window.get_widget("vmm-open-connection")
+        win.set_transient_for(parent)
         win.show_all()
         win.present()
         self.reset_state()
diff -r 5b61bd10a66b -r 357e834adb13 src/virtManager/engine.py
--- a/src/virtManager/engine.py	Thu May 07 19:22:33 2009 +0100
+++ b/src/virtManager/engine.py	Fri May 08 16:37:32 2009 +0200
@@ -210,7 +210,7 @@
     def show_about(self):
         if self.windowAbout == None:
             self.windowAbout = vmmAbout(self.get_config())
-        self.windowAbout.show()
+        self.windowAbout.show(self.windowManager.win)
 
     def show_help(self, index):
         try:
@@ -221,7 +221,8 @@
 
     def show_preferences(self):
         if self.windowPreferences == None:
-            self.windowPreferences = vmmPreferences(self.get_config())
+            self.windowPreferences = vmmPreferences(self.get_config(),
+                                                    self.windowManager.win)
             self.windowPreferences.connect("action-show-help", self._do_show_help)
         self.windowPreferences.show()
 
@@ -239,7 +240,7 @@
             self.windowConnect = vmmConnect(self.get_config(), self)
             self.windowConnect.connect("completed", self._connect_to_uri)
             self.windowConnect.connect("cancelled", self._connect_cancelled)
-        self.windowConnect.show()
+        self.windowConnect.show(self.windowManager.win)
 
     def show_console(self, uri, uuid):
         win = self.show_details(uri, uuid)
diff -r 5b61bd10a66b -r 357e834adb13 src/virtManager/manager.py
--- a/src/virtManager/manager.py	Thu May 07 19:22:33 2009 +0100
+++ b/src/virtManager/manager.py	Fri May 08 16:37:32 2009 +0200
@@ -119,6 +119,7 @@
                                   _("An unexpected error occurred"))
         self.config = config
         self.engine = engine
+        self.win = self.window.get_widget("vmm-manager")
 
         self.delete_dialog = None
         self.startup_error = None
@@ -343,11 +344,10 @@
             vmlist.get_selection().select_iter(vmlist.get_model().get_iter_first())
 
     def show(self):
-        win = self.window.get_widget("vmm-manager")
         if self.is_visible():
-            win.present()
+            self.win.present()
             return
-        win.show_all()
+        self.win.show_all()
         self.engine.increment_window_counter()
 
         if self.startup_error:
diff -r 5b61bd10a66b -r 357e834adb13 src/virtManager/preferences.py
--- a/src/virtManager/preferences.py	Thu May 07 19:22:33 2009 +0100
+++ b/src/virtManager/preferences.py	Fri May 08 16:37:32 2009 +0200
@@ -29,12 +29,13 @@
         "action-show-help": (gobject.SIGNAL_RUN_FIRST,
                              gobject.TYPE_NONE, [str]),
         }
-    def __init__(self, config):
+    def __init__(self, config, parent):
         self.__gobject_init__()
         self.window = gtk.glade.XML(config.get_glade_dir() + "/vmm-preferences.glade", "vmm-preferences", domain="virt-manager")
         self.config = config
 
         self.topwin = self.window.get_widget("vmm-preferences")
+        self.topwin.set_transient_for(parent)
         self.topwin.hide()
 
         self.config.on_console_popup_changed(self.refresh_console_popup)
_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Home]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Red Hat 9 Bible]     [Fedora Bible]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

Powered by Linux

Google
  Web www.spinics.net