Index: virt-manager-0.9.5/src/vmm-manager.ui =================================================================== --- virt-manager-0.9.5.orig/src/vmm-manager.ui +++ virt-manager-0.9.5/src/vmm-manager.ui @@ -293,7 +293,7 @@ False False - + True False True @@ -306,7 +306,6 @@ False - True Index: virt-manager-0.9.5/src/virtManager/manager.py =================================================================== --- virt-manager-0.9.5.orig/src/virtManager/manager.py +++ virt-manager-0.9.5/src/virtManager/manager.py @@ -260,7 +260,8 @@ class vmmManager(vmmGObjectUI): self.config.is_vmlist_network_traffic_visible()) def init_toolbar(self): - self.widget("vm-new").set_icon_name("vm_new") + uihelpers.build_new_button_menu(self.widget("vm-new"), + self.vminstall_new_vm) self.widget("vm-open").set_icon_name("icon_console") uihelpers.build_shutdown_button_menu(self.widget("vm-shutdown"), self.poweroff_vm, @@ -510,6 +511,9 @@ class vmmManager(vmmGObjectUI): def new_vm(self, src_ignore=None): self.emit("action-show-create", self.current_conn_uri()) + def vminstall_new_vm(self, src_ignore=None): + self.emit("action-show-create-vminstall", self.current_conn_uri()) + def show_about(self, src_ignore): self.emit("action-show-about") @@ -1238,6 +1242,7 @@ vmmManager.signal_new(vmmManager, "actio vmmManager.signal_new(vmmManager, "action-show-host", [str]) vmmManager.signal_new(vmmManager, "action-show-preferences", []) vmmManager.signal_new(vmmManager, "action-show-create", [str]) +vmmManager.signal_new(vmmManager, "action-show-create-vminstall", [str]) vmmManager.signal_new(vmmManager, "action-suspend-domain", [str, str]) vmmManager.signal_new(vmmManager, "action-resume-domain", [str, str]) vmmManager.signal_new(vmmManager, "action-run-domain", [str, str]) Index: virt-manager-0.9.5/src/virtManager/uihelpers.py =================================================================== --- virt-manager-0.9.5.orig/src/virtManager/uihelpers.py +++ virt-manager-0.9.5/src/virtManager/uihelpers.py @@ -837,6 +837,24 @@ def mediadev_set_default_selection(widge #################################################################### +# Build toolbar new button menu (manager and details toolbar) # +#################################################################### + +def build_new_button_menu(widget, vminstall_cb): + icon_name = util.running_config.get_new_icon_name() + widget.set_icon_name(icon_name) + menu = gtk.Menu() + widget.set_menu(menu) + + vminstallimg = gtk.image_new_from_icon_name(icon_name, gtk.ICON_SIZE_MENU) + + vminstall = gtk.ImageMenuItem(_("_Vm-install")) + vminstall.set_image(vminstallimg) + vminstall.show() + vminstall.connect("activate", vminstall_cb) + menu.add(vminstall) + +#################################################################### # Build toolbar shutdown button menu (manager and details toolbar) # #################################################################### Index: virt-manager-0.9.5/src/virtManager/config.py =================================================================== --- virt-manager-0.9.5.orig/src/virtManager/config.py +++ virt-manager-0.9.5/src/virtManager/config.py @@ -150,6 +150,13 @@ class vmmConfig(object): # General app wide helpers (gconf agnostic) + def get_new_icon_name(self): + theme = gtk.icon_theme_get_default() + iconname = "vm_new" + if theme.has_icon(iconname): + return iconname + return "media-record" + def get_shutdown_icon_name(self): theme = gtk.icon_theme_get_default() iconname = "system-shutdown" Index: virt-manager-0.9.5/src/virtManager/engine.py =================================================================== --- virt-manager-0.9.5.orig/src/virtManager/engine.py +++ virt-manager-0.9.5/src/virtManager/engine.py @@ -24,6 +24,7 @@ import gtk import logging import threading import os +import traceback import libvirt import virtinst @@ -42,7 +43,6 @@ from virtManager.manager import vmmManag from virtManager.migrate import vmmMigrateDialog from virtManager.details import vmmDetails from virtManager.asyncjob import vmmAsyncJob -from virtManager.create import vmmCreate from virtManager.host import vmmHost from virtManager.error import vmmErrorDialog from virtManager.systray import vmmSystray @@ -634,6 +634,7 @@ class vmmEngine(vmmGObject): obj.connect("action-show-vm", self._do_show_vm) obj.connect("action-show-preferences", self._do_show_preferences) obj.connect("action-show-create", self._do_show_create) + obj.connect("action-show-create-vminstall", self._do_show_create_vminstall) obj.connect("action-show-help", self._do_show_help) obj.connect("action-show-about", self._do_show_about) obj.connect("action-show-host", self._do_show_host) @@ -677,11 +678,50 @@ class vmmEngine(vmmGObject): self.windowCreate = obj return self.windowCreate - def _do_show_create(self, src, uri): - try: - self._get_create_dialog().show(src.topwin, uri) - except Exception, e: - src.err.show_err(_("Error launching manager: %s") % str(e)) + def _vmmcreate_closing(self,signal,key): + self.windowCreate = None + + def _do_show_create_vminstall(self, src, uri): + self._do_show_create(src, uri, True) + + def _do_show_create(self, src, uri, use_vminstall=False): + if uri is None: + uri = default_uri() + conn = self._lookup_conn(uri) + do_remote = conn.is_remote() + if self.windowCreate == None or do_remote != self.remote_install: + try: + if do_remote or not use_vminstall: + from virtManager.create import vmmCreate + create = vmmCreate(self) + create.connect("action-show-vm", self._do_show_vm) + create.connect("action-show-help", self._do_show_help) + create.connect("vmmcreate-closing", self._vmmcreate_closing) + self.remote_install = True + self.windowCreate = create + self.windowCreate.show(src.topwin, uri) + else: + from vminstall.gtk.interface import VMCreate as vmmCreate + create = vmmCreate(virtman=True,key=0) + create.connect("action-show-vm", self._do_show_vm) + create.connect("vmmcreate-closing", self._vmmcreate_closing) + self.remote_install = False + self.windowCreate = create + self.windowCreate.show(src.topwin) + except Exception, e: + src.err.show_err(_("Error launching manager: %s") % str(e), + "".join(traceback.format_exc())) + else: + if do_remote: + self.windowCreate.show(src.topwin, uri) + else: + message_box = gtk.MessageDialog(None, + gtk.DIALOG_MODAL, + gtk.MESSAGE_WARNING, + gtk.BUTTONS_OK, + _("A new installation is already in progress.\n\nUse the YaST \"Create Virtual Machines\" utility for concurrent installations.")) + message_box.run() + message_box.destroy() def _do_show_migrate(self, src, uri, uuid): try: Index: virt-manager-0.9.5/src/virtManager/create.py =================================================================== --- virt-manager-0.9.5.orig/src/virtManager/create.py +++ virt-manager-0.9.5/src/virtManager/create.py @@ -176,6 +176,7 @@ class vmmCreate(vmmGObjectUI): def close(self, ignore1=None, ignore2=None): logging.debug("Closing new vm wizard") + self.emit('vmmcreate-closing', 0) self.topwin.hide() self.remove_timers() @@ -2158,3 +2159,4 @@ class vmmCreate(vmmGObjectUI): vmmGObjectUI.type_register(vmmCreate) vmmCreate.signal_new(vmmCreate, "action-show-vm", [str, str]) vmmCreate.signal_new(vmmCreate, "action-show-help", [str]) +vmmCreate.signal_new(vmmCreate, "vmmcreate-closing", [str])