From 27916ad571592ea1e4d31ac08c89fc3e90ad5209 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mon, 20 Jul 2009 15:09:32 -0400 Subject: [PATCH] Use icon theme icons rather than gtk stock icons. This allows us to get many more relevant icons (mouse, tablet, sound card). Also, reorganize the virtual network and hardware lists to have icons appear first in the row. --- src/virt-manager.py.in | 4 + src/virtManager/addhardware.py | 58 +++++----- src/virtManager/config.py | 6 + src/virtManager/details.py | 201 ++++++++++++++++----------------- src/virtManager/host.py | 11 +- src/virtManager/manager.py | 17 ++- 6 files changed, 156 insertions(+), 141 deletions(-) diff --git a/src/virt-manager.py.in b/src/virt-manager.py.in index d9c02022d..434ac0db0 100755 --- a/src/virt-manager.py.in +++ b/src/virt-manager.py.in @@ -289,6 +289,10 @@ def main(): raise RuntimeError(_("Unable to initialize GTK: %s") % str(e)) warnings.resetwarnings() + # Add our icon dir to icon theme + icon_theme = gtk.icon_theme_get_default() + icon_theme.prepend_search_path(icon_dir) + gtk.gdk.threads_init() setup_glade_i18n() diff --git a/src/virtManager/addhardware.py b/src/virtManager/addhardware.py index 80b094ad0..ee47683dd 100644 --- a/src/virtManager/addhardware.py +++ b/src/virtManager/addhardware.py @@ -155,13 +155,15 @@ class vmmAddHardware(gobject.GObject): # Main HW list hw_list = self.window.get_widget("hardware-type") - # Name, icon name, page number, is sensitive, tooltip + # Name, icon name, page number, is sensitive, tooltip, icon size model = gtk.ListStore(str, str, int, bool, str) hw_list.set_model(model) icon = gtk.CellRendererPixbuf() + icon.set_property("stock-size", gtk.ICON_SIZE_BUTTON) hw_list.pack_start(icon, False) - hw_list.add_attribute(icon, 'stock-id', 1) + hw_list.add_attribute(icon, 'icon-name', 1) text = gtk.CellRendererText() + text.set_property("xpad", 6) hw_list.pack_start(text, True) hw_list.add_attribute(text, 'text', 0) hw_list.add_attribute(text, 'sensitive', 3) @@ -193,12 +195,14 @@ class vmmAddHardware(gobject.GObject): # Disk device type / bus target_list = self.window.get_widget("target-device") - target_model = gtk.ListStore(str, str, str, str) + target_model = gtk.ListStore(str, str, str, str, int) target_list.set_model(target_model) icon = gtk.CellRendererPixbuf() + icon.set_property("stock-size", gtk.ICON_SIZE_BUTTON) target_list.pack_start(icon, False) - target_list.add_attribute(icon, 'stock-id', 2) + target_list.add_attribute(icon, 'icon-name', 2) text = gtk.CellRendererText() + text.set_property("xpad", 6) target_list.pack_start(text, True) target_list.add_attribute(text, 'text', 3) @@ -388,13 +392,13 @@ class vmmAddHardware(gobject.GObject): def add_hw_option(name, icon, page, sensitive, tooltip): model.append([name, icon, page, sensitive, tooltip]) - add_hw_option("Storage", gtk.STOCK_HARDDISK, PAGE_DISK, True, None) - add_hw_option("Network", gtk.STOCK_NETWORK, PAGE_NETWORK, True, None) - add_hw_option("Input", gtk.STOCK_INDEX, PAGE_INPUT, self.vm.is_hvm(), + add_hw_option("Storage", "drive-harddisk", PAGE_DISK, True, None) + add_hw_option("Network", "network-idle", PAGE_NETWORK, True, None) + add_hw_option("Input", "input-mouse", PAGE_INPUT, self.vm.is_hvm(), _("Not supported for this guest type.")) - add_hw_option("Graphics", gtk.STOCK_SELECT_COLOR, PAGE_GRAPHICS, + add_hw_option("Graphics", "video-display", PAGE_GRAPHICS, True, None) - add_hw_option("Sound", gtk.STOCK_MEDIA_PLAY, PAGE_SOUND, + add_hw_option("Sound", "audio-card", PAGE_SOUND, self.vm.is_hvm(), _("Not supported for this guest type.")) add_hw_option("Serial", gtk.STOCK_CONNECT, PAGE_CHAR, @@ -403,11 +407,11 @@ class vmmAddHardware(gobject.GObject): add_hw_option("Parallel", gtk.STOCK_CONNECT, PAGE_CHAR, self.vm.is_hvm(), _("Not supported for this guest type.")) - add_hw_option("Physical Host Device", None, PAGE_HOSTDEV, + add_hw_option("Physical Host Device", "system-run", PAGE_HOSTDEV, self.vm.get_connection().is_nodedev_capable(), _("Connection does not support host device " "enumeration")) - add_hw_option("Video", gtk.STOCK_SELECT_COLOR, PAGE_VIDEO, + add_hw_option("Video", "video-display", PAGE_VIDEO, libvirt.getVersion() > 6005, _("Libvirt version does not support video devices.")) @@ -1275,24 +1279,26 @@ class vmmAddHardware(gobject.GObject): def populate_target_device_model(self, model): model.clear() - #[bus, device, icon, desc] + #[bus, device, icon, desc, iconsize] + def add_dev(bus, device, desc): + if device == virtinst.VirtualDisk.DEVICE_FLOPPY: + icon = "media-floppy" + elif device == virtinst.VirtualDisk.DEVICE_CDROM: + icon = "media-optical" + else: + icon = "drive-harddisk" + model.append([bus, device, icon, desc, gtk.ICON_SIZE_BUTTON]) + if self.vm.is_hvm(): - model.append(["ide", virtinst.VirtualDisk.DEVICE_DISK, - gtk.STOCK_HARDDISK, "IDE disk"]) - model.append(["ide", virtinst.VirtualDisk.DEVICE_CDROM, - gtk.STOCK_CDROM, "IDE cdrom"]) - model.append(["fdc", virtinst.VirtualDisk.DEVICE_FLOPPY, - gtk.STOCK_FLOPPY, "Floppy disk"]) - model.append(["scsi",virtinst.VirtualDisk.DEVICE_DISK, - gtk.STOCK_HARDDISK, "SCSI disk"]) - model.append(["usb", virtinst.VirtualDisk.DEVICE_DISK, - gtk.STOCK_HARDDISK, "USB disk"]) + add_dev("ide", virtinst.VirtualDisk.DEVICE_DISK, "IDE disk") + add_dev("ide", virtinst.VirtualDisk.DEVICE_CDROM, "IDE cdrom") + add_dev("fdc", virtinst.VirtualDisk.DEVICE_FLOPPY, "Floppy disk") + add_dev("scsi",virtinst.VirtualDisk.DEVICE_DISK, "SCSI disk") + add_dev("usb", virtinst.VirtualDisk.DEVICE_DISK, "USB disk") if self.vm.get_hv_type().lower() == "kvm": - model.append(["virtio", virtinst.VirtualDisk.DEVICE_DISK, - gtk.STOCK_HARDDISK, "Virtio Disk"]) + add_dev("virtio", virtinst.VirtualDisk.DEVICE_DISK, "Virtio Disk") if self.vm.get_connection().get_type().lower() == "xen": - model.append(["xen", virtinst.VirtualDisk.DEVICE_DISK, - gtk.STOCK_HARDDISK, "Virtual disk"]) + add_dev("xen", virtinst.VirtualDisk.DEVICE_DISK, "Virtual disk") def populate_input_model(self, model): model.clear() diff --git a/src/virtManager/config.py b/src/virtManager/config.py index b50b5c0be..68778c6da 100644 --- a/src/virtManager/config.py +++ b/src/virtManager/config.py @@ -96,6 +96,12 @@ class vmmConfig: def get_vm_status_icon(self, state): return self.status_icons[state] + def get_shutdown_icon_name(self): + theme = gtk.icon_theme_get_default() + if theme.has_icon("system-shutdown"): + return "system-shutdown" + return "icon_shutdown" + def get_appname(self): return self.appname diff --git a/src/virtManager/details.py b/src/virtManager/details.py index ccd9b8f4d..e436c4491 100644 --- a/src/virtManager/details.py +++ b/src/virtManager/details.py @@ -42,11 +42,10 @@ import virtinst # Columns in hw list model HW_LIST_COL_LABEL = 0 -HW_LIST_COL_STOCK_ID = 1 -HW_LIST_COL_STOCK_SIZE = 2 -HW_LIST_COL_PIXBUF = 3 -HW_LIST_COL_TYPE = 4 -HW_LIST_COL_DEVICE = 5 +HW_LIST_COL_ICON_NAME = 1 +HW_LIST_COL_ICON_SIZE = 2 +HW_LIST_COL_TYPE = 3 +HW_LIST_COL_DEVICE = 4 # Types for the hw list model: numbers specify what order they will be listed HW_LIST_TYPE_GENERAL = 0 @@ -133,18 +132,17 @@ class vmmDetails(gobject.GObject): else: self.window.get_widget("add-hardware-button").set_sensitive(True) - self.window.get_widget("control-shutdown").set_icon_widget(gtk.Image()) - self.window.get_widget("control-shutdown").get_icon_widget().set_from_file(config.get_icon_dir() + "/icon_shutdown.png") - + icon_name = self.config.get_shutdown_icon_name() + self.window.get_widget("control-shutdown").set_icon_name(icon_name) menu = gtk.Menu() self.window.get_widget("control-shutdown").set_menu(menu) - rebootimg = gtk.Image() - rebootimg.set_from_pixbuf(gtk.gdk.pixbuf_new_from_file_at_size(self.config.get_icon_dir() + "/icon_shutdown.png", 18, 18)) - shutdownimg = gtk.Image() - shutdownimg.set_from_pixbuf(gtk.gdk.pixbuf_new_from_file_at_size(self.config.get_icon_dir() + "/icon_shutdown.png", 18, 18)) - destroyimg = gtk.Image() - destroyimg.set_from_pixbuf(gtk.gdk.pixbuf_new_from_file_at_size(self.config.get_icon_dir() + "/icon_shutdown.png", 18, 18)) + rebootimg = gtk.image_new_from_icon_name(icon_name, + gtk.ICON_SIZE_MENU) + shutdownimg = gtk.image_new_from_icon_name(icon_name, + gtk.ICON_SIZE_MENU) + destroyimg = gtk.image_new_from_icon_name(icon_name, + gtk.ICON_SIZE_MENU) reboot = gtk.ImageMenuItem(_("_Reboot")) reboot.set_image(rebootimg) @@ -1712,21 +1710,21 @@ class vmmDetails(gobject.GObject): self.remove_device(info[0], info[1]) def prepare_hw_list(self): - hw_list_model = gtk.ListStore(str, str, int, gtk.gdk.Pixbuf, int, gobject.TYPE_PYOBJECT) + # [ label, icon name, icon size, hw type, hw data ] + hw_list_model = gtk.ListStore(str, str, int, int, + gobject.TYPE_PYOBJECT) self.window.get_widget("hw-list").set_model(hw_list_model) hwCol = gtk.TreeViewColumn("Hardware") - hwCol.set_spacing(24) + hwCol.set_spacing(6) + hwCol.set_min_width(165) hw_txt = gtk.CellRendererText() - hw_txt.set_property("xpad", 2) hw_img = gtk.CellRendererPixbuf() - hw_img.set_property("xpad", 4) - hwCol.pack_start(hw_txt, True) hwCol.pack_start(hw_img, False) + hwCol.pack_start(hw_txt, True) hwCol.add_attribute(hw_txt, 'text', HW_LIST_COL_LABEL) - hwCol.add_attribute(hw_img, 'stock-id', HW_LIST_COL_STOCK_ID) - hwCol.add_attribute(hw_img, 'stock-size', HW_LIST_COL_STOCK_SIZE) - hwCol.add_attribute(hw_img, 'pixbuf', HW_LIST_COL_PIXBUF) + hwCol.add_attribute(hw_img, 'stock-size', HW_LIST_COL_ICON_SIZE) + hwCol.add_attribute(hw_img, 'icon-name', HW_LIST_COL_ICON_NAME) self.window.get_widget("hw-list").append_column(hwCol) self.prepare_boot_list() @@ -1741,23 +1739,32 @@ class vmmDetails(gobject.GObject): icon = gtk.CellRendererPixbuf() boot_list.pack_start(icon, False) - boot_list.add_attribute(icon, 'stock-id', 1) + boot_list.add_attribute(icon, 'icon-name', 1) text = gtk.CellRendererText() boot_list.pack_start(text, True) boot_list.add_attribute(text, 'text', 0) + def add_hw_list_option(self, title, page_id, data, icon_name): + model = self.window.get_widget("hw-list").get_model() + model.append([title, icon_name, gtk.ICON_SIZE_LARGE_TOOLBAR, + page_id, data]) + def populate_hw_list(self): hw_list_model = self.window.get_widget("hw-list").get_model() hw_list_model.clear() - hw_list_model.append([_("Overview"), None, 0, self.pixbuf_processor, - HW_LIST_TYPE_GENERAL, []]) - hw_list_model.append([_("Performance"), None, 0, self.pixbuf_memory, - HW_LIST_TYPE_STATS, []]) - hw_list_model.append([_("Processor"), None, 0, self.pixbuf_processor, HW_LIST_TYPE_CPU, []]) - hw_list_model.append([_("Memory"), None, 0, self.pixbuf_memory, HW_LIST_TYPE_MEMORY, []]) - hw_list_model.append([_("Boot Options"), None, 0, self.pixbuf_memory, HW_LIST_TYPE_BOOT, []]) + + self.add_hw_list_option("Overview", HW_LIST_TYPE_GENERAL, [], + "computer") + self.add_hw_list_option("Performance", HW_LIST_TYPE_STATS, [], + "utilities-system-monitor") + self.add_hw_list_option("Processor", HW_LIST_TYPE_CPU, [], "icon_cpu") + self.add_hw_list_option("Memory", HW_LIST_TYPE_MEMORY, [], "icon_cpu") + self.add_hw_list_option("Boot Options", HW_LIST_TYPE_BOOT, [], + "icon_cpu") + self.repopulate_hw_list() + def repopulate_hw_list(self): hw_list = self.window.get_widget("hw-list") hw_list_model = hw_list.get_model() @@ -1771,116 +1778,96 @@ class vmmDetails(gobject.GObject): currentHostdevs = {} currentVids = {} - def update_hwlist(hwtype, info): - """Return (true if we updated an entry, - index to insert at if we didn't update an entry) + def add_hw_list_option(idx, name, page_id, info, icon_name): + hw_list_model.insert(idx, [name, icon_name, + gtk.ICON_SIZE_LARGE_TOOLBAR, + page_id, info]) + + def update_hwlist(hwtype, info, name, icon_name): + """ + See if passed hw is already in list, and if so, update info. + If not in list, add it! """ insertAt = 0 for row in hw_list_model: - if row[HW_LIST_COL_TYPE] == hwtype and \ - row[HW_LIST_COL_DEVICE][2] == info[2]: + if (row[HW_LIST_COL_TYPE] == hwtype and + row[HW_LIST_COL_DEVICE][2] == info[2]): + # Update existing HW info row[HW_LIST_COL_DEVICE] = info - return (False, insertAt) + return if row[HW_LIST_COL_TYPE] <= hwtype: insertAt += 1 - return (True, insertAt) + # Add the new HW row + add_hw_list_option(insertAt, name, hwtype, info, icon_name) # Populate list of disks for diskinfo in self.vm.get_disk_devices(): currentDisks[diskinfo[2]] = 1 - missing, insertAt = update_hwlist(HW_LIST_TYPE_DISK, - diskinfo) + icon = "drive-harddisk" + if diskinfo[4] == "cdrom": + icon = "media-optical" + elif diskinfo[4] == "floppy": + icon = "media-floppy" - # Add in row - if missing: - stock = gtk.STOCK_HARDDISK - if diskinfo[4] == "cdrom": - stock = gtk.STOCK_CDROM - elif diskinfo[4] == "floppy": - stock = gtk.STOCK_FLOPPY - hw_list_model.insert(insertAt, ["Disk %s" % diskinfo[2], stock, gtk.ICON_SIZE_LARGE_TOOLBAR, None, HW_LIST_TYPE_DISK, diskinfo]) + update_hwlist(HW_LIST_TYPE_DISK, diskinfo, "Disk %s" % diskinfo[2], + icon) # Populate list of NICs for netinfo in self.vm.get_network_devices(): currentNICs[netinfo[2]] = 1 - missing, insertAt = update_hwlist(HW_LIST_TYPE_NIC, - netinfo) - - # Add in row - if missing: - hw_list_model.insert(insertAt, ["NIC %s" % netinfo[2][-9:], gtk.STOCK_NETWORK, gtk.ICON_SIZE_LARGE_TOOLBAR, None, HW_LIST_TYPE_NIC, netinfo]) + update_hwlist(HW_LIST_TYPE_NIC, netinfo, + "NIC %s" % netinfo[2][-9:], "network-idle") # Populate list of input devices for inputinfo in self.vm.get_input_devices(): currentInputs[inputinfo[2]] = 1 - missing, insertAt = update_hwlist(HW_LIST_TYPE_INPUT, - inputinfo) + icon = "input-mouse" + if inputinfo[4] == "tablet": + label = _("Tablet") + icon = "input-tablet" + elif inputinfo[4] == "mouse": + label = _("Mouse") + else: + label = _("Input") - # Add in row - if missing: - if inputinfo[4] == "tablet": - label = _("Tablet") - elif inputinfo[4] == "mouse": - label = _("Mouse") - else: - label = _("Input") - hw_list_model.insert(insertAt, [label, gtk.STOCK_INDEX, gtk.ICON_SIZE_LARGE_TOOLBAR, None, HW_LIST_TYPE_INPUT, inputinfo]) + update_hwlist(HW_LIST_TYPE_INPUT, inputinfo, label, icon) # Populate list of graphics devices for gfxinfo in self.vm.get_graphics_devices(): currentGraphics[gfxinfo[2]] = 1 - missing, insertAt = update_hwlist(HW_LIST_TYPE_GRAPHICS, - gfxinfo) - - # Add in row - if missing: - hw_list_model.insert(insertAt, [_("Display %s") % gfxinfo[1].upper(), gtk.STOCK_SELECT_COLOR, gtk.ICON_SIZE_LARGE_TOOLBAR, None, HW_LIST_TYPE_GRAPHICS, gfxinfo]) + update_hwlist(HW_LIST_TYPE_GRAPHICS, gfxinfo, + _("Display %s") % gfxinfo[1], + "video-display") # Populate list of sound devices for soundinfo in self.vm.get_sound_devices(): currentSounds[soundinfo[2]] = 1 - missing, insertAt = update_hwlist(HW_LIST_TYPE_SOUND, - soundinfo) - - # Add in row - if missing: - hw_list_model.insert(insertAt, [_("Sound: %s" % soundinfo[2]), gtk.STOCK_MEDIA_PLAY, gtk.ICON_SIZE_LARGE_TOOLBAR, None, HW_LIST_TYPE_SOUND, soundinfo]) + update_hwlist(HW_LIST_TYPE_SOUND, soundinfo, + _("Sound: %s" % soundinfo[2]), "audio-card") # Populate list of char devices for charinfo in self.vm.get_char_devices(): currentChars[charinfo[2]] = 1 - missing, insertAt = update_hwlist(HW_LIST_TYPE_CHAR, - charinfo) + label = charinfo[0].capitalize() + if charinfo[0] != "console": + label += " %s" % charinfo[3] # Don't show port for console - # Add in row - if missing: - l = charinfo[0].capitalize() - if charinfo[0] != "console": - l += " %s" % charinfo[3] # Don't show port for console - hw_list_model.insert(insertAt, [l, gtk.STOCK_CONNECT, gtk.ICON_SIZE_LARGE_TOOLBAR, None, HW_LIST_TYPE_CHAR, charinfo]) + update_hwlist(HW_LIST_TYPE_CHAR, charinfo, label, + gtk.STOCK_CONNECT) # Populate host devices for hostdevinfo in self.vm.get_hostdev_devices(): currentHostdevs[hostdevinfo[2]] = 1 - missing, insertAt = update_hwlist(HW_LIST_TYPE_HOSTDEV, - hostdevinfo) - - if missing: - hw_list_model.insert(insertAt, [hostdevinfo[2], None, gtk.ICON_SIZE_LARGE_TOOLBAR, None, HW_LIST_TYPE_HOSTDEV, hostdevinfo]) + update_hwlist(HW_LIST_TYPE_HOSTDEV, hostdevinfo, hostdevinfo[2], + "system-run") # Populate video devices for vidinfo in self.vm.get_video_devices(): currentVids[vidinfo[2]] = 1 - missing, insertAt = update_hwlist(HW_LIST_TYPE_VIDEO, - vidinfo) - - if missing: - hw_list_model.insert(insertAt, - [_("Video"), gtk.STOCK_SELECT_COLOR, - gtk.ICON_SIZE_LARGE_TOOLBAR, - None, HW_LIST_TYPE_VIDEO, vidinfo]) + update_hwlist(HW_LIST_TYPE_VIDEO, vidinfo, _("Video"), + "video-display") # Now remove any no longer current devs devs = range(len(hw_list_model)) @@ -1927,23 +1914,27 @@ class vmmDetails(gobject.GObject): boot_model.clear() found_dev = {} for row in hw_list_model: - if row[4] == HW_LIST_TYPE_DISK: - diskinfo = row[5] + hwtype = row[HW_LIST_COL_TYPE] + + if hwtype == HW_LIST_TYPE_DISK: + diskinfo = row[HW_LIST_COL_DEVICE] + if diskinfo[4] == virtinst.VirtualDisk.DEVICE_DISK and not \ found_dev.get(virtinst.VirtualDisk.DEVICE_DISK, False): - boot_model.append(["Hard Disk", gtk.STOCK_HARDDISK, "hd"]) + boot_model.append(["Hard Disk", "drive-harddisk", "hd"]) found_dev[virtinst.VirtualDisk.DEVICE_DISK] = True elif diskinfo[4] == virtinst.VirtualDisk.DEVICE_CDROM and not \ found_dev.get(virtinst.VirtualDisk.DEVICE_CDROM, False): - boot_model.append(["CDROM", gtk.STOCK_CDROM, "cdrom"]) + boot_model.append(["CDROM", "media-optical", "cdrom"]) found_dev[virtinst.VirtualDisk.DEVICE_CDROM] = True elif diskinfo[4] == virtinst.VirtualDisk.DEVICE_FLOPPY and not \ found_dev.get(virtinst.VirtualDisk.DEVICE_FLOPPY, False): - boot_model.append(["Floppy", gtk.STOCK_FLOPPY, "fd"]) + boot_model.append(["Floppy", "media-floppy", "fd"]) found_dev[virtinst.VirtualDisk.DEVICE_FLOPPY] = True - elif row[4] == HW_LIST_TYPE_NIC and not \ - found_dev.get(HW_LIST_TYPE_NIC, False): - boot_model.append(["Network (PXE)", gtk.STOCK_NETWORK, "network"]) + + elif (hwtype == HW_LIST_TYPE_NIC and not + found_dev.get(HW_LIST_TYPE_NIC, False)): + boot_model.append(["Network (PXE)", "network-idle", "network"]) found_dev[HW_LIST_TYPE_NIC] = True if len(boot_model) <= 0: diff --git a/src/virtManager/host.py b/src/virtManager/host.py index 3de3b69b2..9459f91be 100644 --- a/src/virtManager/host.py +++ b/src/virtManager/host.py @@ -62,7 +62,7 @@ class vmmHost(gobject.GObject): self.window.get_widget("overview-arch").set_text(self.conn.host_architecture()) self.window.get_widget("config-autoconnect").set_active(conn.get_autoconnect()) - netListModel = gtk.ListStore(str, str, str) + netListModel = gtk.ListStore(str, str, str, int) self.window.get_widget("net-list").set_model(netListModel) volListModel = gtk.ListStore(str, str, str, str) @@ -81,12 +81,14 @@ class vmmHost(gobject.GObject): self.window.get_widget("vol-list").get_selection().connect("changed", self.vol_selected) netCol = gtk.TreeViewColumn("Networks") + netCol.set_spacing(6) net_txt = gtk.CellRendererText() net_img = gtk.CellRendererPixbuf() - netCol.pack_start(net_txt, True) netCol.pack_start(net_img, False) + netCol.pack_start(net_txt, True) netCol.add_attribute(net_txt, 'text', 1) - netCol.add_attribute(net_img, 'stock-id', 2) + netCol.add_attribute(net_img, 'icon-name', 2) + netCol.add_attribute(net_img, 'stock-size', 3) self.window.get_widget("net-list").append_column(netCol) netListModel.set_sort_column_id(1, gtk.SORT_ASCENDING) @@ -385,7 +387,8 @@ class vmmHost(gobject.GObject): model.clear() for uuid in self.conn.list_net_uuids(): net = self.conn.get_net(uuid) - model.append([uuid, net.get_name(), gtk.STOCK_NETWORK]) + model.append([uuid, net.get_name(), "network-idle", + gtk.ICON_SIZE_LARGE_TOOLBAR]) _iter = model.get_iter_first() if _iter: diff --git a/src/virtManager/manager.py b/src/virtManager/manager.py index 4a186ab32..49f4e1211 100644 --- a/src/virtManager/manager.py +++ b/src/virtManager/manager.py @@ -164,12 +164,17 @@ class vmmManager(gobject.GObject): self.vmmenu_icons["resume"] = gtk.Image() self.vmmenu_icons["resume"].set_from_stock(gtk.STOCK_MEDIA_PAUSE, gtk.ICON_SIZE_MENU) - self.vmmenu_icons["reboot"] = gtk.Image() - self.vmmenu_icons["reboot"].set_from_pixbuf(gtk.gdk.pixbuf_new_from_file_at_size(self.config.get_icon_dir() + "/icon_shutdown.png", 18, 18)) - self.vmmenu_icons["poweroff"] = gtk.Image() - self.vmmenu_icons["poweroff"].set_from_pixbuf(gtk.gdk.pixbuf_new_from_file_at_size(self.config.get_icon_dir() + "/icon_shutdown.png", 18, 18)) - self.vmmenu_icons["forcepoweroff"] = gtk.Image() - self.vmmenu_icons["forcepoweroff"].set_from_pixbuf(gtk.gdk.pixbuf_new_from_file_at_size(self.config.get_icon_dir() + "/icon_shutdown.png", 18, 18)) + + icon_name = self.config.get_shutdown_icon_name() + rebootimg = gtk.image_new_from_icon_name(icon_name, + gtk.ICON_SIZE_MENU) + shutdownimg = gtk.image_new_from_icon_name(icon_name, + gtk.ICON_SIZE_MENU) + destroyimg = gtk.image_new_from_icon_name(icon_name, + gtk.ICON_SIZE_MENU) + self.vmmenu_icons["reboot"] = rebootimg + self.vmmenu_icons["poweroff"] = shutdownimg + self.vmmenu_icons["forcepoweroff"] = destroyimg self.vmmenu = gtk.Menu() self.vmmenushutdown = gtk.Menu()