| ... |
... |
@@ -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
|
|