From 3895724710080cdc82a4d11dece9f81880fe7018 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Mon, 17 Jul 2006 21:41:11 +0000 Subject: [PATCH] systray now saves unread messages even if it is not enabled (but module is present). Fixes #2134 --- src/chat_control.py | 10 +++++----- src/config.py | 2 +- src/gajim.py | 4 ++-- src/groupchat_control.py | 2 +- src/message_window.py | 2 +- src/roster_window.py | 2 +- src/systray.py | 2 ++ 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/chat_control.py b/src/chat_control.py index e26b7fbdc..3628e993f 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -481,7 +481,7 @@ class ChatControlBase(MessageControl): not self.parent_win.is_active() or not end) and \ kind in ('incoming', 'incoming_queue'): 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) self.parent_win.redraw_tab(self) if not self.parent_win.is_active(): @@ -556,7 +556,7 @@ class ChatControlBase(MessageControl): self.nb_unread = self.get_specific_unread() self.parent_win.redraw_tab(self) self.parent_win.show_title() - if gajim.interface.systray_enabled: + if gajim.interface.systray_capabilities: gajim.interface.systray.remove_jid(self.get_full_jid(), self.account, self.type_id) @@ -645,7 +645,7 @@ class ChatControlBase(MessageControl): self.nb_unread = self.get_specific_unread() self.parent_win.redraw_tab(self) self.parent_win.show_title() - if gajim.interface.systray_enabled: + if gajim.interface.systray_capabilities: gajim.interface.systray.remove_jid(jid, self.account, self.type_id) @@ -1362,7 +1362,7 @@ class ChatControl(ChatControlBase): if self.bigger_avatar_window: self.bigger_avatar_window.destroy() # 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, self.type_id) # 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) # Redraw parent too 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) if (self.contact.show == 'offline' or self.contact.show == 'error'): showOffline = gajim.config.get('showoffline') diff --git a/src/config.py b/src/config.py index 160faa522..f1864829c 100644 --- a/src/config.py +++ b/src/config.py @@ -1287,7 +1287,7 @@ class AccountModificationWindow: gajim.interface.instances[name][kind][j].account = name #upgrade account in systray - if gajim.interface.systray_enabled: + if gajim.interface.systray_capabilities: for list in gajim.interface.systray.jids: if list[0] == self.account: list[0] = name diff --git a/src/gajim.py b/src/gajim.py index da2944c3f..3078ee58b 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -1098,14 +1098,14 @@ class Interface: self.roster.show_title() if no_queue: # We didn't have a queue: we change icons self.roster.draw_contact(jid, account) - if self.systray_enabled: + if self.systray_capanilities: self.systray.add_jid(jid, account, typ) def redraw_roster_systray(self, account, jid, typ = None): self.roster.nb_unread -= 1 self.roster.show_title() self.roster.draw_contact(jid, account) - if self.systray_enabled: + if self.systray_capabilities: self.systray.remove_jid(jid, account, typ) def remove_first_event(self, account, jid, typ = None): diff --git a/src/groupchat_control.py b/src/groupchat_control.py index 667df0681..841d7e880 100644 --- a/src/groupchat_control.py +++ b/src/groupchat_control.py @@ -471,7 +471,7 @@ class GroupchatControl(ChatControlBase): self.room_jid, icon_name = 'message') image = state_images['message'] model[iter][C_IMG] = image - if gajim.interface.systray_enabled: + if gajim.interface.systray_capabilities: gajim.interface.systray.add_jid(fjid, self.account, 'pm') self.parent_win.show_title() else: diff --git a/src/message_window.py b/src/message_window.py index bb570fe47..b70855e99 100644 --- a/src/message_window.py +++ b/src/message_window.py @@ -270,7 +270,7 @@ class MessageWindow: ctrl.shutdown() # Update external state - if gajim.interface.systray_enabled: + if gajim.interface.systray_capabilities: gajim.interface.systray.remove_jid(ctrl.get_full_jid(), ctrl.account, ctrl.type_id) del gajim.last_message_time[ctrl.account][ctrl.get_full_jid()] diff --git a/src/roster_window.py b/src/roster_window.py index aa53c06ea..a741e0fcf 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -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.scroll_to_cell(path) self.tree.set_cursor(path) - if gajim.interface.systray_enabled: + if gajim.interface.systray_capabilities: gajim.interface.systray.add_jid(fjid, account, kind) def on_preferences_menuitem_activate(self, widget): diff --git a/src/systray.py b/src/systray.py index 5efc19378..5470118bc 100644 --- a/src/systray.py +++ b/src/systray.py @@ -59,6 +59,8 @@ class Systray: self.popup_menus = [] def set_img(self): + if not gajim.interface.systray_enabled: + return if len(self.jids) > 0: state = 'message' else: