diff --git a/data/org.virt-manager.virt-manager.gschema.xml b/data/org.virt-manager.virt-manager.gschema.xml index f6db721b6..240a9507a 100644 --- a/data/org.virt-manager.virt-manager.gschema.xml +++ b/data/org.virt-manager.virt-manager.gschema.xml @@ -35,6 +35,12 @@ Custom connection description Custom connection description, used in the manager window. If empty, the app generates a default on demand. + + + (-1, -1) + Conn details window dimensions + Connection details window dimensions + diff --git a/ui/host.ui b/ui/host.ui index 83de7979f..dd2af0949 100644 --- a/ui/host.ui +++ b/ui/host.ui @@ -11,6 +11,7 @@ + diff --git a/virtManager/connection.py b/virtManager/connection.py index 1d8ef292f..cefed0312 100644 --- a/virtManager/connection.py +++ b/virtManager/connection.py @@ -1523,3 +1523,9 @@ class vmmConnection(vmmGObject): *args, **kwargs) def _config_pretty_name_changed_cb(self): self.emit("state-changed") + + def set_details_window_size(self, w, h): + self.config.set_perconn(self.get_uri(), "/window-size", (w, h)) + def get_details_window_size(self): + ret = self.config.get_perconn(self.get_uri(), "/window-size") + return ret diff --git a/virtManager/host.py b/virtManager/host.py index 4279f2095..b2ffca87e 100644 --- a/virtManager/host.py +++ b/virtManager/host.py @@ -51,6 +51,15 @@ class vmmHost(vmmGObjectUI): self.ICON_RUNNING = "state_running" self.ICON_SHUTOFF = "state_shutoff" + # Set default window size + w, h = self.conn.get_details_window_size() + if w <= 0: + w = 800 + if h <= 0: + h = 600 + self.topwin.set_default_size(w, h) + self._window_size = None + self.addnet = None self.active_edits = [] @@ -68,6 +77,7 @@ class vmmHost(vmmGObjectUI): "on_menu_file_quit_activate": self.exit_app, "on_menu_file_close_activate": self.close, "on_vmm_host_delete_event": self.close, + "on_vmm_host_configure_event": self._window_resized_cb, "on_host_page_switch": self.page_changed, "on_net_add_clicked": self.add_network, @@ -195,6 +205,9 @@ class vmmHost(vmmGObjectUI): return 1 def _cleanup(self): + if self._window_size: + self.conn.set_details_window_size(*self._window_size) + self.conn = None self.storagelist.cleanup() @@ -217,6 +230,11 @@ class vmmHost(vmmGObjectUI): def exit_app(self, _src): vmmEngine.get_instance().exit_app() + def _window_resized_cb(self, ignore, ignore2): + if not self.is_visible(): + return + self._window_size = self.topwin.get_size() + def page_changed(self, src, child, pagenum): ignore = src