From 9ec33795a90c9b9adfdab293dc6d0e4c9c399506 Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Tue, 19 Jun 2007 00:59:09 +0000 Subject: [PATCH] revert 664...i'll make the menu a glade file soon --- src/interface.py | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/interface.py b/src/interface.py index cf1f12fe2..d82ed6641 100644 --- a/src/interface.py +++ b/src/interface.py @@ -32,7 +32,8 @@ import sys, os, os.path, urllib import core, common, dgtk, ipc_manager, dialogs -import plugins, pref, pygtk +import plugins, pref +import pygtk pygtk.require('2.0') import gtk, gtk.glade, gobject import xdg, xdg.BaseDirectory @@ -158,11 +159,7 @@ class DelugeGTK: def build_tray_icon(self): self.tray_icon = gtk.status_icon_new_from_file(common.get_pixmap("deluge32.png")) self.tray_menu = gtk.Menu() - if self.window.get_property("visible"): - if self.window.is_active(): - item_show = gtk.MenuItem(_("Hide Window")) - else: - item_show = gtk.MenuItem(_("Show Window")) + item_show = gtk.MenuItem(_("Show / Hide Window")) item_add = gtk.ImageMenuItem(_("Add Torrent")) item_clear = gtk.ImageMenuItem(_("Clear Finished")) item_pref = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES) @@ -179,7 +176,7 @@ class DelugeGTK: item_pref.connect("activate", self.show_pref_dialog) item_plug.connect("activate", self.show_plugin_dialog) item_quit.connect("activate", self.quit) - + self.tray_menu.append(item_show) self.tray_menu.append(item_add) self.tray_menu.append(item_clear) @@ -188,15 +185,13 @@ class DelugeGTK: self.tray_menu.append(item_plug) self.tray_menu.append(gtk.SeparatorMenuItem()) self.tray_menu.append(item_quit) - + self.tray_menu.show_all() + self.tray_icon.connect("activate", self.tray_clicked) self.tray_icon.connect("popup-menu", self.tray_popup) def tray_popup(self, status_icon, button, activate_time): - self.tray_icon.set_visible(False) - self.tray_icon = None - self.build_tray_icon() self.tray_menu.popup(None, None, gtk.status_icon_position_menu, button, activate_time, status_icon) @@ -249,14 +244,12 @@ class DelugeGTK: def force_show_hide(self, arg=None): if self.window.get_property("visible"): self.window.hide() - else: if self.config.get("lock_tray", bool, default=False) == True: self.unlock_tray("mainwinshow") else: self.window.show() - def build_torrent_table(self): ## Create the torrent listview self.torrent_view = self.wtree.get_widget("torrent_view") @@ -745,7 +738,7 @@ class DelugeGTK: _("Connections") + ": " + str(connections) + "\n" + _("Download") + ": " + \ dlrate + "\n" + _("Upload") + ": " + ulrate - self.tray_icon.set_tooltip(msg) + self.tray_icon.set_tooltip(msg) #Update any active plugins self.plugins.update_active_plugins() @@ -1222,3 +1215,4 @@ if __name__ == "__main__": interface = DelugeGTK() interface.start() +