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

Commits:

4 changed files:

Changes:

  • gajim/app_actions.py
    ... ... @@ -27,7 +27,6 @@ from gajim.gtk.dialogs import ShortcutsWindow
    27 27
     from gajim.gtk.single_message import SingleMessageWindow
    
    28 28
     from gajim.gtk.about import AboutDialog
    
    29 29
     from gajim.gtk.privacy_list import PrivacyListsWindow
    
    30
    -from gajim.gtk.features import FeaturesDialog
    
    31 30
     from gajim.gtk.history import HistoryWindow
    
    32 31
     from gajim.gtk.discovery import ServiceDiscoveryWindow
    
    33 32
     from gajim.gtk.util import open_window
    
    ... ... @@ -231,7 +230,7 @@ def on_keyboard_shortcuts(_action, _param):
    231 230
     
    
    232 231
     
    
    233 232
     def on_features(_action, _param):
    
    234
    -    FeaturesDialog()
    
    233
    +    open_window('Features')
    
    235 234
     
    
    236 235
     
    
    237 236
     def on_about(_action, _param):
    

  • gajim/data/style/gajim.css
    ... ... @@ -63,6 +63,7 @@ popover#EmoticonPopover { padding: 5px; background-color: @theme_unfocused_base_
    63 63
     #ServerInfo > row.activatable:active { box-shadow: none; }
    
    64 64
     
    
    65 65
     /* Features Info */
    
    66
    +#FeaturesInfoGrid { padding: 6px; }
    
    66 67
     #FeaturesInfoGrid > list { border: 1px solid; border-color: @borders; }
    
    67 68
     #FeaturesInfoGrid > list > row:first-child { border-top: 1px solid; border-color: @borders; }
    
    68 69
     #FeaturesInfoGrid > list > row { padding: 10px 20px 10px 10px; }
    

  • gajim/gtk/const.py
    ... ... @@ -132,4 +132,5 @@ WINDOW_MODULES = {
    132 132
         'RemoveAccount': 'gajim.gtk.remove_account',
    
    133 133
         'ChangePassword': 'gajim.gtk.change_password',
    
    134 134
         'PluginsWindow': 'gajim.plugins.gui',
    
    135
    +    'Features': 'gajim.gtk.features',
    
    135 136
     }

  • gajim/gtk/features.py
    ... ... @@ -20,23 +20,27 @@
    20 20
     # along with Gajim. If not, see <http://www.gnu.org/licenses/>.
    
    21 21
     
    
    22 22
     import os
    
    23
    +import sys
    
    23 24
     from collections import namedtuple
    
    24 25
     
    
    25 26
     import gi
    
    26 27
     from gi.repository import Gtk
    
    28
    +from gi.repository import Gdk
    
    27 29
     
    
    28 30
     from gajim.common import app
    
    29 31
     from gajim.common.i18n import _
    
    30 32
     
    
    31 33
     
    
    32
    -class FeaturesDialog(Gtk.Dialog):
    
    34
    +class Features(Gtk.ApplicationWindow):
    
    33 35
         def __init__(self):
    
    34
    -        super().__init__(title=_('Features'),
    
    35
    -                         transient_for=None,
    
    36
    -                         destroy_with_parent=True)
    
    37
    -
    
    38
    -        self.set_transient_for(app.interface.roster.window)
    
    36
    +        Gtk.ApplicationWindow.__init__(self)
    
    37
    +        self.set_application(app.app)
    
    38
    +        self.set_position(Gtk.WindowPosition.CENTER)
    
    39
    +        self.set_show_menubar(False)
    
    40
    +        self.set_name('Features')
    
    41
    +        self.set_title(_('Features'))
    
    39 42
             self.set_resizable(False)
    
    43
    +        self.set_transient_for(app.interface.roster.window)
    
    40 44
     
    
    41 45
             grid = Gtk.Grid()
    
    42 46
             grid.set_name('FeaturesInfoGrid')
    
    ... ... @@ -45,24 +49,25 @@ class FeaturesDialog(Gtk.Dialog):
    45 49
     
    
    46 50
             self.feature_listbox = Gtk.ListBox()
    
    47 51
             self.feature_listbox.set_selection_mode(Gtk.SelectionMode.NONE)
    
    48
    -        self.feature_listbox.set_header_func(self.header_func, _('Features'))
    
    52
    +        self.feature_listbox.set_header_func(self._header_func, _('Features'))
    
    49 53
     
    
    50 54
             grid.attach(self.feature_listbox, 0, 0, 1, 1)
    
    51 55
     
    
    52
    -        box = self.get_content_area()
    
    56
    +        box = Gtk.Box()
    
    53 57
             box.pack_start(grid, True, True, 0)
    
    54 58
             box.set_property('margin', 12)
    
    55 59
             box.set_spacing(18)
    
    60
    +        self.add(box)
    
    56 61
     
    
    57
    -        self.connect('response', self.on_response)
    
    62
    +        self.connect('key-press-event', self._on_key_press)
    
    58 63
     
    
    59
    -        for feature in self.get_features():
    
    60
    -            self.add_feature(feature)
    
    64
    +        for feature in self._get_features():
    
    65
    +            self._add_feature(feature)
    
    61 66
     
    
    62 67
             self.show_all()
    
    63 68
     
    
    64 69
         @staticmethod
    
    65
    -    def header_func(row, before, user_data):
    
    70
    +    def _header_func(row, before, user_data):
    
    66 71
             if before:
    
    67 72
                 row.set_header(None)
    
    68 73
             else:
    
    ... ... @@ -70,20 +75,23 @@ class FeaturesDialog(Gtk.Dialog):
    70 75
                 label.set_halign(Gtk.Align.START)
    
    71 76
                 row.set_header(label)
    
    72 77
     
    
    73
    -    def on_response(self, _dialog, response):
    
    74
    -        if response == Gtk.ResponseType.OK:
    
    78
    +    def _on_key_press(self, _widget, event):
    
    79
    +        if event.keyval == Gdk.KEY_Escape:
    
    75 80
                 self.destroy()
    
    76 81
     
    
    77
    -    def add_feature(self, feature):
    
    82
    +    def _add_feature(self, feature):
    
    78 83
             item = FeatureItem(feature)
    
    79 84
             self.feature_listbox.add(item)
    
    80 85
             item.get_parent().set_tooltip_text(item.tooltip)
    
    81 86
     
    
    82
    -    def get_features(self):
    
    87
    +    def _get_features(self):
    
    83 88
             Feature = namedtuple('Feature',
    
    84 89
                                  ['name', 'available', 'tooltip',
    
    85 90
                                   'dependency_u', 'dependency_w', 'enabled'])
    
    86 91
     
    
    92
    +        notification_sounds_available = (
    
    93
    +            app.is_installed('GSOUND') or sys.platform in ('win32', 'darwin'))
    
    94
    +        notification_sounds_enabled = app.config.get('sounds_on')
    
    87 95
             spell_check_enabled = app.config.get('use_speller')
    
    88 96
     
    
    89 97
             auto_status = [app.config.get('autoaway'), app.config.get('autoxa')]
    
    ... ... @@ -98,7 +106,7 @@ class FeaturesDialog(Gtk.Dialog):
    98 106
                         _('Feature not available under Windows'),
    
    99 107
                         None),
    
    100 108
                 Feature(_('Automatic Status'),
    
    101
    -                    self.idle_available(),
    
    109
    +                    self._idle_available(),
    
    102 110
                         _('Enables Gajim to measure your computer\'s idle time in '
    
    103 111
                           'order to set your Status automatically'),
    
    104 112
                         _('Requires: libxss'),
    
    ... ... @@ -112,8 +120,21 @@ class FeaturesDialog(Gtk.Dialog):
    112 120
                         _('Requires: pybonjour and bonjour SDK running (%(url)s)')
    
    113 121
                         % {'url': 'https://developer.apple.com/opensource/)'},
    
    114 122
                         None),
    
    123
    +            Feature(_('Location detection'),
    
    124
    +                    app.is_installed('GEOCLUE'),
    
    125
    +                    _('Enables Gajim to be location-aware, if the user decides '
    
    126
    +                      'to publish the device’s location'),
    
    127
    +                    _('Requires: geoclue'),
    
    128
    +                    _('Feature is not available under Windows'),
    
    129
    +                    None),
    
    130
    +            Feature(_('Notification Sounds'),
    
    131
    +                    notification_sounds_available,
    
    132
    +                    _('Enables Gajim to play sounds for various notifications'),
    
    133
    +                    _('Requires: gsound'),
    
    134
    +                    _('No additional requirements'),
    
    135
    +                    notification_sounds_enabled),
    
    115 136
                 Feature(_('Secure Password Storage'),
    
    116
    -                    self.some_keyring_available(),
    
    137
    +                    self._some_keyring_available(),
    
    117 138
                         _('Enables Gajim to store Passwords securely instead of '
    
    118 139
                           'storing them in plaintext'),
    
    119 140
                         _('Requires: libsecret and a provider (such as GNOME '
    
    ... ... @@ -138,7 +159,7 @@ class FeaturesDialog(Gtk.Dialog):
    138 159
             ]
    
    139 160
     
    
    140 161
         @staticmethod
    
    141
    -    def some_keyring_available():
    
    162
    +    def _some_keyring_available():
    
    142 163
             if os.name == 'nt':
    
    143 164
                 return True
    
    144 165
             try:
    
    ... ... @@ -149,7 +170,7 @@ class FeaturesDialog(Gtk.Dialog):
    149 170
             return True
    
    150 171
     
    
    151 172
         @staticmethod
    
    152
    -    def idle_available():
    
    173
    +    def _idle_available():
    
    153 174
             from gajim.common import idle
    
    154 175
             return idle.Monitor.is_available()
    
    155 176