manager: Remember previous window dimensions
This commit is contained in:
parent
71f54c0112
commit
26f6ee3e18
|
@ -324,5 +324,32 @@
|
|||
<long>Whether we require confirmation to remove a virtual device</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/::PACKAGE::/manager_window_height</key>
|
||||
<applyto>/apps/::PACKAGE::/manager_window_height</applyto>
|
||||
<owner>::PACKAGE::</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Default manager window height</short>
|
||||
<long>Default manager window height</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/::PACKAGE::/manager_window_width</key>
|
||||
<applyto>/apps/::PACKAGE::/manager_window_width</applyto>
|
||||
<owner>::PACKAGE::</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Default manager window width</short>
|
||||
<long>Default manager window width</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
</schemalist>
|
||||
</gconfschemafile>
|
||||
|
|
|
@ -515,6 +515,14 @@ class vmmConfig:
|
|||
return self.conf.get_list(self.conf_dir + "/connections/uris",
|
||||
gconf.VALUE_STRING)
|
||||
|
||||
# Manager default window size
|
||||
def get_manager_window_size(self):
|
||||
w = self.conf.get_int(self.conf_dir + "/manager_window_width")
|
||||
h = self.conf.get_int(self.conf_dir + "/manager_window_height")
|
||||
return (w, h)
|
||||
def set_manager_window_size(self, w, h):
|
||||
self.conf.set_int(self.conf_dir + "/manager_window_width", w)
|
||||
self.conf.set_int(self.conf_dir + "/manager_window_height", h)
|
||||
|
||||
# URI autoconnect
|
||||
def get_conn_autoconnect(self, uri):
|
||||
|
|
|
@ -117,7 +117,9 @@ class vmmManager(gobject.GObject):
|
|||
|
||||
def __init__(self, config, engine):
|
||||
self.__gobject_init__()
|
||||
self.window = gtk.glade.XML(config.get_glade_dir() + "/vmm-manager.glade", "vmm-manager", domain="virt-manager")
|
||||
self.window = gtk.glade.XML((config.get_glade_dir() +
|
||||
"/vmm-manager.glade"),
|
||||
"vmm-manager", domain="virt-manager")
|
||||
self.err = vmmErrorDialog(self.window.get_widget("vmm-manager"),
|
||||
0, gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE,
|
||||
_("Unexpected Error"),
|
||||
|
@ -133,6 +135,10 @@ class vmmManager(gobject.GObject):
|
|||
# allow O(1) access instead of O(n)
|
||||
self.rows = {}
|
||||
|
||||
w, h = self.config.get_manager_window_size()
|
||||
self.window.get_widget("vmm-manager").set_default_size(w or 550,
|
||||
h or 550)
|
||||
|
||||
self.init_vmlist()
|
||||
self.init_stats()
|
||||
self.init_toolbar()
|
||||
|
@ -154,6 +160,7 @@ class vmmManager(gobject.GObject):
|
|||
cfg.STATS_NETWORK),
|
||||
|
||||
"on_vm_manager_delete_event": self.close,
|
||||
"on_vmm_manager_configure_event": self.window_resized,
|
||||
"on_menu_file_add_connection_activate": self.new_connection,
|
||||
"on_menu_file_quit_activate": self.exit_app,
|
||||
"on_menu_file_close_activate": self.close,
|
||||
|
@ -562,6 +569,13 @@ class vmmManager(gobject.GObject):
|
|||
# Action listeners #
|
||||
####################
|
||||
|
||||
def window_resized(self, ignore, event):
|
||||
# Sometimes dimensions change when window isn't visible
|
||||
if not self.is_visible():
|
||||
return
|
||||
|
||||
self.config.set_manager_window_size(event.width, event.height)
|
||||
|
||||
def exit_app(self, src=None, src2=None):
|
||||
self.emit("action-exit-app")
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<property name="default_width">550</property>
|
||||
<property name="default_height">550</property>
|
||||
<property name="gravity">center</property>
|
||||
<signal name="configure_event" handler="on_vmm_manager_configure_event"/>
|
||||
<signal name="delete_event" handler="on_vm_manager_delete_event"/>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
|
|
Loading…
Reference in New Issue