mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
Fix deprecation warnings on F21/rawhide
This commit is contained in:
parent
ce64d037bf
commit
99eaf059ae
@ -1662,7 +1662,7 @@ class vmmConsolePages(vmmGObjectUI):
|
||||
if group is None:
|
||||
group = item
|
||||
else:
|
||||
item = Gtk.MenuItem(msg)
|
||||
item = Gtk.MenuItem.new_with_label(msg)
|
||||
|
||||
item.set_sensitive(sensitive)
|
||||
|
||||
@ -1685,7 +1685,8 @@ class vmmConsolePages(vmmGObjectUI):
|
||||
# Populate graphical devices
|
||||
devs = self.vm.get_graphics_devices()
|
||||
if len(devs) == 0:
|
||||
item = Gtk.MenuItem(_("No graphical console available"))
|
||||
item = Gtk.MenuItem.new_with_label(
|
||||
_("No graphical console available"))
|
||||
item.set_sensitive(False)
|
||||
src.add(item)
|
||||
else:
|
||||
|
@ -783,7 +783,7 @@ class vmmDetails(vmmGObjectUI):
|
||||
# Add HW popup menu
|
||||
self.addhwmenu = Gtk.Menu()
|
||||
|
||||
addHW = Gtk.ImageMenuItem(_("_Add Hardware"))
|
||||
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)
|
||||
@ -791,7 +791,7 @@ class vmmDetails(vmmGObjectUI):
|
||||
addHW.show()
|
||||
addHW.connect("activate", self.add_hardware)
|
||||
|
||||
rmHW = Gtk.ImageMenuItem(_("_Remove Hardware"))
|
||||
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)
|
||||
|
@ -179,7 +179,7 @@ class vmmHost(vmmGObjectUI):
|
||||
self.widget("storage-pages").set_show_tabs(False)
|
||||
|
||||
self.volmenu = Gtk.Menu()
|
||||
volCopyPath = Gtk.ImageMenuItem(_("Copy Volume Path"))
|
||||
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)
|
||||
|
@ -154,7 +154,7 @@ class vmmSnapshotPage(vmmGObjectUI):
|
||||
# Snapshot popup menu
|
||||
menu = Gtk.Menu()
|
||||
|
||||
item = Gtk.ImageMenuItem(_("_Start snapshot"))
|
||||
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)
|
||||
@ -163,7 +163,7 @@ class vmmSnapshotPage(vmmGObjectUI):
|
||||
item.connect("activate", self._on_start_clicked)
|
||||
menu.add(item)
|
||||
|
||||
item = Gtk.ImageMenuItem(_("_Delete snapshot"))
|
||||
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)
|
||||
|
@ -35,18 +35,6 @@ except:
|
||||
AppIndicator3 = None
|
||||
|
||||
|
||||
def build_image_menu_item(label):
|
||||
hasfunc = hasattr(Gtk.ImageMenuItem, "set_use_underline")
|
||||
if hasfunc:
|
||||
label.replace("_", "__")
|
||||
|
||||
menu_item = Gtk.ImageMenuItem(label)
|
||||
if hasfunc:
|
||||
menu_item.set_use_underline(False)
|
||||
|
||||
return menu_item
|
||||
|
||||
|
||||
class vmmSystray(vmmGObject):
|
||||
__gsignals__ = {
|
||||
"action-toggle-manager": (GObject.SignalFlags.RUN_FIRST, None, []),
|
||||
@ -277,7 +265,7 @@ class vmmSystray(vmmGObject):
|
||||
vm_names.sort()
|
||||
|
||||
if len(vm_names) == 0:
|
||||
menu_item = Gtk.MenuItem(_("No virtual machines"))
|
||||
menu_item = Gtk.MenuItem.new_with_label(_("No virtual machines"))
|
||||
menu_item.set_sensitive(False)
|
||||
vm_submenu.insert(menu_item, 0)
|
||||
return
|
||||
@ -301,7 +289,9 @@ class vmmSystray(vmmGObject):
|
||||
return
|
||||
|
||||
# Build VM list entry
|
||||
menu_item = build_image_menu_item(vm.get_name())
|
||||
menu_item = Gtk.ImageMenuItem.new_with_label(vm.get_name())
|
||||
menu_item.set_use_underline(False)
|
||||
|
||||
vm_mappings[uuid] = menu_item
|
||||
vm_action_menu = vmmenu.VMActionMenu(self, lambda: vm)
|
||||
menu_item.set_submenu(vm_action_menu)
|
||||
@ -329,7 +319,8 @@ class vmmSystray(vmmGObject):
|
||||
del(vm_mappings[uuid])
|
||||
|
||||
if len(vm_menu.get_children()) == 0:
|
||||
placeholder = Gtk.MenuItem(_("No virtual machines"))
|
||||
placeholder = Gtk.MenuItem.new_with_label(
|
||||
_("No virtual machines"))
|
||||
placeholder.show()
|
||||
placeholder.set_sensitive(False)
|
||||
vm_menu.add(placeholder)
|
||||
|
Loading…
Reference in New Issue
Block a user