| ... |
... |
@@ -27,6 +27,7 @@ def __init__(self, workspace_id): |
|
27
|
27
|
|
|
28
|
28
|
self.get_style_context().add_class('chatlist')
|
|
29
|
29
|
self.set_filter_func(self._filter_func)
|
|
|
30
|
+ self.set_sort_func(self._sort_func)
|
|
30
|
31
|
self.set_has_tooltip(True)
|
|
31
|
32
|
|
|
32
|
33
|
self.connect('destroy', self._on_destroy)
|
| ... |
... |
@@ -91,6 +92,12 @@ def _filter_func(self, row): |
|
91
|
92
|
return True
|
|
92
|
93
|
return self._current_filter_text in row.jid
|
|
93
|
94
|
|
|
|
95
|
+ @staticmethod
|
|
|
96
|
+ def _sort_func(row1, row2):
|
|
|
97
|
+ if row1.is_recent == row2.is_recent:
|
|
|
98
|
+ return 0
|
|
|
99
|
+ return -1 if row1.is_recent else 1
|
|
|
100
|
+
|
|
94
|
101
|
def set_filter_text(self, text):
|
|
95
|
102
|
self._current_filter_text = text
|
|
96
|
103
|
self.invalidate_filter()
|
| ... |
... |
@@ -278,6 +285,12 @@ def is_active(self): |
|
278
|
285
|
return (self.is_selected() and
|
|
279
|
286
|
self.get_toplevel().get_property('is-active'))
|
|
280
|
287
|
|
|
|
288
|
+ @property
|
|
|
289
|
+ def is_recent(self):
|
|
|
290
|
+ if self._unread_count:
|
|
|
291
|
+ return True
|
|
|
292
|
+ return False
|
|
|
293
|
+
|
|
281
|
294
|
def _on_state_flags_changed(self, _listboxrow, *args):
|
|
282
|
295
|
state = self.get_state_flags()
|
|
283
|
296
|
if (state & Gtk.StateFlags.PRELIGHT) != 0:
|
| ... |
... |
@@ -304,8 +317,12 @@ def add_unread(self): |
|
304
|
317
|
if self.is_active:
|
|
305
|
318
|
return
|
|
306
|
319
|
self.unread_count += 1
|
|
|
320
|
+ if self.unread_count == 1:
|
|
|
321
|
+ self.changed()
|
|
307
|
322
|
|
|
308
|
323
|
def reset_unread(self):
|
|
|
324
|
+ if not self.unread_count:
|
|
|
325
|
+ return
|
|
309
|
326
|
self.unread_count = 0
|
|
310
|
327
|
|
|
311
|
328
|
def set_last_message_text(self, nickname, text):
|