revert 664...i'll make the menu a glade file soon

This commit is contained in:
Marcos Pinto 2007-06-19 00:59:09 +00:00
parent af928cf83f
commit 9ec33795a9
1 changed files with 8 additions and 14 deletions

View File

@ -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()