Moved system tray to GtkBuilder.
This commit is contained in:
parent
0e00aa479b
commit
a384cd70b3
|
@ -1,154 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
|
||||||
<!--*- mode: xml -*-->
|
|
||||||
<glade-interface>
|
|
||||||
<widget class="GtkMenu" id="tray_menu">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkCheckMenuItem" id="menuitem_show_deluge">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">_Show Deluge</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<signal name="activate" handler="on_menuitem_show_deluge_activate"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkSeparatorMenuItem" id="separatormenuitem1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImageMenuItem" id="menuitem_add_torrent">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">_Add Torrent</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<signal name="activate" handler="on_menuitem_add_torrent_activate"/>
|
|
||||||
<child internal-child="image">
|
|
||||||
<widget class="GtkImage" id="menu-item-image1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="stock">gtk-add</property>
|
|
||||||
<property name="icon_size">1</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkSeparatorMenuItem" id="separatormenuitem2">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImageMenuItem" id="menuitem_pause_all">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">_Pause All</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<signal name="activate" handler="on_menuitem_pause_all_activate"/>
|
|
||||||
<child internal-child="image">
|
|
||||||
<widget class="GtkImage" id="menu-item-image6">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="stock">gtk-media-pause</property>
|
|
||||||
<property name="icon_size">1</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImageMenuItem" id="menuitem_resume_all">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">_Resume All</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<signal name="activate" handler="on_menuitem_resume_all_activate"/>
|
|
||||||
<child internal-child="image">
|
|
||||||
<widget class="GtkImage" id="menu-item-image7">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="stock">gtk-media-play</property>
|
|
||||||
<property name="icon_size">1</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkSeparatorMenuItem" id="separatormenuitem3">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImageMenuItem" id="menuitem_download_limit">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">_Download Speed Limit</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<child internal-child="image">
|
|
||||||
<widget class="GtkImage" id="download-limit-image">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="stock">gtk-go-down</property>
|
|
||||||
<property name="icon_size">1</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImageMenuItem" id="menuitem_upload_limit">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">_Upload Speed Limit</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<child internal-child="image">
|
|
||||||
<widget class="GtkImage" id="upload-limit-image">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="stock">gtk-go-up</property>
|
|
||||||
<property name="icon_size">1</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkSeparatorMenuItem" id="separatormenuitem4">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImageMenuItem" id="menuitem_quitdaemon">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">Quit & Shutdown Daemon</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="use_stock">False</property>
|
|
||||||
<signal name="activate" handler="on_menuitem_quitdaemon_activate"/>
|
|
||||||
<child internal-child="image">
|
|
||||||
<widget class="GtkImage" id="menu-item-image8">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="stock">gtk-quit</property>
|
|
||||||
<property name="icon_size">1</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkSeparatorMenuItem" id="separatormenuitem5">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImageMenuItem" id="menuitem_quit">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="no">gtk-quit</property>
|
|
||||||
<property name="use_stock">True</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<signal name="activate" handler="on_menuitem_quit_activate"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</glade-interface>
|
|
|
@ -0,0 +1,183 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<interface>
|
||||||
|
<requires lib="gtk+" version="2.16"/>
|
||||||
|
<!-- interface-naming-policy toplevel-contextual -->
|
||||||
|
<object class="GtkAccelGroup" id="accelgroup1"/>
|
||||||
|
<object class="GtkImage" id="download-limit-image">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="stock">gtk-go-down</property>
|
||||||
|
<property name="icon-size">1</property>
|
||||||
|
</object>
|
||||||
|
<object class="GtkImage" id="menu-item-image1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="stock">gtk-add</property>
|
||||||
|
<property name="icon-size">1</property>
|
||||||
|
</object>
|
||||||
|
<object class="GtkImage" id="menu-item-image6">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="stock">gtk-media-pause</property>
|
||||||
|
<property name="icon-size">1</property>
|
||||||
|
</object>
|
||||||
|
<object class="GtkImage" id="menu-item-image7">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="stock">gtk-media-play</property>
|
||||||
|
<property name="icon-size">1</property>
|
||||||
|
</object>
|
||||||
|
<object class="GtkImage" id="menu-item-image8">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="stock">gtk-quit</property>
|
||||||
|
<property name="icon-size">1</property>
|
||||||
|
</object>
|
||||||
|
<object class="GtkMenu" id="tray_menu">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckMenuItem" id="menuitem_show_deluge">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
|
<property name="label" translatable="yes">_Show Deluge</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<signal name="activate" handler="on_menuitem_show_deluge_activate" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparatorMenuItem" id="separatormenuitem1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImageMenuItem" id="menuitem_add_torrent">
|
||||||
|
<property name="label" translatable="yes">_Add Torrent</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="image">menu-item-image1</property>
|
||||||
|
<property name="use_stock">False</property>
|
||||||
|
<signal name="activate" handler="on_menuitem_add_torrent_activate" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparatorMenuItem" id="separatormenuitem2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImageMenuItem" id="menuitem_pause_all">
|
||||||
|
<property name="label" translatable="yes">_Pause All</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="image">menu-item-image6</property>
|
||||||
|
<property name="use_stock">False</property>
|
||||||
|
<signal name="activate" handler="on_menuitem_pause_all_activate" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImageMenuItem" id="menuitem_resume_all">
|
||||||
|
<property name="label" translatable="yes">_Resume All</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="image">menu-item-image7</property>
|
||||||
|
<property name="use_stock">False</property>
|
||||||
|
<signal name="activate" handler="on_menuitem_resume_all_activate" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparatorMenuItem" id="separatormenuitem3">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImageMenuItem" id="menuitem_download_limit">
|
||||||
|
<property name="label" translatable="yes">_Download Speed Limit</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="image">download-limit-image</property>
|
||||||
|
<property name="use_stock">False</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImageMenuItem" id="menuitem_upload_limit">
|
||||||
|
<property name="label" translatable="yes">_Upload Speed Limit</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="image">upload-limit-image</property>
|
||||||
|
<property name="use_stock">False</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparatorMenuItem" id="separatormenuitem4">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImageMenuItem" id="menuitem_quitdaemon">
|
||||||
|
<property name="label" translatable="yes">Quit & Shutdown Daemon</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="image">menu-item-image8</property>
|
||||||
|
<property name="use_stock">False</property>
|
||||||
|
<signal name="activate" handler="on_menuitem_quitdaemon_activate" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparatorMenuItem" id="separatormenuitem5">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImageMenuItem" id="menuitem_quit">
|
||||||
|
<property name="label">gtk-quit</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
<property name="accel_group">accelgroup1</property>
|
||||||
|
<signal name="activate" handler="on_menuitem_quit_activate" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<object class="GtkImage" id="upload-limit-image">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="stock">gtk-go-up</property>
|
||||||
|
<property name="icon-size">1</property>
|
||||||
|
</object>
|
||||||
|
</interface>
|
|
@ -87,11 +87,12 @@ class SystemTray(component.Component):
|
||||||
|
|
||||||
def enable(self):
|
def enable(self):
|
||||||
"""Enables the system tray icon."""
|
"""Enables the system tray icon."""
|
||||||
self.tray_glade = gtk.glade.XML(deluge.common.resource_filename(
|
self.builder = gtk.Builder()
|
||||||
"deluge.ui.gtkui", os.path.join("glade", "tray_menu.glade"))
|
self.builder.add_from_file(deluge.common.resource_filename(
|
||||||
|
"deluge.ui.gtkui", os.path.join("glade", "tray_menu.ui"))
|
||||||
)
|
)
|
||||||
|
|
||||||
self.tray_glade.signal_autoconnect({
|
self.builder.connect_signals({
|
||||||
"on_menuitem_show_deluge_activate": \
|
"on_menuitem_show_deluge_activate": \
|
||||||
self.on_menuitem_show_deluge_activate,
|
self.on_menuitem_show_deluge_activate,
|
||||||
"on_menuitem_add_torrent_activate": \
|
"on_menuitem_add_torrent_activate": \
|
||||||
|
@ -105,7 +106,7 @@ class SystemTray(component.Component):
|
||||||
self.on_menuitem_quitdaemon_activate
|
self.on_menuitem_quitdaemon_activate
|
||||||
})
|
})
|
||||||
|
|
||||||
self.tray_menu = self.tray_glade.get_widget("tray_menu")
|
self.tray_menu = self.builder.get_object("tray_menu")
|
||||||
|
|
||||||
if appindicator and self.config["enable_appindicator"]:
|
if appindicator and self.config["enable_appindicator"]:
|
||||||
log.debug("Enabling the Application Indicator..")
|
log.debug("Enabling the Application Indicator..")
|
||||||
|
@ -118,9 +119,9 @@ class SystemTray(component.Component):
|
||||||
self._sig_win_hide = self.window.window.connect("hide", self._on_window_hide)
|
self._sig_win_hide = self.window.window.connect("hide", self._on_window_hide)
|
||||||
self._sig_win_show = self.window.window.connect("show", self._on_window_show)
|
self._sig_win_show = self.window.window.connect("show", self._on_window_show)
|
||||||
if self.window.visible():
|
if self.window.visible():
|
||||||
self.tray_glade.get_widget("menuitem_show_deluge").set_active(True)
|
self.builder.get_object("menuitem_show_deluge").set_active(True)
|
||||||
else:
|
else:
|
||||||
self.tray_glade.get_widget("menuitem_show_deluge").set_active(False)
|
self.builder.get_object("menuitem_show_deluge").set_active(False)
|
||||||
|
|
||||||
# Show the Application Indicator
|
# Show the Application Indicator
|
||||||
self.indicator.set_status(appindicator.STATUS_ACTIVE)
|
self.indicator.set_status(appindicator.STATUS_ACTIVE)
|
||||||
|
@ -141,9 +142,9 @@ class SystemTray(component.Component):
|
||||||
self.tray.connect("popup-menu", self.on_tray_popup)
|
self.tray.connect("popup-menu", self.on_tray_popup)
|
||||||
|
|
||||||
# For some reason these icons do not display in appindicator
|
# For some reason these icons do not display in appindicator
|
||||||
self.tray_glade.get_widget("download-limit-image").set_from_file(
|
self.builder.get_object("download-limit-image").set_from_file(
|
||||||
deluge.common.get_pixmap("downloading16.png"))
|
deluge.common.get_pixmap("downloading16.png"))
|
||||||
self.tray_glade.get_widget("upload-limit-image").set_from_file(
|
self.builder.get_object("upload-limit-image").set_from_file(
|
||||||
deluge.common.get_pixmap("seeding16.png"))
|
deluge.common.get_pixmap("seeding16.png"))
|
||||||
|
|
||||||
client.register_event_handler("ConfigValueChangedEvent", self.config_value_changed)
|
client.register_event_handler("ConfigValueChangedEvent", self.config_value_changed)
|
||||||
|
@ -153,7 +154,7 @@ class SystemTray(component.Component):
|
||||||
else:
|
else:
|
||||||
# Hide menu widgets because we're not connected to a host.
|
# Hide menu widgets because we're not connected to a host.
|
||||||
for widget in self.hide_widget_list:
|
for widget in self.hide_widget_list:
|
||||||
self.tray_glade.get_widget(widget).hide()
|
self.builder.get_object(widget).hide()
|
||||||
|
|
||||||
def __start(self):
|
def __start(self):
|
||||||
if self.config["enable_system_tray"]:
|
if self.config["enable_system_tray"]:
|
||||||
|
@ -161,8 +162,8 @@ class SystemTray(component.Component):
|
||||||
if self.config["classic_mode"]:
|
if self.config["classic_mode"]:
|
||||||
self.hide_widget_list.remove("menuitem_quitdaemon")
|
self.hide_widget_list.remove("menuitem_quitdaemon")
|
||||||
self.hide_widget_list.remove("separatormenuitem4")
|
self.hide_widget_list.remove("separatormenuitem4")
|
||||||
self.tray_glade.get_widget("menuitem_quitdaemon").hide()
|
self.builder.get_object("menuitem_quitdaemon").hide()
|
||||||
self.tray_glade.get_widget("separatormenuitem4").hide()
|
self.builder.get_object("separatormenuitem4").hide()
|
||||||
|
|
||||||
# These do not work with appindicator currently and can crash Deluge.
|
# These do not work with appindicator currently and can crash Deluge.
|
||||||
# Related to Launchpad bug #608219
|
# Related to Launchpad bug #608219
|
||||||
|
@ -170,13 +171,13 @@ class SystemTray(component.Component):
|
||||||
self.hide_widget_list.remove("menuitem_download_limit")
|
self.hide_widget_list.remove("menuitem_download_limit")
|
||||||
self.hide_widget_list.remove("menuitem_upload_limit")
|
self.hide_widget_list.remove("menuitem_upload_limit")
|
||||||
self.hide_widget_list.remove("separatormenuitem3")
|
self.hide_widget_list.remove("separatormenuitem3")
|
||||||
self.tray_glade.get_widget("menuitem_download_limit").hide()
|
self.builder.get_object("menuitem_download_limit").hide()
|
||||||
self.tray_glade.get_widget("menuitem_upload_limit").hide()
|
self.builder.get_object("menuitem_upload_limit").hide()
|
||||||
self.tray_glade.get_widget("separatormenuitem3").hide()
|
self.builder.get_object("separatormenuitem3").hide()
|
||||||
|
|
||||||
# Show widgets in the hide list because we've connected to a host
|
# Show widgets in the hide list because we've connected to a host
|
||||||
for widget in self.hide_widget_list:
|
for widget in self.hide_widget_list:
|
||||||
self.tray_glade.get_widget(widget).show()
|
self.builder.get_object(widget).show()
|
||||||
|
|
||||||
# Build the bandwidth speed limit menus
|
# Build the bandwidth speed limit menus
|
||||||
self.build_tray_bwsetsubmenu()
|
self.build_tray_bwsetsubmenu()
|
||||||
|
@ -196,7 +197,7 @@ class SystemTray(component.Component):
|
||||||
try:
|
try:
|
||||||
# Hide widgets in hide list because we're not connected to a host
|
# Hide widgets in hide list because we're not connected to a host
|
||||||
for widget in self.hide_widget_list:
|
for widget in self.hide_widget_list:
|
||||||
self.tray_glade.get_widget(widget).hide()
|
self.builder.get_object(widget).hide()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log.debug("Unable to hide system tray menu widgets: %s", e)
|
log.debug("Unable to hide system tray menu widgets: %s", e)
|
||||||
|
|
||||||
|
@ -279,9 +280,9 @@ class SystemTray(component.Component):
|
||||||
_("KiB/s"), show_notset=True, show_other=True)
|
_("KiB/s"), show_notset=True, show_other=True)
|
||||||
|
|
||||||
# Add the sub-menus to the tray menu
|
# Add the sub-menus to the tray menu
|
||||||
self.tray_glade.get_widget("menuitem_download_limit").set_submenu(
|
self.builder.get_object("menuitem_download_limit").set_submenu(
|
||||||
submenu_bwdownset)
|
submenu_bwdownset)
|
||||||
self.tray_glade.get_widget("menuitem_upload_limit").set_submenu(
|
self.builder.get_object("menuitem_upload_limit").set_submenu(
|
||||||
submenu_bwupset)
|
submenu_bwupset)
|
||||||
|
|
||||||
# Show the sub-menus for all to see
|
# Show the sub-menus for all to see
|
||||||
|
@ -311,7 +312,7 @@ class SystemTray(component.Component):
|
||||||
log.debug("Disabling the system tray icon..")
|
log.debug("Disabling the system tray icon..")
|
||||||
self.tray.set_visible(False)
|
self.tray.set_visible(False)
|
||||||
del self.tray
|
del self.tray
|
||||||
del self.tray_glade
|
del self.builder
|
||||||
del self.tray_menu
|
del self.tray_menu
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log.debug("Unable to disable system tray: %s", e)
|
log.debug("Unable to disable system tray: %s", e)
|
||||||
|
@ -355,9 +356,9 @@ class SystemTray(component.Component):
|
||||||
self.blink(False)
|
self.blink(False)
|
||||||
|
|
||||||
if self.window.visible():
|
if self.window.visible():
|
||||||
self.tray_glade.get_widget("menuitem_show_deluge").set_active(True)
|
self.builder.get_object("menuitem_show_deluge").set_active(True)
|
||||||
else:
|
else:
|
||||||
self.tray_glade.get_widget("menuitem_show_deluge").set_active(False)
|
self.builder.get_object("menuitem_show_deluge").set_active(False)
|
||||||
|
|
||||||
popup_function = gtk.status_icon_position_menu
|
popup_function = gtk.status_icon_position_menu
|
||||||
if deluge.common.windows_check():
|
if deluge.common.windows_check():
|
||||||
|
@ -408,12 +409,12 @@ class SystemTray(component.Component):
|
||||||
def _on_window_hide(self, widget, data=None):
|
def _on_window_hide(self, widget, data=None):
|
||||||
"""_on_window_hide - update the menuitem's status"""
|
"""_on_window_hide - update the menuitem's status"""
|
||||||
log.debug("_on_window_hide")
|
log.debug("_on_window_hide")
|
||||||
self.tray_glade.get_widget("menuitem_show_deluge").set_active(False)
|
self.builder.get_object("menuitem_show_deluge").set_active(False)
|
||||||
|
|
||||||
def _on_window_show(self, widget, data=None):
|
def _on_window_show(self, widget, data=None):
|
||||||
"""_on_window_show - update the menuitem's status"""
|
"""_on_window_show - update the menuitem's status"""
|
||||||
log.debug("_on_window_show")
|
log.debug("_on_window_show")
|
||||||
self.tray_glade.get_widget("menuitem_show_deluge").set_active(True)
|
self.builder.get_object("menuitem_show_deluge").set_active(True)
|
||||||
|
|
||||||
def tray_setbwup(self, widget, data=None):
|
def tray_setbwup(self, widget, data=None):
|
||||||
self.setbwlimit(widget, _("Set Maximum Upload Speed"), "max_upload_speed",
|
self.setbwlimit(widget, _("Set Maximum Upload Speed"), "max_upload_speed",
|
||||||
|
|
Loading…
Reference in New Issue