| ... |
... |
@@ -18,6 +18,7 @@ |
|
18
|
18
|
from gi.repository import Pango
|
|
19
|
19
|
|
|
20
|
20
|
from gajim.common import app
|
|
|
21
|
+from gajim.common.const import AvatarSize
|
|
21
|
22
|
from gajim.common.i18n import _
|
|
22
|
23
|
|
|
23
|
24
|
from gajim.gui_menu_builder import get_subscription_menu
|
| ... |
... |
@@ -32,10 +33,12 @@ def __init__(self, account): |
|
32
|
33
|
self._account = account
|
|
33
|
34
|
self._client = app.get_client(account)
|
|
34
|
35
|
|
|
35
|
|
- self.set_size_request(400, 200)
|
|
|
36
|
+ self.set_vexpand(True)
|
|
36
|
37
|
|
|
37
|
38
|
self._listbox = Gtk.ListBox()
|
|
38
|
39
|
self._listbox.set_selection_mode(Gtk.SelectionMode.NONE)
|
|
|
40
|
+ self._listbox.set_halign(Gtk.Align.CENTER)
|
|
|
41
|
+ self._listbox.get_style_context().add_class('notification-listbox')
|
|
39
|
42
|
self._set_placeholder()
|
|
40
|
43
|
|
|
41
|
44
|
self.add(self._listbox)
|
| ... |
... |
@@ -165,7 +168,6 @@ def __init__(self, account, jid): |
|
165
|
168
|
self._account = account
|
|
166
|
169
|
self._client = app.get_client(account)
|
|
167
|
170
|
self.jid = jid
|
|
168
|
|
- self.get_style_context().add_class('padding-6')
|
|
169
|
171
|
|
|
170
|
172
|
self.grid = Gtk.Grid(column_spacing=12)
|
|
171
|
173
|
self.add(self.grid)
|
| ... |
... |
@@ -179,15 +181,21 @@ def _generate_label(): |
|
179
|
181
|
label.set_max_width_chars(30)
|
|
180
|
182
|
return label
|
|
181
|
183
|
|
|
|
184
|
+ def _generate_avatar_image(self, jid):
|
|
|
185
|
+ contact = self._client.get_module('Contacts').get_contact(jid)
|
|
|
186
|
+ surface = contact.get_avatar(
|
|
|
187
|
+ AvatarSize.ROSTER, self.get_scale_factor(), add_show=False)
|
|
|
188
|
+ image = Gtk.Image.new_from_surface(surface)
|
|
|
189
|
+ image.set_valign(Gtk.Align.CENTER)
|
|
|
190
|
+ return image
|
|
|
191
|
+
|
|
182
|
192
|
|
|
183
|
193
|
class SubscriptionRequestRow(NotificationRow):
|
|
184
|
194
|
def __init__(self, account, jid, text, user_nick=None):
|
|
185
|
195
|
NotificationRow.__init__(self, account, jid)
|
|
186
|
196
|
self.type = 'subscribe'
|
|
187
|
197
|
|
|
188
|
|
- image = Gtk.Image.new_from_icon_name(
|
|
189
|
|
- 'avatar-default-symbolic', Gtk.IconSize.DND)
|
|
190
|
|
- image.set_valign(Gtk.Align.CENTER)
|
|
|
198
|
+ image = self._generate_avatar_image(jid)
|
|
191
|
199
|
self.grid.attach(image, 1, 1, 1, 2)
|
|
192
|
200
|
|
|
193
|
201
|
if user_nick is not None:
|
| ... |
... |
@@ -232,9 +240,7 @@ def __init__(self, account, jid): |
|
232
|
240
|
NotificationRow.__init__(self, account, jid)
|
|
233
|
241
|
self.type = 'unsubscribed'
|
|
234
|
242
|
|
|
235
|
|
- image = Gtk.Image.new_from_icon_name(
|
|
236
|
|
- 'avatar-default-symbolic', Gtk.IconSize.DND)
|
|
237
|
|
- image.set_valign(Gtk.Align.CENTER)
|
|
|
243
|
+ image = self._generate_avatar_image(jid)
|
|
238
|
244
|
self.grid.attach(image, 1, 1, 1, 2)
|
|
239
|
245
|
|
|
240
|
246
|
contact = self._client.get_module('Contacts').get_contact(jid)
|
| ... |
... |
@@ -244,7 +250,7 @@ def __init__(self, account, jid): |
|
244
|
250
|
nick_label.set_markup(nick_markup)
|
|
245
|
251
|
self.grid.attach(nick_label, 2, 1, 1, 1)
|
|
246
|
252
|
|
|
247
|
|
- message_text = _('Stopped sharing their status')
|
|
|
253
|
+ message_text = _('Stopped sharing their status with you')
|
|
248
|
254
|
text_label = self._generate_label()
|
|
249
|
255
|
text_label.set_text(message_text)
|
|
250
|
256
|
text_label.set_tooltip_text(message_text)
|
| ... |
... |
@@ -279,9 +285,7 @@ def __init__(self, account, event): |
|
279
|
285
|
|
|
280
|
286
|
self._event = event
|
|
281
|
287
|
|
|
282
|
|
- image = Gtk.Image.new_from_icon_name(
|
|
283
|
|
- 'system-users-symbolic', Gtk.IconSize.DND)
|
|
284
|
|
- image.set_valign(Gtk.Align.CENTER)
|
|
|
288
|
+ image = self._generate_avatar_image(event.from_)
|
|
285
|
289
|
self.grid.attach(image, 1, 1, 1, 2)
|
|
286
|
290
|
|
|
287
|
291
|
title_label = self._generate_label()
|
| ... |
... |
@@ -331,9 +335,7 @@ def __init__(self, account, event): |
|
331
|
335
|
NotificationRow.__init__(self, account, event.muc)
|
|
332
|
336
|
self.type = 'invitation-declined'
|
|
333
|
337
|
|
|
334
|
|
- image = Gtk.Image.new_from_icon_name(
|
|
335
|
|
- 'system-users-symbolic', Gtk.IconSize.DND)
|
|
336
|
|
- image.set_valign(Gtk.Align.CENTER)
|
|
|
338
|
+ image = self._generate_avatar_image(event.from_)
|
|
337
|
339
|
self.grid.attach(image, 1, 1, 1, 2)
|
|
338
|
340
|
|
|
339
|
341
|
title_label = self._generate_label()
|