ability to sort by status in roster and in muc separatly. Fixes #3823

This commit is contained in:
Yann Leboulanger 2008-09-26 15:22:16 +00:00
parent 62fe4b1874
commit 22cc993fa7
5 changed files with 58 additions and 21 deletions

View File

@ -124,19 +124,49 @@
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="sort_by_show_checkbutton">
<widget class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip" translatable="yes">If checked, Gajim will sort contacts in roster window and groupchats by their status and not by the shown name</property>
<property name="label" translatable="yes">_Sort contacts by status</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_sort_by_show_checkbutton_toggled"/>
<property name="spacing">6</property>
<child>
<widget class="GtkLabel" id="label10">
<property name="visible">True</property>
<property name="label" translatable="yes">Sort contacts by status</property>
</widget>
<packing>
<property name="expand">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="sort_by_show_in_roster_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">in _roster</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_sort_by_show_in_roster_checkbutton_toggled"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="sort_by_show_in_muc_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">in _group chats</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_sort_by_show_in_muc_checkbutton_toggled"/>
</widget>
<packing>
<property name="position">2</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">5</property>
</packing>
</child>
@ -220,7 +250,7 @@ Detached roster with chat grouped by type</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip" translatable="yes">Some messages may include rich content (formatting, colors etc). If checked, Gajim will just display the raw message text.</property>
<property name="label" translatable="yes">Ignore rich content in incoming messages</property>
<property name="label" translatable="yes">_Ignore rich content in incoming messages</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
@ -259,7 +289,8 @@ Detached roster with chat grouped by type</property>
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="xpad">1</property>
<property name="label" translatable="yes">Emoticons:</property>
<property name="label" translatable="yes">_Emoticons:</property>
<property name="use_underline">True</property>
</widget>
</child>
</widget>

View File

@ -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, ],

View File

@ -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:

View File

@ -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]

View File

@ -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)