virt-manager/virtman-virtinstall.diff

133 lines
6.0 KiB
Diff

Index: virt-manager-0.9.4/src/vmm-manager.ui
===================================================================
--- virt-manager-0.9.4.orig/src/vmm-manager.ui
+++ virt-manager-0.9.4/src/vmm-manager.ui
@@ -293,7 +293,7 @@
<property name="can_focus">False</property>
<property name="show_arrow">False</property>
<child>
- <object class="GtkToolButton" id="vm-new">
+ <object class="GtkMenuToolButton" id="vm-new">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
@@ -306,7 +306,6 @@
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
</packing>
</child>
<child>
Index: virt-manager-0.9.4/src/virtManager/manager.py
===================================================================
--- virt-manager-0.9.4.orig/src/virtManager/manager.py
+++ virt-manager-0.9.4/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.virtinstall_new_vm)
self.widget("vm-open").set_icon_name("icon_console")
uihelpers.build_shutdown_button_menu(self.widget("vm-shutdown"),
self.poweroff_vm,
@@ -506,6 +507,9 @@ class vmmManager(vmmGObjectUI):
def new_vm(self, src_ignore=None):
self.emit("action-show-create", self.current_conn_uri())
+ def virtinstall_new_vm(self, src_ignore=None):
+ self.emit("action-show-create-virtinstall", self.current_conn_uri())
+
def show_about(self, src_ignore):
self.emit("action-show-about")
@@ -1228,6 +1232,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-virtinstall", [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.4/src/virtManager/uihelpers.py
===================================================================
--- virt-manager-0.9.4.orig/src/virtManager/uihelpers.py
+++ virt-manager-0.9.4/src/virtManager/uihelpers.py
@@ -835,6 +835,24 @@ def mediadev_set_default_selection(widge
####################################################################
+# Build toolbar new button menu (manager and details toolbar) #
+####################################################################
+
+def build_new_button_menu(widget, virtinstall_cb):
+ icon_name = util.running_config.get_new_icon_name()
+ widget.set_icon_name(icon_name)
+ menu = gtk.Menu()
+ widget.set_menu(menu)
+
+ virtinstallimg = gtk.image_new_from_icon_name(icon_name, gtk.ICON_SIZE_MENU)
+
+ virtinstall = gtk.ImageMenuItem(_("_Virt-install"))
+ virtinstall.set_image(virtinstallimg)
+ virtinstall.show()
+ virtinstall.connect("activate", virtinstall_cb)
+ menu.add(virtinstall)
+
+####################################################################
# Build toolbar shutdown button menu (manager and details toolbar) #
####################################################################
Index: virt-manager-0.9.4/src/virtManager/config.py
===================================================================
--- virt-manager-0.9.4.orig/src/virtManager/config.py
+++ virt-manager-0.9.4/src/virtManager/config.py
@@ -149,6 +149,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.4/src/virtManager/engine.py
===================================================================
--- virt-manager-0.9.4.orig/src/virtManager/engine.py
+++ virt-manager-0.9.4/src/virtManager/engine.py
@@ -628,6 +628,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-virtinstall", self._do_show_create_virtinstall)
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)
@@ -674,14 +675,17 @@ class vmmEngine(vmmGObject):
def _vmmcreate_closing(self,signal,key):
self.windowCreate = None
- def _do_show_create(self, src, uri):
+ def _do_show_create_virtinstall(self, src, uri):
+ self._do_show_create(src, uri, True)
+
+ def _do_show_create(self, src, uri, use_virtinstall=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:
+ if do_remote or use_virtinstall:
from virtManager.create import vmmCreate
create = vmmCreate(self)
create.connect("action-show-vm", self._do_show_vm)