systray now saves unread messages even if it is not enabled (but module is present). Fixes #2134

This commit is contained in:
Yann Leboulanger 2006-07-17 21:41:11 +00:00
parent 196062bbc2
commit 3895724710
7 changed files with 13 additions and 11 deletions

View File

@ -481,7 +481,7 @@ class ChatControlBase(MessageControl):
not self.parent_win.is_active() or not end) and \ not self.parent_win.is_active() or not end) and \
kind in ('incoming', 'incoming_queue'): kind in ('incoming', 'incoming_queue'):
self.nb_unread += 1 self.nb_unread += 1
if gajim.interface.systray_enabled and self.notify_on_new_messages(): if gajim.interface.systray_capabilities and self.notify_on_new_messages():
gajim.interface.systray.add_jid(full_jid, self.account, self.type_id) gajim.interface.systray.add_jid(full_jid, self.account, self.type_id)
self.parent_win.redraw_tab(self) self.parent_win.redraw_tab(self)
if not self.parent_win.is_active(): if not self.parent_win.is_active():
@ -556,7 +556,7 @@ class ChatControlBase(MessageControl):
self.nb_unread = self.get_specific_unread() self.nb_unread = self.get_specific_unread()
self.parent_win.redraw_tab(self) self.parent_win.redraw_tab(self)
self.parent_win.show_title() self.parent_win.show_title()
if gajim.interface.systray_enabled: if gajim.interface.systray_capabilities:
gajim.interface.systray.remove_jid(self.get_full_jid(), gajim.interface.systray.remove_jid(self.get_full_jid(),
self.account, self.account,
self.type_id) self.type_id)
@ -645,7 +645,7 @@ class ChatControlBase(MessageControl):
self.nb_unread = self.get_specific_unread() self.nb_unread = self.get_specific_unread()
self.parent_win.redraw_tab(self) self.parent_win.redraw_tab(self)
self.parent_win.show_title() self.parent_win.show_title()
if gajim.interface.systray_enabled: if gajim.interface.systray_capabilities:
gajim.interface.systray.remove_jid(jid, self.account, gajim.interface.systray.remove_jid(jid, self.account,
self.type_id) self.type_id)
@ -1362,7 +1362,7 @@ class ChatControl(ChatControlBase):
if self.bigger_avatar_window: if self.bigger_avatar_window:
self.bigger_avatar_window.destroy() self.bigger_avatar_window.destroy()
# Clean up systray # Clean up systray
if gajim.interface.systray_enabled and self.nb_unread > 0: if gajim.interface.systray_capabilities and self.nb_unread > 0:
gajim.interface.systray.remove_jid(self.contact.jid, self.account, gajim.interface.systray.remove_jid(self.contact.jid, self.account,
self.type_id) self.type_id)
# remove all register handlers on wigets, created by self.xml # remove all register handlers on wigets, created by self.xml
@ -1561,7 +1561,7 @@ class ChatControl(ChatControlBase):
gajim.interface.roster.draw_contact(jid, self.account) gajim.interface.roster.draw_contact(jid, self.account)
# Redraw parent too # Redraw parent too
gajim.interface.roster.draw_parent_contact(jid, self.account) gajim.interface.roster.draw_parent_contact(jid, self.account)
if gajim.interface.systray_enabled: if gajim.interface.systray_capabilities:
gajim.interface.systray.remove_jid(jid_with_resource, self.account, typ) gajim.interface.systray.remove_jid(jid_with_resource, self.account, typ)
if (self.contact.show == 'offline' or self.contact.show == 'error'): if (self.contact.show == 'offline' or self.contact.show == 'error'):
showOffline = gajim.config.get('showoffline') showOffline = gajim.config.get('showoffline')

View File

@ -1287,7 +1287,7 @@ class AccountModificationWindow:
gajim.interface.instances[name][kind][j].account = name gajim.interface.instances[name][kind][j].account = name
#upgrade account in systray #upgrade account in systray
if gajim.interface.systray_enabled: if gajim.interface.systray_capabilities:
for list in gajim.interface.systray.jids: for list in gajim.interface.systray.jids:
if list[0] == self.account: if list[0] == self.account:
list[0] = name list[0] = name

View File

@ -1098,14 +1098,14 @@ class Interface:
self.roster.show_title() self.roster.show_title()
if no_queue: # We didn't have a queue: we change icons if no_queue: # We didn't have a queue: we change icons
self.roster.draw_contact(jid, account) self.roster.draw_contact(jid, account)
if self.systray_enabled: if self.systray_capanilities:
self.systray.add_jid(jid, account, typ) self.systray.add_jid(jid, account, typ)
def redraw_roster_systray(self, account, jid, typ = None): def redraw_roster_systray(self, account, jid, typ = None):
self.roster.nb_unread -= 1 self.roster.nb_unread -= 1
self.roster.show_title() self.roster.show_title()
self.roster.draw_contact(jid, account) self.roster.draw_contact(jid, account)
if self.systray_enabled: if self.systray_capabilities:
self.systray.remove_jid(jid, account, typ) self.systray.remove_jid(jid, account, typ)
def remove_first_event(self, account, jid, typ = None): def remove_first_event(self, account, jid, typ = None):

View File

@ -471,7 +471,7 @@ class GroupchatControl(ChatControlBase):
self.room_jid, icon_name = 'message') self.room_jid, icon_name = 'message')
image = state_images['message'] image = state_images['message']
model[iter][C_IMG] = image model[iter][C_IMG] = image
if gajim.interface.systray_enabled: if gajim.interface.systray_capabilities:
gajim.interface.systray.add_jid(fjid, self.account, 'pm') gajim.interface.systray.add_jid(fjid, self.account, 'pm')
self.parent_win.show_title() self.parent_win.show_title()
else: else:

View File

@ -270,7 +270,7 @@ class MessageWindow:
ctrl.shutdown() ctrl.shutdown()
# Update external state # Update external state
if gajim.interface.systray_enabled: if gajim.interface.systray_capabilities:
gajim.interface.systray.remove_jid(ctrl.get_full_jid(), ctrl.account, gajim.interface.systray.remove_jid(ctrl.get_full_jid(), ctrl.account,
ctrl.type_id) ctrl.type_id)
del gajim.last_message_time[ctrl.account][ctrl.get_full_jid()] del gajim.last_message_time[ctrl.account][ctrl.get_full_jid()]

View File

@ -2264,7 +2264,7 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
self.tree.expand_row(path[0:2], False) self.tree.expand_row(path[0:2], False)
self.tree.scroll_to_cell(path) self.tree.scroll_to_cell(path)
self.tree.set_cursor(path) self.tree.set_cursor(path)
if gajim.interface.systray_enabled: if gajim.interface.systray_capabilities:
gajim.interface.systray.add_jid(fjid, account, kind) gajim.interface.systray.add_jid(fjid, account, kind)
def on_preferences_menuitem_activate(self, widget): def on_preferences_menuitem_activate(self, widget):

View File

@ -59,6 +59,8 @@ class Systray:
self.popup_menus = [] self.popup_menus = []
def set_img(self): def set_img(self):
if not gajim.interface.systray_enabled:
return
if len(self.jids) > 0: if len(self.jids) > 0:
state = 'message' state = 'message'
else: else: