From bcaaeac8524a28d020db9267c9cbbdae47c48765 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Thu, 20 Sep 2018 14:54:44 +0100 Subject: [PATCH] [GTK3] Use explicitly named functions for creating menuitems See https://wiki.gnome.org/Projects/PyGObject/InitializerDeprecations --- deluge/ui/gtk3/common.py | 6 +++--- deluge/ui/gtk3/listview.py | 2 +- deluge/ui/gtk3/menubar.py | 18 +++++++++--------- deluge/ui/gtk3/path_combo_chooser.py | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/deluge/ui/gtk3/common.py b/deluge/ui/gtk3/common.py index ae26ac85f..d75193d29 100644 --- a/deluge/ui/gtk3/common.py +++ b/deluge/ui/gtk3/common.py @@ -119,7 +119,7 @@ def build_menu_radio_list( item_text = str(value) if suffix: item_text += ' ' + suffix - menuitem = RadioMenuItem(group=group, label=item_text) + menuitem = RadioMenuItem.new_with_label(group, item_text) group = menuitem if pref_value and value == pref_value: menuitem.set_active(True) @@ -128,7 +128,7 @@ def build_menu_radio_list( menu.append(menuitem) if show_notset: - menuitem = RadioMenuItem(group=group, label=notset_label) + menuitem = RadioMenuItem.new_with_label(group, notset_label) menuitem.set_name('unlimited') if pref_value and pref_value < notset_lessthan: menuitem.set_active(True) @@ -138,7 +138,7 @@ def build_menu_radio_list( if show_other: menuitem = SeparatorMenuItem() menu.append(menuitem) - menuitem = MenuItem(_('Other...')) + menuitem = MenuItem.new_with_label(_('Other...')) menuitem.set_name('other') menuitem.connect('activate', callback) menu.append(menuitem) diff --git a/deluge/ui/gtk3/listview.py b/deluge/ui/gtk3/listview.py index e4f8424fb..b6d50fccd 100644 --- a/deluge/ui/gtk3/listview.py +++ b/deluge/ui/gtk3/listview.py @@ -367,7 +367,7 @@ class ListView(object): # menu. if column.hidden is True: continue - menuitem = Gtk.CheckMenuItem(column.name) + menuitem = Gtk.CheckMenuItem.new_with_label(column.name) # If the column is currently visible, make sure it's set active # (or checked) in the menu. if column.column.get_visible() is True: diff --git a/deluge/ui/gtk3/menubar.py b/deluge/ui/gtk3/menubar.py index 84d00c82e..f2430bc90 100644 --- a/deluge/ui/gtk3/menubar.py +++ b/deluge/ui/gtk3/menubar.py @@ -76,11 +76,11 @@ class MenuBar(component.Component): 'menuitem_upload_slots', ): submenu = Gtk.Menu() - item = Gtk.MenuItem(_('Set Unlimited')) + item = Gtk.MenuItem.new_with_label(_('Set Unlimited')) item.set_name(menuitem) item.connect('activate', self.on_menuitem_set_unlimited) submenu.append(item) - item = Gtk.MenuItem(_('Other...')) + item = Gtk.MenuItem.new_with_label(_('Other...')) item.set_name(menuitem) item.connect('activate', self.on_menuitem_set_other) submenu.append(item) @@ -88,20 +88,20 @@ class MenuBar(component.Component): self.builder.get_object(menuitem).set_submenu(submenu) submenu = Gtk.Menu() - item = Gtk.MenuItem(_('On')) + item = Gtk.MenuItem.new_with_label(_('On')) item.connect('activate', self.on_menuitem_set_automanaged_on) submenu.append(item) - item = Gtk.MenuItem(_('Off')) + item = Gtk.MenuItem.new_with_label(_('Off')) item.connect('activate', self.on_menuitem_set_automanaged_off) submenu.append(item) submenu.show_all() self.builder.get_object('menuitem_auto_managed').set_submenu(submenu) submenu = Gtk.Menu() - item = Gtk.MenuItem(_('Disable')) + item = Gtk.MenuItem.new_with_label(_('Disable')) item.connect('activate', self.on_menuitem_set_stop_seed_at_ratio_disable) submenu.append(item) - item = Gtk.MenuItem(_('Enable...')) + item = Gtk.MenuItem.new_with_label(_('Enable...')) item.set_name('menuitem_stop_seed_at_ratio') item.connect('activate', self.on_menuitem_set_other) submenu.append(item) @@ -552,13 +552,13 @@ class MenuBar(component.Component): self.change_owner_submenu = Gtk.Menu() self.change_owner_submenu_items = {} - maingroup = Gtk.RadioMenuItem(None, None) + maingroup = Gtk.RadioMenuItem() - self.change_owner_submenu_items[None] = Gtk.RadioMenuItem(group=maingroup) + self.change_owner_submenu_items[None] = Gtk.RadioMenuItem(maingroup) for account in known_accounts: username = account['username'] - item = Gtk.RadioMenuItem(group=maingroup, label=username) + item = Gtk.RadioMenuItem.new_with_label(maingroup, username) self.change_owner_submenu_items[username] = item self.change_owner_submenu.append(item) item.connect('toggled', self._on_change_owner_toggled, username) diff --git a/deluge/ui/gtk3/path_combo_chooser.py b/deluge/ui/gtk3/path_combo_chooser.py index e92621774..f6f7b34ec 100755 --- a/deluge/ui/gtk3/path_combo_chooser.py +++ b/deluge/ui/gtk3/path_combo_chooser.py @@ -390,9 +390,9 @@ class StoredValuesList(ValueList): treeview.set_cursor(path, col, 0) self.path_list_popup = Gtk.Menu() - menuitem_edit = Gtk.MenuItem('Edit path') + menuitem_edit = Gtk.MenuItem.new_with_label('Edit path') self.path_list_popup.append(menuitem_edit) - menuitem_remove = Gtk.MenuItem('Remove path') + menuitem_remove = Gtk.MenuItem.new_with_label('Remove path') self.path_list_popup.append(menuitem_remove) def on_edit_clicked(widget, path):