From 382391eadb3508241ef333d81cc09688fa572811 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sat, 19 Feb 2022 12:01:55 -0500 Subject: [PATCH] Clean up gtk STOCK and various image usage - Remove most use of deprecated stock icons. Without it the UI will be a lot more ugly in Fedora 36 - Remove deprecated ImageMenuItem usage, convert to regular MenuItem - Remove most embedded button images Signed-off-by: Cole Robinson --- ui/addhardware.ui | 12 +-- ui/asyncjob.ui | 8 +- ui/clone.ui | 22 ++--- ui/connectauth.ui | 8 +- ui/console.ui | 6 -- ui/createconn.ui | 12 +-- ui/createnet.ui | 10 +-- ui/createpool.ui | 6 +- ui/createvm.ui | 28 +++--- ui/createvol.ui | 14 +-- ui/delete.ui | 10 +-- ui/details.ui | 32 +++---- ui/fsdetails.ui | 2 +- ui/gfxdetails.ui | 4 +- ui/host.ui | 18 ++-- ui/hostnets.ui | 146 +++++++++---------------------- ui/hoststorage.ui | 33 +++---- ui/manager.ui | 67 ++++---------- ui/migrate.ui | 6 +- ui/netlist.ui | 4 +- ui/oslist.ui | 2 +- ui/preferences.ui | 6 +- ui/snapshots.ui | 18 ++-- ui/snapshotsnew.ui | 15 +--- ui/vmwindow.ui | 38 ++------ ui/xmleditor.ui | 2 +- virtManager/addhardware.py | 14 +-- virtManager/clone.py | 6 +- virtManager/delete.py | 6 +- virtManager/details/console.py | 4 +- virtManager/details/details.py | 12 +-- virtManager/details/serialcon.py | 6 +- virtManager/details/snapshots.py | 14 +-- virtManager/hostnets.py | 7 -- virtManager/hoststorage.py | 5 +- virtManager/manager.py | 16 ++-- virtManager/object/network.py | 2 - virtManager/vmmenu.py | 40 +++------ 38 files changed, 214 insertions(+), 447 deletions(-) diff --git a/ui/addhardware.ui b/ui/addhardware.ui index 3bd1637c..b9b0c04a 100644 --- a/ui/addhardware.ui +++ b/ui/addhardware.ui @@ -17,11 +17,6 @@ 1 10 - - True - False - gtk-apply - 500 400 @@ -290,7 +285,7 @@ True False - gtk-info + dialog-information 2 @@ -1439,11 +1434,11 @@ end - gtk-cancel + _Cancel True True True - True + True @@ -1458,7 +1453,6 @@ True True True - image1 True diff --git a/ui/asyncjob.ui b/ui/asyncjob.ui index 2f5debaa..3ddc2f01 100644 --- a/ui/asyncjob.ui +++ b/ui/asyncjob.ui @@ -33,7 +33,7 @@ 3 10 10 - gtk-dialog-info + dialog-information 6 @@ -75,7 +75,7 @@ False 3 3 - gtk-dialog-warning + dialog-warning False @@ -143,11 +143,11 @@ 12 - gtk-cancel + _Cancel True True True - True + True diff --git a/ui/clone.ui b/ui/clone.ui index f7af53e9..52d17874 100644 --- a/ui/clone.ui +++ b/ui/clone.ui @@ -2,11 +2,6 @@ - - True - False - gtk-new - False Clone Virtual Machine @@ -342,7 +337,7 @@ False start start - gtk-dialog-warning + dialog-warning False @@ -393,11 +388,11 @@ like change passwords or static IPs, please see the virt-sysprep(1) tool.</sp end - gtk-cancel + _Cancel True True True - True + True @@ -413,7 +408,6 @@ like change passwords or static IPs, please see the virt-sysprep(1) tool.</sp True True True - image1 True @@ -462,11 +456,11 @@ like change passwords or static IPs, please see the virt-sysprep(1) tool.</sp end - gtk-cancel + _Cancel True True True - True + True @@ -477,11 +471,11 @@ like change passwords or static IPs, please see the virt-sysprep(1) tool.</sp - gtk-ok + _OK True True True - True + True @@ -522,7 +516,7 @@ like change passwords or static IPs, please see the virt-sysprep(1) tool.</sp True False - gtk-harddisk + drive-harddisk 6 diff --git a/ui/connectauth.ui b/ui/connectauth.ui index 7838128e..b5fdea77 100644 --- a/ui/connectauth.ui +++ b/ui/connectauth.ui @@ -19,11 +19,11 @@ end - gtk-cancel + _Cancel True True True - True + True @@ -34,11 +34,11 @@ - gtk-ok + _OK True True True - True + True diff --git a/ui/console.ui b/ui/console.ui index e4119df9..03a084a0 100644 --- a/ui/console.ui +++ b/ui/console.ui @@ -2,11 +2,6 @@ - - True - False - gtk-apply - True True @@ -179,7 +174,6 @@ True True False - image70 True diff --git a/ui/createconn.ui b/ui/createconn.ui index 49df9163..6b28473c 100644 --- a/ui/createconn.ui +++ b/ui/createconn.ui @@ -2,11 +2,6 @@ - - True - False - gtk-connect - False 6 @@ -27,12 +22,12 @@ end - gtk-cancel + _Cancel True True True False - True + True @@ -49,7 +44,6 @@ True True True - image1 True @@ -224,7 +218,7 @@ False start start - gtk-dialog-warning + dialog-warning False diff --git a/ui/createnet.ui b/ui/createnet.ui index 0a7492fa..71d37bc7 100644 --- a/ui/createnet.ui +++ b/ui/createnet.ui @@ -2,11 +2,6 @@ - - True - False - gtk-new - 400 400 @@ -815,11 +810,11 @@ end - gtk-cancel + _Cancel True True True - True + True @@ -834,7 +829,6 @@ True True True - image2 True diff --git a/ui/createpool.ui b/ui/createpool.ui index e361f7e3..0e52e0a9 100644 --- a/ui/createpool.ui +++ b/ui/createpool.ui @@ -29,7 +29,7 @@ True False - gtk-new + document-new 6 @@ -470,11 +470,11 @@ end - gtk-cancel + _Cancel True True True - True + True diff --git a/ui/createvm.ui b/ui/createvm.ui index 38361dac..4de94034 100644 --- a/ui/createvm.ui +++ b/ui/createvm.ui @@ -12,11 +12,6 @@ 1 10 - - True - False - gtk-new - 500 500 @@ -540,7 +535,7 @@ start start False - gtk-dialog-warning + dialog-warning 0 @@ -599,7 +594,7 @@ bar start start False - gtk-dialog-warning + dialog-warning 0 @@ -1180,7 +1175,7 @@ User shouldn't see this. True False - gtk-info + dialog-information 3 @@ -1388,7 +1383,7 @@ User shouldn't see this. True False - gtk-dialog-warning + dialog-warning False @@ -1427,7 +1422,7 @@ please install <a href="https://github.com/virt-manager/virt-bootstrap">vi True False - gtk-dialog-warning + dialog-warning False @@ -2514,11 +2509,11 @@ connections is not yet supported.</small> end - gtk-cancel + _Cancel True True True - True + True @@ -2529,12 +2524,12 @@ connections is not yet supported.</small> - gtk-go-back + _Back True False True True - True + True @@ -2545,11 +2540,11 @@ connections is not yet supported.</small> - gtk-go-forward + _Forward True True True - True + True @@ -2563,7 +2558,6 @@ connections is not yet supported.</small> _Finish True True - image20 True diff --git a/ui/createvol.ui b/ui/createvol.ui index 1786a0e0..24811cee 100644 --- a/ui/createvol.ui +++ b/ui/createvol.ui @@ -17,12 +17,7 @@ True False - gtk-new - - - True - False - gtk-open + document-new False @@ -50,7 +45,7 @@ True False - gtk-new + document-new 6 @@ -420,7 +415,6 @@ True True True - image2 True @@ -470,11 +464,11 @@ end - gtk-cancel + _Cancel True True True - True + True diff --git a/ui/delete.ui b/ui/delete.ui index 7c884f43..f07268ad 100644 --- a/ui/delete.ui +++ b/ui/delete.ui @@ -92,7 +92,7 @@ True False - gtk-dialog-warning + dialog-warning False @@ -178,11 +178,11 @@ end - gtk-cancel + _Cancel True True True - True + True @@ -193,11 +193,11 @@ - gtk-delete + _Delete True True True - True + True diff --git a/ui/details.ui b/ui/details.ui index 359f922e..e6146b34 100644 --- a/ui/details.ui +++ b/ui/details.ui @@ -68,11 +68,6 @@ 1 2 - - True - False - gtk-add - True False @@ -128,7 +123,6 @@ True True False - image80 True @@ -304,7 +298,7 @@ True False start - gtk-missing-image + image-missing 0 @@ -555,7 +549,7 @@ True False - gtk-dialog-warning + dialog-warning False @@ -836,7 +830,7 @@ False start start - gtk-dialog-warning + dialog-warning 0 @@ -1319,7 +1313,7 @@ True False start - gtk-dialog-warning + dialog-warning False @@ -2446,7 +2440,7 @@ True False - gtk-go-up + go-up @@ -2474,7 +2468,7 @@ True False - gtk-go-down + go-down @@ -3052,7 +3046,7 @@ True False - gtk-refresh + view-refresh @@ -4705,12 +4699,12 @@ end - gtk-remove + _Remove True True True False - True + True @@ -4726,11 +4720,11 @@ - gtk-cancel + _Cancel True True True - True + True @@ -4746,13 +4740,13 @@ - gtk-apply + _Apply True False True True False - True + True diff --git a/ui/fsdetails.ui b/ui/fsdetails.ui index 6d0d18ae..07526800 100644 --- a/ui/fsdetails.ui +++ b/ui/fsdetails.ui @@ -278,7 +278,7 @@ True False - gtk-dialog-warning + dialog-warning False diff --git a/ui/gfxdetails.ui b/ui/gfxdetails.ui index 3ff80381..e672e809 100644 --- a/ui/gfxdetails.ui +++ b/ui/gfxdetails.ui @@ -312,7 +312,7 @@ True False start - gtk-dialog-warning + dialog-warning 0 @@ -324,7 +324,7 @@ True False start - gtk-dialog-warning + dialog-warning 0 diff --git a/ui/host.ui b/ui/host.ui index ccafe3e8..722a4da7 100644 --- a/ui/host.ui +++ b/ui/host.ui @@ -2,7 +2,6 @@ - 800 600 @@ -10,9 +9,6 @@ Connection Details 750 500 - - - @@ -49,25 +45,23 @@ - - gtk-close + + _Close True False True - True - accelgroup1 + - - gtk-quit + + _Quit True False True - True - accelgroup1 + diff --git a/ui/hostnets.ui b/ui/hostnets.ui index 603408f1..81337a6f 100644 --- a/ui/hostnets.ui +++ b/ui/hostnets.ui @@ -62,7 +62,7 @@ vertical 12 - + True False @@ -77,7 +77,7 @@ True False - gtk-missing-image + image-missing False @@ -234,21 +234,6 @@ 0 - - - - - - - - - - - - - - - False @@ -262,7 +247,7 @@ True True - + True False @@ -294,42 +279,6 @@ 1 - - - True - False - 3 - - - True - False - gtk-missing-image - - - False - False - 0 - - - - - True - False - start - NAT to any device - - - True - True - 1 - - - - - 1 - 2 - - True @@ -367,13 +316,28 @@ - - - - - - - + + True + False + 3 + + + True + False + start + NAT to any device + + + True + True + 0 + + + + + 1 + 2 + @@ -431,42 +395,6 @@ 1 - - - True - False - 3 - - - True - False - gtk-missing-image - - - False - False - 0 - - - - - True - False - start - Routed - - - True - True - 1 - - - - - 1 - 2 - - True @@ -503,6 +431,18 @@ 2 + + + True + False + start + Routed + + + 1 + 2 + + @@ -595,7 +535,7 @@ True False - gtk-add + list-add @@ -622,7 +562,7 @@ True False - gtk-media-play + media-playback-start @@ -649,7 +589,7 @@ True False - gtk-stop + process-stop @@ -676,7 +616,7 @@ True False - gtk-delete + edit-delete @@ -704,11 +644,11 @@ False - gtk-apply + _Apply True True False - True + True diff --git a/ui/hoststorage.ui b/ui/hoststorage.ui index 73d7236b..7fe5a902 100644 --- a/ui/hoststorage.ui +++ b/ui/hoststorage.ui @@ -2,11 +2,6 @@ - - True - False - gtk-apply - True @@ -33,7 +28,7 @@ True False - gtk-add + list-add @@ -59,7 +54,7 @@ True False - gtk-media-play + media-playback-start @@ -85,7 +80,7 @@ True False - gtk-stop + process-stop @@ -111,7 +106,7 @@ True False - gtk-delete + edit-delete @@ -170,12 +165,12 @@ - gtk-cancel + _Cancel True True True Cancel and close dialog - True + True @@ -186,12 +181,12 @@ - Choose Volume + Ch_oose Volume True True True + True Choose the selected volume - image3 @@ -202,12 +197,12 @@ - gtk-apply + _Apply True True False + True Apply pool changes - True @@ -297,7 +292,7 @@ True False start - gtk-missing-image + image-missing False @@ -514,7 +509,7 @@ True False - gtk-add + list-add @@ -541,7 +536,7 @@ True False - gtk-refresh + view-refresh @@ -568,7 +563,7 @@ True False - gtk-delete + edit-delete diff --git a/ui/manager.ui b/ui/manager.ui index c1a70f08..f5e362f2 100644 --- a/ui/manager.ui +++ b/ui/manager.ui @@ -2,31 +2,12 @@ - - - True - False - gtk-add - - - True - False - gtk-properties - - - True - False - gtk-properties - False Virtual Machine Manager 550 550 center - - - @@ -48,13 +29,11 @@ False - + _Add Connection... True False True - image2 - False @@ -74,25 +53,23 @@ - - gtk-close + + _Close True False True - True - accelgroup1 + - - gtk-quit + + _Quit True False True - True - accelgroup1 + @@ -109,35 +86,29 @@ False - + _Connection Details True False True - image5 - False - + _Virtual Machine Details True False True - image4 - False - - gtk-delete + + _Delete True False True - True - accelgroup1 @@ -148,13 +119,11 @@ - - gtk-preferences + + _Preferences True False True - True - accelgroup1 @@ -247,13 +216,11 @@ False - - gtk-about + + _About True False True - True - accelgroup1 @@ -329,7 +296,7 @@ Power on the virtual machine _Run True - gtk-media-play + media-playback-start @@ -345,7 +312,7 @@ Pause the virtual machine _Pause True - gtk-media-pause + media-playback-pause diff --git a/ui/migrate.ui b/ui/migrate.ui index d4e86266..6fa9dd17 100644 --- a/ui/migrate.ui +++ b/ui/migrate.ui @@ -438,7 +438,7 @@ This can simplify setup since no additional firewall ports need to be open, and True False start - gtk-dialog-warning + dialog-warning False @@ -642,11 +642,11 @@ If 'temporary' is selected, the migration is considered only a temporary move: t end - gtk-cancel + _Cancel True True True - True + True diff --git a/ui/netlist.ui b/ui/netlist.ui index 07be02e4..757d9296 100644 --- a/ui/netlist.ui +++ b/ui/netlist.ui @@ -47,7 +47,7 @@ True False - gtk-dialog-warning + dialog-warning False @@ -106,7 +106,7 @@ True False - gtk-dialog-warning + dialog-warning False diff --git a/ui/oslist.ui b/ui/oslist.ui index 9820279f..c00e266b 100644 --- a/ui/oslist.ui +++ b/ui/oslist.ui @@ -38,7 +38,7 @@ True False start - gtk-info + dialog-information 3 diff --git a/ui/preferences.ui b/ui/preferences.ui index 151f06e3..c6e3666d 100644 --- a/ui/preferences.ui +++ b/ui/preferences.ui @@ -90,7 +90,7 @@ True False - gtk-dialog-warning + dialog-warning False @@ -1008,11 +1008,11 @@ identical CPUs in order to migrate the VM. end - gtk-close + _Close + True True True True - True diff --git a/ui/snapshots.ui b/ui/snapshots.ui index a25c2640..3b53497c 100644 --- a/ui/snapshots.ui +++ b/ui/snapshots.ui @@ -135,7 +135,7 @@ True False - gtk-cancel + image-missing False @@ -245,7 +245,7 @@ True False - gtk-missing-image + image-missing False @@ -280,7 +280,7 @@ True False - gtk-info + dialog-information 2 @@ -392,7 +392,7 @@ True False - gtk-add + list-add @@ -418,7 +418,7 @@ True False - gtk-media-play + media-playback-start @@ -444,7 +444,7 @@ True False - gtk-refresh + view-refresh @@ -472,7 +472,7 @@ True False - gtk-delete + edit-delete @@ -502,14 +502,14 @@ end - gtk-apply + _Apply True True True True + True Save updated snapshot metadata Save updated snapshot metadata - True diff --git a/ui/snapshotsnew.ui b/ui/snapshotsnew.ui index ea328e92..144e9b19 100644 --- a/ui/snapshotsnew.ui +++ b/ui/snapshotsnew.ui @@ -2,11 +2,6 @@ - - True - False - gtk-new - False Create snapshot @@ -33,7 +28,7 @@ True False - gtk-new + document-new 6 @@ -182,7 +177,6 @@ True False - gtk-cancel False @@ -227,7 +221,7 @@ True False start - gtk-missing-image + image-missing 1 @@ -251,11 +245,11 @@ end - gtk-cancel + _Cancel True True True - True + True @@ -270,7 +264,6 @@ True True True - image3 True diff --git a/ui/vmwindow.ui b/ui/vmwindow.ui index 7f14ec61..9dddc83e 100644 --- a/ui/vmwindow.ui +++ b/ui/vmwindow.ui @@ -2,25 +2,11 @@ - - - True - False - gtk-close - - - True - False - gtk-quit - False Virtual Machine 800 600 - - - @@ -57,27 +43,21 @@ - - _Close + + _Close True False True - image1 - False - accelgroup1 - - _Quit + + _Quit True False True - image2 - False - accelgroup1 @@ -333,7 +313,7 @@ False Show virtual hardware details Details - gtk-info + dialog-information control-vm-console @@ -359,7 +339,7 @@ Power on the virtual machine Run True - gtk-media-play + media-playback-start @@ -374,7 +354,7 @@ Pause the virtual machine Pause True - gtk-media-pause + media-playback-pause @@ -426,7 +406,7 @@ False Switch to fullscreen view end - gtk-fullscreen + view-fullscreen @@ -453,7 +433,6 @@ True _Begin Installation True - gtk-apply @@ -468,7 +447,6 @@ True _Cancel Installation True - gtk-cancel diff --git a/ui/xmleditor.ui b/ui/xmleditor.ui index 8a4e6901..ab61e05f 100644 --- a/ui/xmleditor.ui +++ b/ui/xmleditor.ui @@ -81,7 +81,7 @@ True False - gtk-dialog-warning + dialog-warning False diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py index bcf44bd4..d77f89b2 100644 --- a/virtManager/addhardware.py +++ b/virtManager/addhardware.py @@ -224,21 +224,21 @@ class vmmAddHardware(vmmGObjectUI): 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, + add_hw_option(_("Serial"), "device_serial", PAGE_CHAR, self.vm.is_hvm(), _("Not supported for this guest type."), "serial") - add_hw_option(_("Parallel"), Gtk.STOCK_CONNECT, PAGE_CHAR, + add_hw_option(_("Parallel"), "device_serial", PAGE_CHAR, self.vm.is_hvm(), _("Not supported for this guest type."), "parallel") - add_hw_option(_("Console"), Gtk.STOCK_CONNECT, PAGE_CHAR, + add_hw_option(_("Console"), "device_serial", PAGE_CHAR, True, None, "console") - add_hw_option(_("Channel"), Gtk.STOCK_CONNECT, PAGE_CHAR, + add_hw_option(_("Channel"), "device_serial", PAGE_CHAR, self.vm.is_hvm(), _("Not supported for this guest type."), "channel") - add_hw_option(_("USB Host Device"), "system-run", PAGE_HOSTDEV, + add_hw_option(_("USB Host Device"), "device_usb", PAGE_HOSTDEV, self.conn.support.conn_nodedev(), _("Connection does not support host device enumeration"), "usb") @@ -249,10 +249,10 @@ class vmmAddHardware(vmmGObjectUI): if self.vm.is_container(): nodedev_enabled = False nodedev_errstr = _("Not supported for containers") - add_hw_option(_("PCI Host Device"), "system-run", PAGE_HOSTDEV, + add_hw_option(_("PCI Host Device"), "device_pci", PAGE_HOSTDEV, nodedev_enabled, nodedev_errstr, "pci") - add_hw_option(_("MDEV Host Device"), "system-run", PAGE_HOSTDEV, + add_hw_option(_("MDEV Host Device"), "device_pci", PAGE_HOSTDEV, self.conn.support.conn_nodedev(), _("Connection does not support host device enumeration"), "mdev") diff --git a/virtManager/clone.py b/virtManager/clone.py index 442d572a..7cb8ed67 100644 --- a/virtManager/clone.py +++ b/virtManager/clone.py @@ -304,10 +304,10 @@ class vmmCloneVM(vmmGObjectUI): _chkbox.set_property('active', active) _chkbox.set_property('visible', visible) _chkimg.set_property('visible', not visible) - icon = Gtk.STOCK_INFO + icon = "dialog-information" if sinfo.warn_about_sharing(): - icon = Gtk.STOCK_DIALOG_WARNING - _chkimg.set_property('stock-id', icon) + icon = "dialog-warning" + _chkimg.set_property('icon-name', icon) tooltip = sinfo.get_tooltip() if tooltip != model[_iter][1]: model[_iter][1] = tooltip diff --git a/virtManager/delete.py b/virtManager/delete.py index 9ee60b5d..f050534b 100644 --- a/virtManager/delete.py +++ b/virtManager/delete.py @@ -487,7 +487,7 @@ def _populate_storage_list(storage_list, vm, conn, diskdatas): elif not default: info = definfo - icon = Gtk.STOCK_DIALOG_WARNING + icon = "dialog-warning" icon_size = Gtk.IconSize.LARGE_TOOLBAR row = [default, not can_del, diskdata.path, diskdata.label, @@ -496,7 +496,7 @@ def _populate_storage_list(storage_list, vm, conn, diskdatas): def _prepare_storage_list(storage_list): - # Checkbox, deleteable?, storage path, target (hda), icon stock, + # Checkbox, deleteable?, storage path, target (hda), icon name, # icon size, tooltip model = Gtk.ListStore(bool, bool, str, str, bool, str, int, str) storage_list.set_model(model) @@ -544,7 +544,7 @@ def _prepare_storage_list(storage_list): info_img = Gtk.CellRendererPixbuf() infoCol.pack_start(info_img, False) infoCol.add_attribute(info_img, 'visible', STORAGE_ROW_ICON_SHOW) - infoCol.add_attribute(info_img, 'stock-id', STORAGE_ROW_ICON) + infoCol.add_attribute(info_img, 'icon-name', STORAGE_ROW_ICON) infoCol.add_attribute(info_img, 'stock-size', STORAGE_ROW_ICON_SIZE) infoCol.set_sort_column_id(STORAGE_ROW_ICON) diff --git a/virtManager/details/console.py b/virtManager/details/console.py index f19dc95c..600cb43b 100644 --- a/virtManager/details/console.py +++ b/virtManager/details/console.py @@ -149,7 +149,9 @@ class vmmOverlayToolbar: self._toolbar.get_accessible().set_name("Fullscreen Toolbar") # Exit button - button = Gtk.ToolButton.new_from_stock(Gtk.STOCK_LEAVE_FULLSCREEN) + button = Gtk.ToolButton() + button.set_label(_("Leave Fullscreen")) + button.set_icon_name("view-restore") button.set_tooltip_text(_("Leave fullscreen")) button.show() button.get_accessible().set_name("Fullscreen Exit") diff --git a/virtManager/details/details.py b/virtManager/details/details.py index 2b483409..8f344c7d 100644 --- a/virtManager/details/details.py +++ b/virtManager/details/details.py @@ -534,21 +534,13 @@ class vmmDetails(vmmGObjectUI): # Add HW popup menu self._popupmenu = Gtk.Menu() - addHW = Gtk.ImageMenuItem.new_with_label(_("_Add Hardware")) - addHW.set_use_underline(True) - addHWImg = Gtk.Image() - addHWImg.set_from_stock(Gtk.STOCK_ADD, Gtk.IconSize.MENU) - addHW.set_image(addHWImg) + addHW = Gtk.MenuItem.new_with_mnemonic(_("_Add Hardware")) addHW.show() def _addhw_clicked_cb(*args, **kwargs): self._show_addhw() addHW.connect("activate", _addhw_clicked_cb) - rmHW = Gtk.ImageMenuItem.new_with_label(_("_Remove Hardware")) - rmHW.set_use_underline(True) - rmHWImg = Gtk.Image() - rmHWImg.set_from_stock(Gtk.STOCK_REMOVE, Gtk.IconSize.MENU) - rmHW.set_image(rmHWImg) + rmHW = Gtk.MenuItem.new_with_mnemonic(_("_Remove Hardware")) rmHW.show() def _remove_clicked_cb(*args, **kwargs): self._config_remove() diff --git a/virtManager/details/serialcon.py b/virtManager/details/serialcon.py index fbd0ff4f..42dbc78d 100644 --- a/virtManager/details/serialcon.py +++ b/virtManager/details/serialcon.py @@ -248,13 +248,11 @@ class vmmSerialConsole(vmmGObject): self._serial_popup = Gtk.Menu() self._serial_popup.get_accessible().set_name("serial-popup-menu") - self._serial_copy = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_COPY, - None) + self._serial_copy = Gtk.MenuItem.new_with_mnemonic(_("_Copy")) self._serial_copy.connect("activate", self._serial_copy_text) self._serial_popup.add(self._serial_copy) - self._serial_paste = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_PASTE, - None) + self._serial_paste = Gtk.MenuItem.new_with_mnemonic(_("_Paste")) self._serial_paste.connect("activate", self._serial_paste_text) self._serial_popup.add(self._serial_paste) diff --git a/virtManager/details/snapshots.py b/virtManager/details/snapshots.py index 83c06768..2665b4b5 100644 --- a/virtManager/details/snapshots.py +++ b/virtManager/details/snapshots.py @@ -358,7 +358,7 @@ class vmmSnapshotPage(vmmGObjectUI): img = Gtk.CellRendererPixbuf() img.set_property("stock-size", Gtk.IconSize.MENU) - img.set_property("icon-name", Gtk.STOCK_APPLY) + img.set_property("icon-name", "emblem-default") img.set_property("xalign", 0.0) col.pack_start(img, False) col.add_attribute(img, "visible", 5) @@ -375,20 +375,12 @@ class vmmSnapshotPage(vmmGObjectUI): # Snapshot popup menu menu = Gtk.Menu() - item = Gtk.ImageMenuItem.new_with_label(_("_Start snapshot")) - item.set_use_underline(True) - img = Gtk.Image() - img.set_from_stock(Gtk.STOCK_MEDIA_PLAY, Gtk.IconSize.MENU) - item.set_image(img) + item = Gtk.MenuItem.new_with_mnemonic(_("_Start snapshot")) item.show() item.connect("activate", self._on_start_clicked) menu.add(item) - item = Gtk.ImageMenuItem.new_with_label(_("_Delete snapshot")) - item.set_use_underline(True) - img = Gtk.Image() - img.set_from_stock(Gtk.STOCK_DELETE, Gtk.IconSize.MENU) - item.set_image(img) + item = Gtk.MenuItem.new_with_mnemonic(_("_Delete snapshot")) item.show() item.connect("activate", self._on_delete_clicked) menu.add(item) diff --git a/virtManager/hostnets.py b/virtManager/hostnets.py index c12a2983..21c22169 100644 --- a/virtManager/hostnets.py +++ b/virtManager/hostnets.py @@ -201,10 +201,6 @@ class vmmHostNets(vmmGObjectUI): if not netstr: return - forward = net.get_ipv4_forward_mode() - self.widget("net-ipv4-forwarding-icon").set_from_stock( - forward and Gtk.STOCK_CONNECT or Gtk.STOCK_DISCONNECT, - Gtk.IconSize.MENU) self.widget("net-ipv4-forwarding").set_text(net.pretty_forward_mode()) dhcpstr = _("Disabled") @@ -217,9 +213,6 @@ class vmmHostNets(vmmGObjectUI): (netstr, (dhcpstart, dhcpend)) = net.get_ipv6_network() self.widget("net-ipv6-expander").set_visible(bool(netstr)) - self.widget("net-ipv6-forwarding-icon").set_from_stock( - netstr and Gtk.STOCK_CONNECT or Gtk.STOCK_DISCONNECT, - Gtk.IconSize.MENU) if netstr: prettymode = _("Routed network") diff --git a/virtManager/hoststorage.py b/virtManager/hoststorage.py index b1b7cf6b..594c6587 100644 --- a/virtManager/hoststorage.py +++ b/virtManager/hoststorage.py @@ -175,10 +175,7 @@ class vmmHostStorage(vmmGObjectUI): # Volume list popup menu self._volmenu = Gtk.Menu() - volCopyPath = Gtk.ImageMenuItem.new_with_label(_("Copy Volume Path")) - volCopyImage = Gtk.Image() - volCopyImage.set_from_stock(Gtk.STOCK_COPY, Gtk.IconSize.MENU) - volCopyPath.set_image(volCopyImage) + volCopyPath = Gtk.MenuItem.new_with_mnemonic(_("Copy Volume Path")) volCopyPath.show() volCopyPath.connect("activate", self._vol_copy_path_cb) self._volmenu.add(volCopyPath) diff --git a/virtManager/manager.py b/virtManager/manager.py index c683f2bb..aa3d6023 100644 --- a/virtManager/manager.py +++ b/virtManager/manager.py @@ -281,10 +281,7 @@ class vmmManager(vmmGObjectUI): def init_context_menus(self): def add_to_menu(idx, text, cb): - if text[0:3] == 'gtk': - item = Gtk.ImageMenuItem.new_from_stock(text, None) - else: - item = Gtk.ImageMenuItem.new_with_mnemonic(text) + item = Gtk.MenuItem.new_with_mnemonic(text) if cb: item.connect("activate", cb) item.get_accessible().set_name("conn-%s" % idx) @@ -292,14 +289,13 @@ class vmmManager(vmmGObjectUI): self.connmenu_items[idx] = item # Build connection context menu - add_to_menu("create", Gtk.STOCK_NEW, self.new_vm) - add_to_menu("connect", Gtk.STOCK_CONNECT, self.open_conn) - add_to_menu("disconnect", Gtk.STOCK_DISCONNECT, - self.close_conn) + add_to_menu("create", _("_New"), self.new_vm) + add_to_menu("connect", _("_Connect"), self.open_conn) + add_to_menu("disconnect", _("Dis_connect"), self.close_conn) self.connmenu.add(Gtk.SeparatorMenuItem()) - add_to_menu("delete", Gtk.STOCK_DELETE, self.do_delete) + add_to_menu("delete", _("De_lete"), self.do_delete) self.connmenu.add(Gtk.SeparatorMenuItem()) - add_to_menu("details", _("D_etails"), self.show_host) + add_to_menu("details", _("_Details"), self.show_host) self.connmenu.show_all() def init_vmlist(self): diff --git a/virtManager/object/network.py b/virtManager/object/network.py index da31c00a..d9fb91a1 100644 --- a/virtManager/object/network.py +++ b/virtManager/object/network.py @@ -109,8 +109,6 @@ class vmmNetwork(vmmLibvirtObject): return self.get_xmlobj().domain_name def get_ipv6_enabled(self): return self.get_xmlobj().ipv6 - def get_ipv4_forward_mode(self): - return self.get_xmlobj().forward.mode def _get_network(self, family): dhcpstart = None diff --git a/virtManager/vmmenu.py b/virtManager/vmmenu.py index e239b7d8..5a99985f 100644 --- a/virtManager/vmmenu.py +++ b/virtManager/vmmenu.py @@ -24,20 +24,8 @@ class _VMMenu(Gtk.Menu): self._init_state() - def _add_action(self, label, widgetname, cb, - iconname="system-shutdown"): - if label.startswith("gtk-"): - item = Gtk.ImageMenuItem.new_from_stock(label, None) - else: - item = Gtk.ImageMenuItem.new_with_mnemonic(label) - - if iconname: - if iconname.startswith("gtk-"): - icon = Gtk.Image.new_from_stock(iconname, Gtk.IconSize.MENU) - else: - icon = Gtk.Image.new_from_icon_name(iconname, - Gtk.IconSize.MENU) - item.set_image(icon) + def _add_action(self, label, widgetname, cb): + item = Gtk.MenuItem.new_with_mnemonic(label) item.vmm_widget_name = widgetname if cb: @@ -66,8 +54,7 @@ class VMShutdownMenu(_VMMenu): self._add_action(_("F_orce Reset"), "reset", VMActionUI.reset) self._add_action(_("_Force Off"), "destroy", VMActionUI.destroy) self.add(Gtk.SeparatorMenuItem()) - self._add_action(_("Sa_ve"), "save", VMActionUI.save, - iconname=Gtk.STOCK_SAVE) + self._add_action(_("Sa_ve"), "save", VMActionUI.save) self.get_accessible().set_name("vmm-shutdown-menu") self.show_all() @@ -92,27 +79,20 @@ class VMActionMenu(_VMMenu): VM submenu for run, pause, shutdown, clone, etc """ def _init_state(self): - self._add_action(_("_Run"), "run", VMActionUI.run, - iconname=Gtk.STOCK_MEDIA_PLAY) - self._add_action(_("_Pause"), "suspend", VMActionUI.suspend, - Gtk.STOCK_MEDIA_PAUSE) - self._add_action(_("R_esume"), "resume", VMActionUI.resume, - Gtk.STOCK_MEDIA_PAUSE) + self._add_action(_("_Run"), "run", VMActionUI.run) + self._add_action(_("_Pause"), "suspend", VMActionUI.suspend) + self._add_action(_("R_esume"), "resume", VMActionUI.resume) s = self._add_action(_("_Shut Down"), "shutdown", None) s.set_submenu(VMShutdownMenu(self._parent, self._current_vm_cb)) self.add(Gtk.SeparatorMenuItem()) - self._add_action(_("Clone..."), "clone", - VMActionUI.clone, iconname=None) - self._add_action(_("Migrate..."), "migrate", - VMActionUI.migrate, iconname=None) - self._add_action(_("_Delete"), "delete", - VMActionUI.delete, iconname=Gtk.STOCK_DELETE) + self._add_action(_("Clone..."), "clone", VMActionUI.clone) + self._add_action(_("Migrate..."), "migrate", VMActionUI.migrate) + self._add_action(_("_Delete"), "delete", VMActionUI.delete) if self._show_open: self.add(Gtk.SeparatorMenuItem()) - self._add_action(Gtk.STOCK_OPEN, "show", - VMActionUI.show, iconname=None) + self._add_action(_("_Open"), "show", VMActionUI.show) self.get_accessible().set_name("vm-action-menu") self.show_all()