- Allow virt-install to be used for local installs via a pop-down

menu.
  virtman-virtinstall.diff

OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=103
This commit is contained in:
Charles Arnold 2012-08-09 21:26:39 +00:00 committed by Git OBS Bridge
parent 0441608989
commit 9cc15a27c5
3 changed files with 141 additions and 1 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Aug 9 15:19:27 MDT 2012 - carnold@novell.com
- Allow virt-install to be used for local installs via a pop-down
menu.
virtman-virtinstall.diff
-------------------------------------------------------------------
Tue Aug 7 09:21:50 MDT 2012 - carnold@novell.com

View File

@ -15,7 +15,6 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define gsysconfdir /etc
%define gconftool /usr/bin/gconftool-2
%define virtinst_maj 0
@ -46,6 +45,7 @@ Patch63: virtman-eepro100.diff
Patch64: virtman-qed.diff
Patch65: virtman-update-backend.diff
Patch66: virtman-slow-mouse.diff
Patch67: virtman-virtinstall.diff
ExclusiveArch: %{ix86} x86_64
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%gconf_schemas_prereq
@ -110,6 +110,7 @@ Authors:
%patch64 -p1
%patch65 -p1
%patch66 -p1
%patch67 -p1
%build
# autoreconf -i

132
virtman-virtinstall.diff Normal file
View File

@ -0,0 +1,132 @@
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)