Philipp Hörist pushed to branch master at gajim / gajim

Commits:

5 changed files:

Changes:

  • gajim/common/config.py
    ... ... @@ -90,15 +90,6 @@ class Config:
    90 90
             'allow_hide_roster': [opt_bool, False, _('Allow to hide the contact list window even if the notification area icon is not shown.'), False],
    
    91 91
             'iconset': [opt_str, DEFAULT_ICONSET, '', True],
    
    92 92
             'use_transports_iconsets': [opt_bool, True, '', True],
    
    93
    -        'notif_signin_color': [opt_color, '#32CD32', _('Notification color for contacts signing in.')], # limegreen
    
    94
    -        'notif_signout_color': [opt_color, '#FF0000', _('Notification color for contacts signing out.')], # red
    
    95
    -        'notif_message_color': [opt_color, '#1E90FF', _('Notification color for new message notification.')], # dodgerblue
    
    96
    -        'notif_ftrequest_color': [opt_color, '#F0E68C', _('Notification color for file transfer request.')], # khaki
    
    97
    -        'notif_fterror_color': [opt_color, '#B22222', _('Notification color for file transfer errors.')], # firebrick
    
    98
    -        'notif_ftcomplete_color': [opt_color, '#9ACD32', _('Notification color for stopped or completed file transfers.')], # yellowgreen
    
    99
    -        'notif_invite_color': [opt_color, '#D2B48C', _('Notification color for group chat invitations.')], # tan1
    
    100
    -        'notif_status_color': [opt_color, '#D8BFD8', _('Notification background color for changed status.')], # thistle2
    
    101
    -        'notif_other_color': [opt_color, '#FFFFFF', _('Notification color for other dialogs.')], # white
    
    102 93
             'collapsed_rows': [opt_str, '', _('List of rows (accounts and groups) that are collapsed (space separated).'), True],
    
    103 94
             'roster_theme': [opt_str, _('default'), '', True],
    
    104 95
             'mergeaccounts': [opt_bool, False, '', True],
    

  • gajim/data/gui/popup_notification_window.ui
    1 1
     <?xml version="1.0" encoding="UTF-8"?>
    
    2
    -<!-- Generated with glade 3.22.1 -->
    
    2
    +<!-- Generated with glade 3.22.2 -->
    
    3 3
     <interface>
    
    4
    -  <requires lib="gtk+" version="3.12"/>
    
    4
    +  <requires lib="gtk+" version="3.20"/>
    
    5 5
       <object class="GtkEventBox" id="eventbox">
    
    6
    -    <property name="name">PopupNotificationEventBox</property>
    
    6
    +    <property name="name">NotificationPopup</property>
    
    7 7
         <property name="visible">True</property>
    
    8 8
         <property name="can_focus">False</property>
    
    9 9
         <child>
    
    10 10
           <object class="GtkBox">
    
    11 11
             <property name="visible">True</property>
    
    12 12
             <property name="can_focus">False</property>
    
    13
    -        <property name="border_width">4</property>
    
    14 13
             <property name="spacing">6</property>
    
    15 14
             <child>
    
    16
    -          <object class="GtkImage" id="image">
    
    17
    -            <property name="width_request">68</property>
    
    18
    -            <property name="height_request">86</property>
    
    15
    +          <object class="GtkBox" id="color_bar">
    
    16
    +            <property name="width_request">6</property>
    
    19 17
                 <property name="visible">True</property>
    
    20 18
                 <property name="can_focus">False</property>
    
    19
    +            <property name="orientation">vertical</property>
    
    20
    +            <child>
    
    21
    +              <placeholder/>
    
    22
    +            </child>
    
    21 23
               </object>
    
    22 24
               <packing>
    
    23 25
                 <property name="expand">False</property>
    
    24
    -            <property name="fill">False</property>
    
    26
    +            <property name="fill">True</property>
    
    25 27
                 <property name="position">0</property>
    
    26 28
               </packing>
    
    27 29
             </child>
    
    30
    +        <child>
    
    31
    +          <object class="GtkImage" id="image">
    
    32
    +            <property name="visible">True</property>
    
    33
    +            <property name="can_focus">False</property>
    
    34
    +            <property name="icon_size">6</property>
    
    35
    +          </object>
    
    36
    +          <packing>
    
    37
    +            <property name="expand">False</property>
    
    38
    +            <property name="fill">True</property>
    
    39
    +            <property name="position">1</property>
    
    40
    +          </packing>
    
    41
    +        </child>
    
    28 42
             <child>
    
    29 43
               <object class="GtkBox">
    
    30 44
                 <property name="visible">True</property>
    
    ... ... @@ -36,11 +50,10 @@
    36 50
                     <property name="can_focus">False</property>
    
    37 51
                     <child>
    
    38 52
                       <object class="GtkLabel" id="event_type_label">
    
    53
    +                    <property name="name">NotificationPopupTitle</property>
    
    39 54
                         <property name="width_request">196</property>
    
    40 55
                         <property name="visible">True</property>
    
    41 56
                         <property name="can_focus">False</property>
    
    42
    -                    <property name="label" translatable="yes">Event Type</property>
    
    43
    -                    <property name="use_markup">True</property>
    
    44 57
                         <property name="wrap">True</property>
    
    45 58
                         <property name="xalign">0</property>
    
    46 59
                       </object>
    
    ... ... @@ -68,7 +81,7 @@
    68 81
                       </object>
    
    69 82
                       <packing>
    
    70 83
                         <property name="expand">False</property>
    
    71
    -                    <property name="fill">False</property>
    
    84
    +                    <property name="fill">True</property>
    
    72 85
                         <property name="position">1</property>
    
    73 86
                       </packing>
    
    74 87
                     </child>
    
    ... ... @@ -82,14 +95,14 @@
    82 95
                 <child>
    
    83 96
                   <object class="GtkLabel" id="event_description_label">
    
    84 97
                     <property name="width_request">218</property>
    
    85
    -                <property name="height_request">64</property>
    
    98
    +                <property name="height_request">50</property>
    
    86 99
                     <property name="visible">True</property>
    
    87 100
                     <property name="can_focus">False</property>
    
    88
    -                <property name="label" translatable="yes">Event desc</property>
    
    89 101
                     <property name="wrap">True</property>
    
    90 102
                     <property name="ellipsize">end</property>
    
    91 103
                     <property name="max_width_chars">30</property>
    
    92 104
                     <property name="xalign">0</property>
    
    105
    +                <property name="yalign">0</property>
    
    93 106
                   </object>
    
    94 107
                   <packing>
    
    95 108
                     <property name="expand">False</property>
    
    ... ... @@ -101,7 +114,7 @@
    101 114
               <packing>
    
    102 115
                 <property name="expand">False</property>
    
    103 116
                 <property name="fill">True</property>
    
    104
    -            <property name="position">1</property>
    
    117
    +            <property name="position">2</property>
    
    105 118
               </packing>
    
    106 119
             </child>
    
    107 120
           </object>
    

  • gajim/data/style/default.css
    ... ... @@ -50,3 +50,30 @@
    50 50
     .gajim-search-highlight {
    
    51 51
         color: rgb(170, 220, 220)
    
    52 52
     }
    
    53
    +.gajim-notify-message {
    
    54
    +	color: rgb(30, 144, 255);
    
    55
    +}
    
    56
    +.gajim-notify-signin {
    
    57
    +	color: rgb(68, 134, 38);
    
    58
    +}
    
    59
    +.gajim-notify-signout {
    
    60
    +	color: rgb(134, 22, 22);
    
    61
    +}
    
    62
    +.gajim-notify-status {
    
    63
    +	color: rgb(170, 170, 170);
    
    64
    +}
    
    65
    +.gajim-notify-invite {
    
    66
    +	color: rgb(224, 145, 42);
    
    67
    +}
    
    68
    +.gajim-notify-ft-request {
    
    69
    +	color: rgb(240, 230, 140);
    
    70
    +}
    
    71
    +.gajim-notify-ft-error {
    
    72
    +	color: rgb(226, 33, 33);
    
    73
    +}
    
    74
    +.gajim-notify-ft-complete {
    
    75
    +	color: rgb(139, 185, 48);
    
    76
    +}
    
    77
    +.gajim-notify-other {
    
    78
    +	color: rgb(255, 255, 255);
    
    79
    +}

  • gajim/data/style/gajim.css
    ... ... @@ -280,3 +280,23 @@ button.flat.link { padding: 0; border: 0; }
    280 280
     
    
    281 281
     .assistant-grid { padding: 18px; margin: 6px;}
    
    282 282
     .assistant-grid > box stack  { padding: 18px; }
    
    283
    +
    
    284
    +/* Windows notification */
    
    285
    +#NotificationPopup {
    
    286
    +    background-color: #333333;
    
    287
    +    padding: 4px;
    
    288
    +}
    
    289
    +#NotificationPopup label {
    
    290
    +    color: #FFF;
    
    291
    +}
    
    292
    +#NotificationPopup button {
    
    293
    +    border-width: 0;
    
    294
    +    background-image: none;
    
    295
    +    background-color: inherit;
    
    296
    +    box-shadow: none;
    
    297
    +    text-shadow: none;
    
    298
    +    -gtk-icon-shadow: none;
    
    299
    +}
    
    300
    +#NotificationPopupTitle {
    
    301
    +    font-weight: bold;
    
    302
    +}

  • gajim/gtk/notification.py
    ... ... @@ -36,6 +36,7 @@ from gajim import gtkgui_helpers
    36 36
     from gajim.common import app
    
    37 37
     from gajim.common import helpers
    
    38 38
     from gajim.common import ged
    
    39
    +from gajim.common.const import StyleAttr
    
    39 40
     from gajim.common.i18n import _
    
    40 41
     from gajim.common.nec import EventHelper
    
    41 42
     
    
    ... ... @@ -252,10 +253,8 @@ class PopupNotification(Gtk.Window):
    252 253
             self.set_type_hint(Gdk.WindowTypeHint.NOTIFICATION)
    
    253 254
             self.set_focus_on_map(False)
    
    254 255
             self.set_accept_focus(False)
    
    255
    -        self.set_name('NotificationPopup')
    
    256 256
             self.set_skip_taskbar_hint(True)
    
    257 257
             self.set_decorated(False)
    
    258
    -        self.set_size_request(312, 95)
    
    259 258
     
    
    260 259
             self._timeout_id = None
    
    261 260
             self.account = account
    
    ... ... @@ -265,57 +264,53 @@ class PopupNotification(Gtk.Window):
    265 264
             self._ui = get_builder('popup_notification_window.ui')
    
    266 265
             self.add(self._ui.eventbox)
    
    267 266
     
    
    268
    -        if not text:
    
    269
    -            text = app.get_name_from_jid(account, jid)  # default value of text
    
    270
    -        if not title:
    
    271
    -            title = ''
    
    272
    -
    
    273
    -        self._ui.event_type_label.set_markup(
    
    274
    -            '<span foreground="black" weight="bold">%s</span>' %
    
    275
    -            GLib.markup_escape_text(title))
    
    276
    -
    
    277
    -        css = '#NotificationPopup {background-color: black }'
    
    278
    -        gtkgui_helpers.add_css_to_widget(self, css)
    
    279
    -
    
    280 267
             if event_type == _('Contact Signed In'):
    
    281
    -            bg_color = app.config.get('notif_signin_color')
    
    268
    +            bg_color = app.css_config.get_value('.gajim-notify-signin',
    
    269
    +                                                StyleAttr.COLOR)
    
    282 270
             elif event_type == _('Contact Signed Out'):
    
    283
    -            bg_color = app.config.get('notif_signout_color')
    
    271
    +            bg_color = app.css_config.get_value('.gajim-notify-signout',
    
    272
    +                                                StyleAttr.COLOR)
    
    284 273
             elif event_type in (_('New Message'),
    
    285
    -                            _('New Private Message'), _('New E-mail')):
    
    286
    -            bg_color = app.config.get('notif_message_color')
    
    274
    +                            _('New Private Message'),
    
    275
    +                            _('New E-mail')):
    
    276
    +            bg_color = app.css_config.get_value('.gajim-notify-message',
    
    277
    +                                                StyleAttr.COLOR)
    
    287 278
             elif event_type == _('File Transfer Request'):
    
    288
    -            bg_color = app.config.get('notif_ftrequest_color')
    
    279
    +            bg_color = app.css_config.get_value('.gajim-notify-ft-request',
    
    280
    +                                                StyleAttr.COLOR)
    
    289 281
             elif event_type == _('File Transfer Error'):
    
    290
    -            bg_color = app.config.get('notif_fterror_color')
    
    282
    +            bg_color = app.css_config.get_value('.gajim-notify-ft-error',
    
    283
    +                                                StyleAttr.COLOR)
    
    291 284
             elif event_type in (_('File Transfer Completed'),
    
    292 285
                                 _('File Transfer Stopped')):
    
    293
    -            bg_color = app.config.get('notif_ftcomplete_color')
    
    286
    +            bg_color = app.css_config.get_value('.gajim-notify-ft-complete',
    
    287
    +                                                StyleAttr.COLOR)
    
    294 288
             elif event_type == _('Group Chat Invitation'):
    
    295
    -            bg_color = app.config.get('notif_invite_color')
    
    289
    +            bg_color = app.css_config.get_value('.gajim-notify-invite',
    
    290
    +                                                StyleAttr.COLOR)
    
    296 291
             elif event_type == _('Contact Changed Status'):
    
    297
    -            bg_color = app.config.get('notif_status_color')
    
    298
    -        else: # Unknown event! Shouldn't happen but deal with it
    
    299
    -            bg_color = app.config.get('notif_other_color')
    
    292
    +            bg_color = app.css_config.get_value('.gajim-notify-status',
    
    293
    +                                                StyleAttr.COLOR)
    
    294
    +        else:  # Unknown event (shouldn't happen, but deal with it)
    
    295
    +            bg_color = app.css_config.get_value('.gajim-notify-other',
    
    296
    +                                                StyleAttr.COLOR)
    
    297
    +
    
    298
    +        bar_class = '''
    
    299
    +            .popup-bar {
    
    300
    +                background-color: %s
    
    301
    +            }''' % bg_color
    
    302
    +        gtkgui_helpers.add_css_to_widget(self._ui.color_bar, bar_class)
    
    303
    +        self._ui.color_bar.get_style_context().add_class('popup-bar')
    
    300 304
     
    
    301
    -        background_class = '''
    
    302
    -            .popup-style {
    
    303
    -                border-image: none;
    
    304
    -                background-image: none;
    
    305
    -                background-color: %s }''' % bg_color
    
    306
    -
    
    307
    -        gtkgui_helpers.add_css_to_widget(self._ui.eventbox, background_class)
    
    308
    -        self._ui.eventbox.get_style_context().add_class('popup-style')
    
    309
    -
    
    310
    -        gtkgui_helpers.add_css_to_widget(
    
    311
    -            self._ui.close_button, background_class)
    
    312
    -        self._ui.close_button.get_style_context().add_class('popup-style')
    
    305
    +        if not title:
    
    306
    +            title = ''
    
    307
    +        self._ui.event_type_label.set_markup(title)
    
    313 308
     
    
    309
    +        if not text:
    
    310
    +            text = app.get_name_from_jid(account, jid)  # default value of text
    
    314 311
             escaped_text = GLib.markup_escape_text(text)
    
    315
    -        self._ui.event_description_label.set_markup(
    
    316
    -            '<span foreground="black">%s</span>' % escaped_text)
    
    312
    +        self._ui.event_description_label.set_markup(escaped_text)
    
    317 313
     
    
    318
    -        # set the image
    
    319 314
             self._ui.image.set_from_icon_name(icon_name, Gtk.IconSize.DIALOG)
    
    320 315
     
    
    321 316
             self.move(*self._get_window_pos())