From ea11076a0ec66e7d88af39550954a07f3b2edae4 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Sun, 6 Nov 2005 14:30:17 +0000 Subject: [PATCH] =?UTF-8?q?we=20now=20show=20status=20message=20under=20co?= =?UTF-8?q?ntact=20name=20in=20roster=20thanks=20to=20initial=20patch=20by?= =?UTF-8?q?=20Micha=C5=82=20Sobiegraj.=20if=20you=20do=20not=20like=20that?= =?UTF-8?q?,=20go=20to=20prefs=20and=20uncheck=20it.=20dimgrey=20to=20beco?= =?UTF-8?q?me=20white=20when=20row=20is=20selected?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/config.py | 2 + src/config.py | 8 ++++ src/gtkgui.glade | 103 ++++++++++++++++++++++++++----------------- src/roster_window.py | 16 ++++++- 4 files changed, 86 insertions(+), 43 deletions(-) diff --git a/src/common/config.py b/src/common/config.py index 6ec45b468..d81ac0fd9 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -154,6 +154,8 @@ class Config: 'quit_on_roster_x_button': [opt_bool, False, _('If True, quits Gajim when X button of Window Manager is clicked. This setting is taken into account only if trayicon is used.')], 'set_xmpp://_handler_everytime': [opt_bool, False, _('If True, Gajim registers for xmpp:// on each startup.')], 'show_unread_tab_icon': [opt_bool, False, _('If True, Gajim will display an icon on each tab containing unread messages. Depending on the theme, this icon may be animated.')], + 'show_status_msgs_in_roster': [opt_bool, True, _('If True, Gajim will display the status message, if not empty, for every contact under the contact name in roster window')], + 'color_for_status_msg_in_roster': [opt_str, 'dimgrey', ''], } __options_per_key = { diff --git a/src/config.py b/src/config.py index f9c004e70..492e98f1f 100644 --- a/src/config.py +++ b/src/config.py @@ -111,6 +111,10 @@ class PreferencesWindow: # Sort contacts by show st = gajim.config.get('sort_by_show') self.xml.get_widget('sort_by_show_checkbutton').set_active(st) + + # Display status msg under contact name in roster + st = gajim.config.get('show_status_msgs_in_roster') + self.xml.get_widget('show_status_msgs_in_roster_checkbutton').set_active(st) #Use emoticons st = gajim.config.get('useemoticons') @@ -473,6 +477,10 @@ class PreferencesWindow: def on_sort_by_show_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'sort_by_show') gajim.interface.roster.draw_roster() + + def on_show_status_msgs_in_roster_checkbutton_toggled(self, widget): + self.on_checkbutton_toggled(widget, 'show_status_msgs_in_roster') + gajim.interface.roster.draw_roster() def on_use_emoticons_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'useemoticons', diff --git a/src/gtkgui.glade b/src/gtkgui.glade index 0e1b43726..8487f0dca 100644 --- a/src/gtkgui.glade +++ b/src/gtkgui.glade @@ -3364,48 +3364,18 @@ Agent JID - node - + True - False - 12 - - - - True - If checked, Gajim will replace ascii smilies like ':)' with equivalent graphical emoticons - True - Use _emoticons - True - GTK_RELIEF_NORMAL - True - False - False - True - - - - 0 - False - False - - - - - - True - True - Manage... - True - GTK_RELIEF_NORMAL - True - - - - 0 - False - False - - + If checked, Gajim will display the status message, if not empty, for every contact under the contact name in roster window + True + Display status messages of contacts in roster + True + GTK_RELIEF_NORMAL + True + False + False + True + 0 @@ -3722,6 +3692,57 @@ Agent JID - node + + + True + False + 12 + + + + True + If checked, Gajim will replace ascii smilies like ':)' with equivalent graphical emoticons + True + Use _emoticons + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + + + True + True + Manage... + True + GTK_RELIEF_NORMAL + True + + + + 0 + False + False + + + + + 0 + False + True + + + True diff --git a/src/roster_window.py b/src/roster_window.py index 3af3cb7b4..18794314b 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -224,12 +224,22 @@ class RosterWindow: contact_instances = gajim.get_contact_instances_from_jid(account, jid) contact = gajim.get_highest_prio_contact_from_contacts(contact_instances) name = contact.name + if len(contact_instances) > 1: name += ' (' + unicode(len(contact_instances)) + ')' + # add status msg, if not empty, under contact name in the treeview + if contact.status and gajim.config.get('show_status_msgs_in_roster'): + status = contact.status.strip() + if status != '': + # escape markup entities and make them small italic and darkgrey + colorstring = gajim.config.get('color_for_status_msg_in_roster') + name += '\n' '%s'\ + % (colorstring, gtkgui_helpers.escape_for_pango_markup(status)) + state_images = self.get_appropriate_state_images(jid) if gajim.awaiting_events[account].has_key(jid): - #TODO: change icon for FT + #FIXME: change icon for FT img = state_images['message'] elif jid.find('@') <= 0: # if not '@' or '@' starts the jid ==> agent img = state_images[contact.show] @@ -2356,8 +2366,10 @@ _('If "%s" accepts this request you will know his status.') %jid) self.popups_notification_height = 0 self.popup_notification_windows = [] self.gpg_passphrase = {} + #(icon, name, type, jid, account, editable, secondary_pixbuf) model = gtk.TreeStore(gtk.Image, str, str, str, str, bool, gtk.gdk.Pixbuf) + model.set_sort_func(1, self.compareIters) model.set_sort_column_id(1, gtk.SORT_ASCENDING) self.tree.set_model(model) @@ -2449,7 +2461,7 @@ _('If "%s" accepts this request you will know his status.') %jid) render_text.connect('editing-canceled', self.on_editing_canceled) render_text.connect('editing-started', self.on_editing_started) col.pack_start(render_text, expand = True) - col.add_attribute(render_text, 'text', C_NAME) # where we hold the name + col.add_attribute(render_text, 'markup', C_NAME) # where we hold the name col.add_attribute(render_text, 'editable', C_EDITABLE) # where we hold if the row is editable col.set_cell_data_func(render_text, self.nameCellDataFunc, None)