[GTK3] Fix statusbar clicking issues
This commit is contained in:
parent
a6b47e18c9
commit
bcc89c73dd
|
@ -109,7 +109,9 @@ def build_menu_radio_list(
|
||||||
Menu: The menu radio
|
Menu: The menu radio
|
||||||
"""
|
"""
|
||||||
menu = Menu()
|
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:
|
if pref_value > -1 and pref_value not in value_list:
|
||||||
value_list.pop()
|
value_list.pop()
|
||||||
|
@ -120,8 +122,6 @@ def build_menu_radio_list(
|
||||||
if suffix:
|
if suffix:
|
||||||
item_text += ' ' + suffix
|
item_text += ' ' + suffix
|
||||||
menuitem = RadioMenuItem.new_with_label(group, item_text)
|
menuitem = RadioMenuItem.new_with_label(group, item_text)
|
||||||
if not group:
|
|
||||||
group = menuitem.get_group()
|
|
||||||
if pref_value and value == pref_value:
|
if pref_value and value == pref_value:
|
||||||
menuitem.set_active(True)
|
menuitem.set_active(True)
|
||||||
if callback:
|
if callback:
|
||||||
|
|
|
@ -521,7 +521,7 @@ class StatusBar(component.Component):
|
||||||
set_value(value)
|
set_value(value)
|
||||||
|
|
||||||
def _on_download_item_clicked(self, widget, event):
|
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.config['tray_download_speed_list'],
|
||||||
self._on_set_download_speed,
|
self._on_set_download_speed,
|
||||||
self.max_download_speed,
|
self.max_download_speed,
|
||||||
|
@ -529,15 +529,15 @@ class StatusBar(component.Component):
|
||||||
show_notset=True,
|
show_notset=True,
|
||||||
show_other=True,
|
show_other=True,
|
||||||
)
|
)
|
||||||
menu.show_all()
|
self.menu.show_all()
|
||||||
menu.popup(None, None, None, None, event.button, event.time)
|
self.menu.popup(None, None, None, None, event.button, event.time)
|
||||||
|
|
||||||
def _on_set_download_speed(self, widget):
|
def _on_set_download_speed(self, widget):
|
||||||
log.debug('_on_set_download_speed')
|
log.debug('_on_set_download_speed')
|
||||||
self.set_limit_value(widget, 'max_download_speed')
|
self.set_limit_value(widget, 'max_download_speed')
|
||||||
|
|
||||||
def _on_upload_item_clicked(self, widget, event):
|
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.config['tray_upload_speed_list'],
|
||||||
self._on_set_upload_speed,
|
self._on_set_upload_speed,
|
||||||
self.max_upload_speed,
|
self.max_upload_speed,
|
||||||
|
@ -545,36 +545,36 @@ class StatusBar(component.Component):
|
||||||
show_notset=True,
|
show_notset=True,
|
||||||
show_other=True,
|
show_other=True,
|
||||||
)
|
)
|
||||||
menu.show_all()
|
self.menu.show_all()
|
||||||
menu.popup(None, None, None, None, event.button, event.time)
|
self.menu.popup(None, None, None, None, event.button, event.time)
|
||||||
|
|
||||||
def _on_set_upload_speed(self, widget):
|
def _on_set_upload_speed(self, widget):
|
||||||
log.debug('_on_set_upload_speed')
|
log.debug('_on_set_upload_speed')
|
||||||
self.set_limit_value(widget, 'max_upload_speed')
|
self.set_limit_value(widget, 'max_upload_speed')
|
||||||
|
|
||||||
def _on_connection_item_clicked(self, widget, event):
|
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.config['connection_limit_list'],
|
||||||
self._on_set_connection_limit,
|
self._on_set_connection_limit,
|
||||||
self.max_connections_global,
|
self.max_connections_global,
|
||||||
show_notset=True,
|
show_notset=True,
|
||||||
show_other=True,
|
show_other=True,
|
||||||
)
|
)
|
||||||
menu.show_all()
|
self.menu.show_all()
|
||||||
menu.popup(None, None, None, None, event.button, event.time)
|
self.menu.popup(None, None, None, None, event.button, event.time)
|
||||||
|
|
||||||
def _on_set_connection_limit(self, widget):
|
def _on_set_connection_limit(self, widget):
|
||||||
log.debug('_on_set_connection_limit')
|
log.debug('_on_set_connection_limit')
|
||||||
self.set_limit_value(widget, 'max_connections_global')
|
self.set_limit_value(widget, 'max_connections_global')
|
||||||
|
|
||||||
def _on_health_icon_clicked(self, widget, event):
|
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):
|
def _on_notconnected_item_clicked(self, widget, event):
|
||||||
component.get('ConnectionManager').show()
|
component.get('ConnectionManager').show()
|
||||||
|
|
||||||
def _on_traffic_item_clicked(self, widget, event):
|
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):
|
def _on_diskspace_item_clicked(self, widget, event):
|
||||||
component.get('Preferences').show('Downloads')
|
component.get('Preferences').show('downloads')
|
||||||
|
|
Loading…
Reference in New Issue