Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Shirk <travis@pobox.com>2006-01-05 05:58:59 +0300
committerTravis Shirk <travis@pobox.com>2006-01-05 05:58:59 +0300
commit715afc711373c144a3a5eac20bc833928da70353 (patch)
treee439d34a669eaf41f9571a4ac61d16e45f599ca4
parent5464701cdafef10a2452b65803569459d3d49b97 (diff)
Chatstate and tab redraw fixes
-rw-r--r--src/chat_control.py35
-rw-r--r--src/message_control.py9
-rw-r--r--src/message_window.py16
-rw-r--r--src/roster_window.py1
4 files changed, 31 insertions, 30 deletions
diff --git a/src/chat_control.py b/src/chat_control.py
index 8473c7198..e2c9ee9c6 100644
--- a/src/chat_control.py
+++ b/src/chat_control.py
@@ -359,10 +359,8 @@ class ChatControlBase(MessageControl):
if gajim.interface.systray_enabled and\
gajim.config.get('trayicon_notification_on_new_messages'):
gajim.interface.systray.add_jid(jid, self.account, self.type_id)
- # FIXME: This is one hairy race condition
- if self.parent_win.get_active_control():
- self.parent_win.redraw_tab(self.contact)
- self.parent_win.show_title(urgent)
+ self.parent_win.redraw_tab(self.contact)
+ self.parent_win.show_title(urgent)
def toggle_emoticons(self):
'''hide show emoticons_button and make sure emoticons_menu is always there
@@ -935,12 +933,7 @@ class ChatControl(ChatControlBase):
ChatControlBase.print_conversation_line(self, text, kind, name, tim,
subject = subject)
- def markup_tab_label(self, label_str, chatstate):
- '''Markup the label if necessary. Returns a tuple such as:
- (new_label_str, color)
- either of which can be None
- if chatstate is given that means we have HE SENT US a chatstate'''
-
+ def get_tab_label(self, chatstate):
unread = ''
num_unread = self.nb_unread
if num_unread == 1 and not gajim.config.get('show_unread_tab_icon'):
@@ -981,10 +974,24 @@ class ChatControl(ChatControlBase):
color.green = int((color.green * p) + (mask * (1 - p)))
color.blue = int((color.blue * p) + (mask * (1 - p)))
+ label_str = self.contact.name
if num_unread: # if unread, text in the label becomes bold
label_str = '<b>' + unread + label_str + '</b>'
return (label_str, color)
+ def get_tab_image(self):
+ num_unread = self.nb_unread
+ # Set tab image (always 16x16); unread messages show the 'message' image
+ img_16 = gajim.interface.roster.get_appropriate_state_images(self.contact.jid)
+ tab_img = None
+
+ if num_unread and gajim.config.get('show_unread_tab_icon'):
+ tab_img = img_16['message']
+ else:
+ tab_img = img_16[self.contact.show]
+
+ return tab_img
+
def remove_possible_switch_to_menuitems(self, menu):
''' remove duplicate 'Switch to' if they exist and return clean menu'''
@@ -1114,19 +1121,17 @@ class ChatControl(ChatControlBase):
# prevent going paused if we we were not composing (JEP violation)
if state == 'paused' and not contact.our_chatstate == 'composing':
- MessageControl.send_message(self, jid, None, None,
- chatstate = 'active') # go active before
+ MessageControl.send_message(self, None, chatstate = 'active') # go active before
contact.our_chatstate = 'active'
self.reset_kbd_mouse_timeout_vars()
# if we're inactive prevent composing (JEP violation)
if contact.our_chatstate == 'inactive' and state == 'composing':
- MessageControl.send_message(self, jid, None, None,
- chatstate = 'active') # go active before
+ MessageControl.send_message(self, None, chatstate = 'active') # go active before
contact.our_chatstate = 'active'
self.reset_kbd_mouse_timeout_vars()
- MessageControl.send_message(self, jid, None, None, chatstate = state)
+ MessageControl.send_message(self, None, chatstate = state)
contact.our_chatstate = state
if contact.our_chatstate == 'active':
self.reset_kbd_mouse_timeout_vars()
diff --git a/src/message_control.py b/src/message_control.py
index bd435b305..75d643964 100644
--- a/src/message_control.py
+++ b/src/message_control.py
@@ -88,10 +88,17 @@ class MessageControl:
gobject.source_remove(self.print_time_timeout_id)
del self.print_time_timeout_id
return False
- def markup_tab_label(self, label_str, chatstate):
+ def get_tab_label(self, chatstate):
+ '''Return a suitable the tab label string. Returns a tuple such as:
+ (label_str, color) either of which can be None
+ if chatstate is given that means we have HE SENT US a chatstate and
+ we want it displayed'''
# NOTE: Derived classes SHOULD implement this
# Reurn a markup'd label and optional gtk.Color
return (label_str, None)
+ def get_tab_image(self):
+ '''Return a suitable tab image for display. None clears any current label.'''
+ return None
def prepare_context_menu(self):
# NOTE: Derived classes SHOULD implement this
return None
diff --git a/src/message_window.py b/src/message_window.py
index d71dd8563..4641800b3 100644
--- a/src/message_window.py
+++ b/src/message_window.py
@@ -257,25 +257,13 @@ class MessageWindow:
# Update nick
nick_label.set_max_width_chars(10)
- (tab_label_str, tab_label_color) = ctl.markup_tab_label(contact.name,
- chatstate)
+ (tab_label_str, tab_label_color) = ctl.get_tab_label(chatstate)
nick_label.set_markup(tab_label_str)
if tab_label_color:
nick_label.modify_fg(gtk.STATE_NORMAL, tab_label_color)
nick_label.modify_fg(gtk.STATE_ACTIVE, tab_label_color)
- num_unread = ctl.nb_unread
- # Set tab image (always 16x16); unread messages show the 'message' image
- img_16 = gajim.interface.roster.get_appropriate_state_images(contact.jid)
- tab_img = None
- if ctl.type_id == message_control.TYPE_CHAT:
- if num_unread and gajim.config.get('show_unread_tab_icon'):
- tab_img = img_16['message']
- else:
- tab_img = img_16[contact.show]
- elif ctl.type_id == message_control.TYPE_GC:
- # FIXME: muc_active muc_inactive
- pass
+ tab_img = ctl.get_tab_image()
if tab_img:
if tab_img.get_storage_type() == gtk.IMAGE_ANIMATION:
status_img.set_from_animation(tab_img.get_animation())
diff --git a/src/roster_window.py b/src/roster_window.py
index b562d0805..f6881920a 100644
--- a/src/roster_window.py
+++ b/src/roster_window.py
@@ -722,6 +722,7 @@ class RosterWindow:
win = gajim.interface.msg_win_mgr.get_window(contact.jid)
ctl = win.get_control(jid)
ctl.update_state()
+ win.redraw_tab(contact)
name = contact.name
if contact.resource != '':