virt-manager

changeset 1352:8ee1f2a28dd9

Make the host details window a first class citizen.

This means the host window can be the only window visible and the app
will still be running.
author Cole Robinson <crobinso@redhat.com>
date Tue Nov 17 15:18:38 2009 -0500 (2009-11-17)
parents 72b610046c3f
children 3b2926cac21f
files src/virtManager/engine.py src/virtManager/host.py src/vmm-host.glade
line diff
     1.1 --- a/src/virtManager/engine.py	Tue Nov 17 15:06:15 2009 -0500
     1.2 +++ b/src/virtManager/engine.py	Tue Nov 17 15:18:38 2009 -0500
     1.3 @@ -298,8 +298,10 @@
     1.4          con = self._lookup_connection(uri)
     1.5  
     1.6          if self.connections[uri]["windowHost"] == None:
     1.7 -            manager = vmmHost(self.get_config(), con)
     1.8 +            manager = vmmHost(self.get_config(), con, self)
     1.9              manager.connect("action-show-help", self._do_show_help)
    1.10 +            manager.connect("action-exit-app", self._do_exit_app)
    1.11 +            manager.connect("action-view-manager", self._do_show_manager)
    1.12              self.connections[uri]["windowHost"] = manager
    1.13          self.connections[uri]["windowHost"].show()
    1.14  
     2.1 --- a/src/virtManager/host.py	Tue Nov 17 15:06:15 2009 -0500
     2.2 +++ b/src/virtManager/host.py	Tue Nov 17 15:18:38 2009 -0500
     2.3 @@ -36,12 +36,17 @@
     2.4      __gsignals__ = {
     2.5          "action-show-help": (gobject.SIGNAL_RUN_FIRST,
     2.6                                 gobject.TYPE_NONE, [str]),
     2.7 +        "action-exit-app": (gobject.SIGNAL_RUN_FIRST,
     2.8 +                            gobject.TYPE_NONE, []),
     2.9 +        "action-view-manager": (gobject.SIGNAL_RUN_FIRST,
    2.10 +                                gobject.TYPE_NONE, []),
    2.11          }
    2.12 -    def __init__(self, config, conn):
    2.13 +    def __init__(self, config, conn, engine):
    2.14          self.__gobject_init__()
    2.15          self.window = gtk.glade.XML(config.get_glade_dir() + "/vmm-host.glade", "vmm-host", domain="virt-manager")
    2.16          self.config = config
    2.17          self.conn = conn
    2.18 +        self.engine = engine
    2.19  
    2.20          self.PIXBUF_STATE_RUNNING = gtk.gdk.pixbuf_new_from_file_at_size(self.config.get_icon_dir() + "/state_running.png", 18, 18)
    2.21          self.PIXBUF_STATE_SHUTOFF = gtk.gdk.pixbuf_new_from_file_at_size(self.config.get_icon_dir() + "/state_shutoff.png", 18, 18)
    2.22 @@ -151,8 +156,11 @@
    2.23          self.conn.connect("state-changed", self.conn_state_changed)
    2.24  
    2.25          self.window.signal_autoconnect({
    2.26 +            "on_menu_file_view_manager_activate" : self.view_manager,
    2.27 +            "on_menu_file_quit_activate" : self.exit_app,
    2.28              "on_menu_file_close_activate": self.close,
    2.29              "on_vmm_host_delete_event": self.close,
    2.30 +
    2.31              "on_menu_help_contents_activate": self.show_help,
    2.32              "on_net_add_clicked": self.add_network,
    2.33              "on_net_delete_clicked": self.delete_network,
    2.34 @@ -191,6 +199,8 @@
    2.35          dialog = self.window.get_widget("vmm-host")
    2.36          dialog.present()
    2.37  
    2.38 +        self.engine.increment_window_counter()
    2.39 +
    2.40      def is_visible(self):
    2.41          if self.window.get_widget("vmm-host").flags() & gtk.VISIBLE:
    2.42              return 1
    2.43 @@ -198,11 +208,18 @@
    2.44  
    2.45      def close(self,ignore1=None,ignore2=None):
    2.46          self.window.get_widget("vmm-host").hide()
    2.47 +        self.engine.decrement_window_counter()
    2.48          return 1
    2.49  
    2.50      def show_help(self, src):
    2.51          self.emit("action-show-help", "virt-manager-host-window")
    2.52  
    2.53 +    def view_manager(self, src):
    2.54 +        self.emit("action-view-manager")
    2.55 +
    2.56 +    def exit_app(self, src):
    2.57 +        self.emit("action-exit-app")
    2.58 +
    2.59      def toggle_autoconnect(self, ignore=None):
    2.60          if self.conn.get_autoconnect() != \
    2.61             self.window.get_widget("config-autoconnect").get_active():
     3.1 --- a/src/vmm-host.glade	Tue Nov 17 15:06:15 2009 -0500
     3.2 +++ b/src/vmm-host.glade	Tue Nov 17 15:18:38 2009 -0500
     3.3 @@ -23,6 +23,19 @@
     3.4                  <child>
     3.5                    <widget class="GtkMenu" id="menuitem4_menu">
     3.6                      <child>
     3.7 +                      <widget class="GtkMenuItem" id="menu-file-view-manager">
     3.8 +                        <property name="visible">True</property>
     3.9 +                        <property name="label" translatable="yes">_View Manager</property>
    3.10 +                        <property name="use_underline">True</property>
    3.11 +                        <signal name="activate" handler="on_menu_file_view_manager_activate"/>
    3.12 +                      </widget>
    3.13 +                    </child>
    3.14 +                    <child>
    3.15 +                      <widget class="GtkSeparatorMenuItem" id="menuitem1">
    3.16 +                        <property name="visible">True</property>
    3.17 +                      </widget>
    3.18 +                    </child>
    3.19 +                    <child>
    3.20                        <widget class="GtkImageMenuItem" id="menu-file-close">
    3.21                          <property name="label">gtk-close</property>
    3.22                          <property name="visible">True</property>
    3.23 @@ -31,6 +44,15 @@
    3.24                          <signal name="activate" handler="on_menu_file_close_activate"/>
    3.25                        </widget>
    3.26                      </child>
    3.27 +                    <child>
    3.28 +                      <widget class="GtkImageMenuItem" id="menu-file-quit">
    3.29 +                        <property name="label">gtk-quit</property>
    3.30 +                        <property name="visible">True</property>
    3.31 +                        <property name="use_underline">True</property>
    3.32 +                        <property name="use_stock">True</property>
    3.33 +                        <signal name="activate" handler="on_menu_file_quit_activate"/>
    3.34 +                      </widget>
    3.35 +                    </child>
    3.36                    </widget>
    3.37                  </child>
    3.38                </widget>