From 22cc993fa712e3f4b90d7e18fed6b77e18ad986e Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Fri, 26 Sep 2008 15:22:16 +0000 Subject: [PATCH] ability to sort by status in roster and in muc separatly. Fixes #3823 --- data/glade/preferences_window.glade | 55 ++++++++++++++++++++++------- src/common/config.py | 3 +- src/config.py | 13 ++++--- src/groupchat_control.py | 2 +- src/roster_window.py | 6 ++-- 5 files changed, 58 insertions(+), 21 deletions(-) diff --git a/data/glade/preferences_window.glade b/data/glade/preferences_window.glade index 19aee2041..27d0e5c6b 100644 --- a/data/glade/preferences_window.glade +++ b/data/glade/preferences_window.glade @@ -124,19 +124,49 @@ - + True - True - If checked, Gajim will sort contacts in roster window and groupchats by their status and not by the shown name - _Sort contacts by status - True - 0 - True - + 6 + + + True + Sort contacts by status + + + False + + + + + True + True + in _roster + True + 0 + True + + + + False + 1 + + + + + True + True + in _group chats + True + 0 + True + + + + 2 + + - False - False 5 @@ -220,7 +250,7 @@ Detached roster with chat grouped by type True True Some messages may include rich content (formatting, colors etc). If checked, Gajim will just display the raw message text. - Ignore rich content in incoming messages + _Ignore rich content in incoming messages True 0 True @@ -259,7 +289,8 @@ Detached roster with chat grouped by type True 0 1 - Emoticons: + _Emoticons: + True diff --git a/src/common/config.py b/src/common/config.py index 2cd796869..695702afa 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -111,7 +111,8 @@ class Config: 'collapsed_rows': [ opt_str, '', _('List (space separated) of rows (accounts and groups) that are collapsed.'), True ], 'roster_theme': [ opt_str, _('default'), '', True ], 'mergeaccounts': [ opt_bool, False, '', True ], - 'sort_by_show': [ opt_bool, True, '', True ], + 'sort_by_show_in_roster': [ opt_bool, True, '', True ], + 'sort_by_show_in_muc': [ opt_bool, False, '', True ], 'enable_zeroconf': [opt_bool, False, _('Enable link-local/zeroconf messaging')], 'use_speller': [ opt_bool, False, ], 'ignore_incoming_xhtml': [ opt_bool, False, ], diff --git a/src/config.py b/src/config.py index 6cebc1e14..a55290812 100644 --- a/src/config.py +++ b/src/config.py @@ -124,8 +124,10 @@ class PreferencesWindow: set_active(st) # Sort contacts by show - st = gajim.config.get('sort_by_show') - self.xml.get_widget('sort_by_show_checkbutton').set_active(st) + st = gajim.config.get('sort_by_show_in_roster') + self.xml.get_widget('sort_by_show_in_roster_checkbutton').set_active(st) + st = gajim.config.get('sort_by_show_in_muc') + self.xml.get_widget('sort_by_show_in_muc_checkbutton').set_active(st) # emoticons emoticons_combobox = self.xml.get_widget('emoticons_combobox') @@ -529,9 +531,12 @@ class PreferencesWindow: w.set_sensitive(widget.get_active()) gajim.interface.save_config() - def on_sort_by_show_checkbutton_toggled(self, widget): - self.on_checkbutton_toggled(widget, 'sort_by_show') + def on_sort_by_show_in_roster_checkbutton_toggled(self, widget): + self.on_checkbutton_toggled(widget, 'sort_by_show_in_roster') gajim.interface.roster.setup_and_draw_roster() + + def on_sort_by_show_in_muc_checkbutton_toggled(self, widget): + self.on_checkbutton_toggled(widget, 'sort_by_show_in_muc') # Redraw connected groupchats for account in gajim.connections: if gajim.connections[account].connected: diff --git a/src/groupchat_control.py b/src/groupchat_control.py index 992dc8d50..3b4a5a4a4 100644 --- a/src/groupchat_control.py +++ b/src/groupchat_control.py @@ -402,7 +402,7 @@ class GroupchatControl(ChatControlBase): if not gc_contact2: return 0 if type1 == 'contact' and type2 == 'contact' and \ - gajim.config.get('sort_by_show'): + gajim.config.get('sort_by_show_in_muc'): cshow = {'online':0, 'chat': 1, 'away': 2, 'xa': 3, 'dnd': 4, 'invisible': 5, 'offline': 6, 'error': 7} show1 = cshow[gc_contact1.show] diff --git a/src/roster_window.py b/src/roster_window.py index 32bdc450e..dc0467c3a 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -1561,10 +1561,10 @@ class RosterWindow: if not contact2: return 0 name2 = contact2.get_shown_name() - # We first compare by show if sort_by_show is True or if it's a child - # contact + # We first compare by show if sort_by_show_in_roster is True or if it's a + # child contact if type1 == 'contact' and type2 == 'contact' and \ - gajim.config.get('sort_by_show'): + gajim.config.get('sort_by_show_in_roster'): cshow = {'online':0, 'chat': 1, 'away': 2, 'xa': 3, 'dnd': 4, 'invisible': 5, 'offline': 6, 'not in roster': 7, 'error': 8} s = self.get_show(lcontact1)