removed useless code
This commit is contained in:
parent
f4bacf0989
commit
830f414b4a
1 changed files with 4 additions and 45 deletions
|
@ -52,7 +52,6 @@ class Systray:
|
||||||
self.jids = []
|
self.jids = []
|
||||||
self.new_message_handler_id = None
|
self.new_message_handler_id = None
|
||||||
self.t = None
|
self.t = None
|
||||||
#~ self.tip = gtk.Tooltips()
|
|
||||||
self.img_tray = gtk.Image()
|
self.img_tray = gtk.Image()
|
||||||
self.status = 'offline'
|
self.status = 'offline'
|
||||||
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'systray_context_menu', APP)
|
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'systray_context_menu', APP)
|
||||||
|
@ -85,8 +84,6 @@ class Systray:
|
||||||
if jid != 'tabbed':
|
if jid != 'tabbed':
|
||||||
nb += jids[jid].nb_unread[jid]
|
nb += jids[jid].nb_unread[jid]
|
||||||
|
|
||||||
self.set_tooltip(nb) # update the tooltip
|
|
||||||
|
|
||||||
def remove_jid(self, jid, account):
|
def remove_jid(self, jid, account):
|
||||||
l = [account, jid]
|
l = [account, jid]
|
||||||
if l in self.jids:
|
if l in self.jids:
|
||||||
|
@ -101,40 +98,12 @@ class Systray:
|
||||||
if jid != 'tabbed':
|
if jid != 'tabbed':
|
||||||
nb += self.plugin.windows[acct][kind][jid].nb_unread[jid]
|
nb += self.plugin.windows[acct][kind][jid].nb_unread[jid]
|
||||||
|
|
||||||
self.set_tooltip(nb) # update the tooltip
|
def change_status(self, global_status):
|
||||||
|
''' set tray image to 'global_status' '''
|
||||||
def change_status(self, global_status = None):
|
|
||||||
''' change the tooltip text and set tray image to 'global_status' '''
|
|
||||||
text, single, multiline, multilined = 'Gajim', '', '', False
|
|
||||||
if gajim.contacts:
|
|
||||||
for account in gajim.contacts.keys():
|
|
||||||
status_idx = gajim.connections[account].connected
|
|
||||||
if status_idx == 0:
|
|
||||||
continue
|
|
||||||
status = STATUS_LIST[status_idx]
|
|
||||||
message = gajim.connections[account].status
|
|
||||||
single = helpers.get_uf_show(status)
|
|
||||||
if message is None:
|
|
||||||
message = ''
|
|
||||||
else:
|
|
||||||
message = message.strip()
|
|
||||||
if message != '':
|
|
||||||
single += ': ' + message
|
|
||||||
if multiline != '':
|
|
||||||
multilined = True
|
|
||||||
multiline += '\n ' + account + '\n \t' + single
|
|
||||||
if multilined:
|
|
||||||
text += multiline
|
|
||||||
elif single != '':
|
|
||||||
text += ' - ' + single
|
|
||||||
else:
|
|
||||||
text += ' - ' + helpers.get_uf_show('offline')
|
|
||||||
|
|
||||||
# change image and status, only if it is different
|
# change image and status, only if it is different
|
||||||
if global_status is not None and self.status != global_status:
|
if global_status is not None and self.status != global_status:
|
||||||
self.status = global_status
|
self.status = global_status
|
||||||
self.set_img()
|
self.set_img()
|
||||||
#~ self.tip.set_tip(self.t, text)
|
|
||||||
|
|
||||||
def start_chat(self, widget, account, jid):
|
def start_chat(self, widget, account, jid):
|
||||||
if self.plugin.windows[account]['chats'].has_key(jid):
|
if self.plugin.windows[account]['chats'].has_key(jid):
|
||||||
|
@ -271,9 +240,7 @@ class Systray:
|
||||||
return groups_menu
|
return groups_menu
|
||||||
|
|
||||||
def on_clicked(self, widget, event):
|
def on_clicked(self, widget, event):
|
||||||
# hide the tooltip
|
self.on_tray_leave_notify_event(widget, None)
|
||||||
#~ self.tip.disable()
|
|
||||||
#~ self.tip.enable()
|
|
||||||
win = self.plugin.roster.window
|
win = self.plugin.roster.window
|
||||||
if event.button == 1: # Left click
|
if event.button == 1: # Left click
|
||||||
if len(self.jids) == 0:
|
if len(self.jids) == 0:
|
||||||
|
@ -349,21 +316,13 @@ class Systray:
|
||||||
eb.connect('motion-notify-event', self.on_tray_motion_notify_event)
|
eb.connect('motion-notify-event', self.on_tray_motion_notify_event)
|
||||||
eb.connect('leave-notify-event', self.on_tray_leave_notify_event)
|
eb.connect('leave-notify-event', self.on_tray_leave_notify_event)
|
||||||
self.tooltip = dialogs.NotificationAreaTooltip(self.plugin)
|
self.tooltip = dialogs.NotificationAreaTooltip(self.plugin)
|
||||||
#~ self.set_tooltip()
|
|
||||||
self.img_tray = gtk.Image()
|
self.img_tray = gtk.Image()
|
||||||
eb.add(self.img_tray)
|
eb.add(self.img_tray)
|
||||||
self.t.add(eb)
|
self.t.add(eb)
|
||||||
self.set_img()
|
self.set_img()
|
||||||
self.t.show_all()
|
self.t.show_all()
|
||||||
|
|
||||||
def set_tooltip(self, unread_messages_no=None):
|
|
||||||
if unread_messages_no > 1:
|
|
||||||
text = _('Gajim - %s unread messages') % unread_messages_no
|
|
||||||
elif unread_messages_no == 1:
|
|
||||||
text = _('Gajim - 1 unread message')
|
|
||||||
else: # it's None or 0
|
|
||||||
self.change_status()
|
|
||||||
|
|
||||||
def hide_icon(self):
|
def hide_icon(self):
|
||||||
if self.t:
|
if self.t:
|
||||||
self.t.destroy()
|
self.t.destroy()
|
||||||
|
|
Loading…
Add table
Reference in a new issue