| ... |
... |
@@ -11,7 +11,8 @@ |
|
11
|
11
|
from gajim.common.helpers import get_group_chat_nick
|
|
12
|
12
|
from gajim.common.helpers import get_uf_relative_time
|
|
13
|
13
|
|
|
14
|
|
-from gajim.gui.util import get_builder
|
|
|
14
|
+from .tooltips import RosterTooltip
|
|
|
15
|
+from .util import get_builder
|
|
15
|
16
|
|
|
16
|
17
|
log = logging.getLogger('gajim.gtk.chatlist')
|
|
17
|
18
|
|
| ... |
... |
@@ -25,13 +26,16 @@ def __init__(self, workspace_id): |
|
25
|
26
|
self._workspace_id = workspace_id
|
|
26
|
27
|
|
|
27
|
28
|
self.get_style_context().add_class('chatlist')
|
|
28
|
|
- self.connect('destroy', self._on_destroy)
|
|
29
|
|
-
|
|
30
|
|
- self.show_all()
|
|
31
|
|
-
|
|
32
|
29
|
self.set_filter_func(self._filter_func)
|
|
|
30
|
+ self.set_has_tooltip(True)
|
|
|
31
|
+
|
|
|
32
|
+ self.connect('destroy', self._on_destroy)
|
|
|
33
|
+ self.connect('query-tooltip', self._query_tooltip)
|
|
33
|
34
|
|
|
34
|
35
|
self._timer_id = GLib.timeout_add_seconds(60, self._update_timer)
|
|
|
36
|
+ self._tab_tooltip = RosterTooltip()
|
|
|
37
|
+
|
|
|
38
|
+ self.show_all()
|
|
35
|
39
|
|
|
36
|
40
|
def _on_destroy(self):
|
|
37
|
41
|
GLib.source_remove(self._timer_id)
|
| ... |
... |
@@ -40,6 +44,32 @@ def _update_timer(self): |
|
40
|
44
|
self.update_time()
|
|
41
|
45
|
return True
|
|
42
|
46
|
|
|
|
47
|
+ def _query_tooltip(self, widget, _x_pos, y_pos, _keyboard_mode, tooltip):
|
|
|
48
|
+ row = self.get_row_at_y(y_pos)
|
|
|
49
|
+ if row is None:
|
|
|
50
|
+ self._tab_tooltip.clear_tooltip()
|
|
|
51
|
+ return False
|
|
|
52
|
+
|
|
|
53
|
+ connected_contacts = []
|
|
|
54
|
+ contacts = app.contacts.get_contacts(row.account, row.jid)
|
|
|
55
|
+ if row.type == 'contact':
|
|
|
56
|
+ for contact in contacts:
|
|
|
57
|
+ if contact.show not in ('offline', 'error'):
|
|
|
58
|
+ connected_contacts.append(contact)
|
|
|
59
|
+ if not connected_contacts:
|
|
|
60
|
+ # no connected contacts, show the offline one
|
|
|
61
|
+ connected_contacts = contacts
|
|
|
62
|
+ elif row.type == 'groupchat':
|
|
|
63
|
+ connected_contacts = contacts
|
|
|
64
|
+ else:
|
|
|
65
|
+ # TODO
|
|
|
66
|
+ connected_contacts = [row.jid]
|
|
|
67
|
+
|
|
|
68
|
+ value, widget = self._tab_tooltip.get_tooltip(
|
|
|
69
|
+ row, connected_contacts, row.account, None)
|
|
|
70
|
+ tooltip.set_custom(widget)
|
|
|
71
|
+ return value
|
|
|
72
|
+
|
|
43
|
73
|
def _filter_func(self, row):
|
|
44
|
74
|
if not self._current_filter_text:
|
|
45
|
75
|
return True
|