Daniel Brötzmann pushed to branch mainwindow at gajim / gajim

Commits:

3 changed files:

Changes:

  • gajim/data/gui/account_page.ui
    ... ... @@ -120,7 +120,6 @@
    120 120
           <object class="GtkBox" id="account_box">
    
    121 121
             <property name="visible">True</property>
    
    122 122
             <property name="can-focus">False</property>
    
    123
    -        <property name="halign">center</property>
    
    124 123
             <property name="hexpand">True</property>
    
    125 124
             <property name="orientation">vertical</property>
    
    126 125
             <property name="spacing">18</property>
    
    ... ... @@ -235,6 +234,7 @@
    235 234
               <object class="GtkLabel">
    
    236 235
                 <property name="visible">True</property>
    
    237 236
                 <property name="can-focus">False</property>
    
    237
    +            <property name="margin-top">6</property>
    
    238 238
                 <property name="label" translatable="yes">Notifications</property>
    
    239 239
                 <style>
    
    240 240
                   <class name="bold16"/>
    

  • gajim/data/style/gajim.css
    ... ... @@ -157,6 +157,13 @@
    157 157
     .roster treeview {
    
    158 158
     	padding: 0 3px;
    
    159 159
     }
    
    160
    +/* Notification listbox */
    
    161
    +.notification-listbox {
    
    162
    +    background: transparent;
    
    163
    +}
    
    164
    +.notification-listbox row {
    
    165
    +    padding: 6px;
    
    166
    +}
    
    160 167
     
    
    161 168
     /*Middle Grid*/
    
    162 169
     .middle-grid > scrolledwindow { background: transparent; }
    

  • gajim/gtk/notification_manager.py
    ... ... @@ -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()