Changed the show/hide window option in the tray menu to a CheckMenuItem

and have it toggle accordingly.
This commit is contained in:
Andrew Resch 2007-06-26 06:15:00 +00:00
parent c5fc69fa2e
commit 4fb4fb32f7
2 changed files with 14 additions and 9 deletions

View file

@ -42,12 +42,12 @@
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="show_hide_window">
<widget class="GtkCheckMenuItem" id="show_hide_window">
<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/Hide Window</property>
<property name="label" translatable="yes">_Show Deluge</property>
<property name="use_underline">True</property>
<signal name="activate" handler="show_hide_window"/>
<signal name="activate" handler="show_hide_window_toggled"/>
</widget>
</child>
<child>

View file

@ -166,7 +166,7 @@ class DelugeGTK:
"preferences": self.show_pref_dialog,
"add_torrent": self.add_torrent_clicked,
"clear_finished": self.clear_finished,
"show_hide_window": self.force_show_hide,
"show_hide_window_toggled": self.show_hide_window_toggled
})
self.tray_glade.get_widget("download-limit-image").set_from_file(common.get_pixmap('downloading22.png'))
@ -177,6 +177,11 @@ class DelugeGTK:
self.tray_icon.connect("popup-menu", self.tray_popup)
def tray_popup(self, status_icon, button, activate_time):
if self.window.get_property("visible"):
self.tray_glade.get_widget("show_hide_window").set_active(True)
else:
self.tray_glade.get_widget("show_hide_window").set_active(False)
self.tray_menu.popup(None, None, gtk.status_icon_position_menu,
button, activate_time, status_icon)
@ -357,14 +362,14 @@ class DelugeGTK:
self.load_window_geometry()
self.window.show()
def force_show_hide(self, arg=None):
if self.window.get_property("visible"):
self.window.hide()
else:
if self.config.get("lock_tray") == True:
def show_hide_window_toggled(self, widget):
if widget.get_active() and not self.window.get_property("visible"):
if self.config.get("lock_tray") == True:
self.unlock_tray("mainwinshow")
else:
self.window.show()
elif not widget.get_active() and self.window.get_property("visible"):
self.window.hide()
def build_torrent_table(self):
## Create the torrent listview