From bcc89c73dd0b29fdbb4913514c9bee2b49efc6c9 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Fri, 12 Oct 2018 16:07:38 +0100 Subject: [PATCH] [GTK3] Fix statusbar clicking issues --- deluge/ui/gtk3/common.py | 6 +++--- deluge/ui/gtk3/statusbar.py | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/deluge/ui/gtk3/common.py b/deluge/ui/gtk3/common.py index b7df7faab..24530dcab 100644 --- a/deluge/ui/gtk3/common.py +++ b/deluge/ui/gtk3/common.py @@ -109,7 +109,9 @@ def build_menu_radio_list( Menu: The menu radio """ menu = Menu() - group = None + # Create menuitem to prevent unwanted toggled callback when creating menu. + menuitem = RadioMenuItem() + group = menuitem.get_group() if pref_value > -1 and pref_value not in value_list: value_list.pop() @@ -120,8 +122,6 @@ def build_menu_radio_list( if suffix: item_text += ' ' + suffix menuitem = RadioMenuItem.new_with_label(group, item_text) - if not group: - group = menuitem.get_group() if pref_value and value == pref_value: menuitem.set_active(True) if callback: diff --git a/deluge/ui/gtk3/statusbar.py b/deluge/ui/gtk3/statusbar.py index b197c929c..cc650b9dc 100644 --- a/deluge/ui/gtk3/statusbar.py +++ b/deluge/ui/gtk3/statusbar.py @@ -521,7 +521,7 @@ class StatusBar(component.Component): set_value(value) def _on_download_item_clicked(self, widget, event): - menu = build_menu_radio_list( + self.menu = build_menu_radio_list( self.config['tray_download_speed_list'], self._on_set_download_speed, self.max_download_speed, @@ -529,15 +529,15 @@ class StatusBar(component.Component): show_notset=True, show_other=True, ) - menu.show_all() - menu.popup(None, None, None, None, event.button, event.time) + self.menu.show_all() + self.menu.popup(None, None, None, None, event.button, event.time) def _on_set_download_speed(self, widget): log.debug('_on_set_download_speed') self.set_limit_value(widget, 'max_download_speed') def _on_upload_item_clicked(self, widget, event): - menu = build_menu_radio_list( + self.menu = build_menu_radio_list( self.config['tray_upload_speed_list'], self._on_set_upload_speed, self.max_upload_speed, @@ -545,36 +545,36 @@ class StatusBar(component.Component): show_notset=True, show_other=True, ) - menu.show_all() - menu.popup(None, None, None, None, event.button, event.time) + self.menu.show_all() + self.menu.popup(None, None, None, None, event.button, event.time) def _on_set_upload_speed(self, widget): log.debug('_on_set_upload_speed') self.set_limit_value(widget, 'max_upload_speed') def _on_connection_item_clicked(self, widget, event): - menu = build_menu_radio_list( + self.menu = build_menu_radio_list( self.config['connection_limit_list'], self._on_set_connection_limit, self.max_connections_global, show_notset=True, show_other=True, ) - menu.show_all() - menu.popup(None, None, None, None, event.button, event.time) + self.menu.show_all() + self.menu.popup(None, None, None, None, event.button, event.time) def _on_set_connection_limit(self, widget): log.debug('_on_set_connection_limit') self.set_limit_value(widget, 'max_connections_global') def _on_health_icon_clicked(self, widget, event): - component.get('Preferences').show('Network') + component.get('Preferences').show('network') def _on_notconnected_item_clicked(self, widget, event): component.get('ConnectionManager').show() def _on_traffic_item_clicked(self, widget, event): - component.get('Preferences').show('Network') + component.get('Preferences').show('network') def _on_diskspace_item_clicked(self, widget, event): - component.get('Preferences').show('Downloads') + component.get('Preferences').show('downloads')