~ubuntu-branches/ubuntu/saucy/unity-tweak-tool/saucy

« back to all changes in this revision

Viewing changes to UnityTweakTool/section/sphagetti/unity.py

  • Committer: Package Import Robot
  • Author(s): Barneedhar Vigneshwar, J Phani Mahesh, Barneedhar Vigneshwar
  • Date: 2013-09-16 19:34:38 UTC
  • Revision ID: package-import@ubuntu.com-20130916193438-dw14bzxkohvxub2y
Tags: 0.0.5
[ J Phani Mahesh ]
* New upstream release (LP: #1226059)
  - New application icon 
  - Show error dialog when schemas are missing instead of crashing
  - Trigger new build of pot files
* UnityTweakTool/section/unity.py
  - Fix Show recently used and more suggestions in dash search (LP: #1166294)
  - Fix Launcher reveal sensitivity scale update issues (LP: #1168863)
* UnityTweakTool/elements/colorchooser.py
  - Fix TypeError in get_rgba() (LP: #1165627)
  - Fix segmentation fault on selecting custom launcher (LP: #1190398)
* UnityTweakTool/elements/option.py
  - Fix "Restore defaults" button (LP: #1186634)
* UnityTweakTool/__init__.py  
  - Fix unity-tweak-tool crashed with dbus.exceptions.DBusException in
  call_blocking() (LP: #1168738)
  - Fix FileNotFoundError (LP: #1225463)
  - Fix dbus.exceptions.DBusException (LP: #1170571)
* data/unity.ui
  - Remove Panel transparency switch (LP: #1168836)
  - Remove Launcher transparency switch (LP: #1168834)

[ Barneedhar Vigneshwar ]
* UnityTweakTool/section/unity.py
  - Fix 'Can't set background blur to static' (LP: #1167343)
  - Fix non-working Launcher only on primary desktop (LP: #1173977)
* UnityTweakTool/section/sphagetti/compiz.py
  - Fix TypeError in color_to_hash() (LP: #1166884)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python3
2
 
# -*- coding: utf-8 -*-
3
 
#
4
 
# Team:
5
 
#   J Phani Mahesh <phanimahesh@gmail.com>
6
 
#   Barneedhar (jokerdino) <barneedhar@ubuntu.com>
7
 
#   Amith KK <amithkumaran@gmail.com>
8
 
#   Georgi Karavasilev <motorslav@gmail.com>
9
 
#   Sam Tran <samvtran@gmail.com>
10
 
#   Sam Hewitt <hewittsamuel@gmail.com>
11
 
#   Angel Araya <al.arayaq@gmail.com>
12
 
#
13
 
# Description:
14
 
#   A One-stop configuration tool for Unity.
15
 
#
16
 
# Legal Stuff:
17
 
#
18
 
# This file is a part of Unity Tweak Tool
19
 
#
20
 
# Unity Tweak Tool is free software; you can redistribute it and/or modify it under
21
 
# the terms of the GNU General Public License as published by the Free Software
22
 
# Foundation; version 3.
23
 
#
24
 
# Unity Tweak Tool is distributed in the hope that it will be useful, but WITHOUT
25
 
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
26
 
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
27
 
# details.
28
 
#
29
 
# You should have received a copy of the GNU General Public License along with
30
 
# this program; if not, see <https://www.gnu.org/licenses/gpl-3.0.txt>
31
 
 
32
 
import os, os.path
33
 
 
34
 
from gi.repository import Gtk, Gdk
35
 
 
36
 
from UnityTweakTool.config.ui import ui
37
 
from . import unitytweakconfig
38
 
from . import gsettings
39
 
from .values import values
40
 
 
41
 
class Unitysettings ():
42
 
    def __init__(self, builder):
43
 
        self.ui = ui(builder)
44
 
 
45
 
        self.ui['sc_reveal_sensitivity'].add_mark(2.0, Gtk.PositionType.BOTTOM, None)
46
 
        self.ui['sc_launcher_transparency'].add_mark(.666, Gtk.PositionType.BOTTOM, None)
47
 
        self.ui['sc_panel_transparency'].add_mark(.67, Gtk.PositionType.BOTTOM, None)
48
 
 
49
 
        if Gdk.Screen.get_default().get_n_monitors() == 1:
50
 
            dependants = ['l_launcher_visibility',
51
 
                          'radio_launcher_visibility_all',
52
 
                          'radio_launcher_visibility_primary',
53
 
                          'l_notifications',
54
 
                          'radio_active_monitor',
55
 
                          'radio_all_monitors']
56
 
            self.ui.unsensitize(dependants)
57
 
 
58
 
#=====================================================================#
59
 
#                                Helpers                              #
60
 
#=====================================================================#
61
 
    def refresh(self):
62
 
        '''Reads the current config and refreshes the displayed values'''
63
 
        # Colour
64
 
        color = gsettings.unityshell.get_string('background-color')
65
 
        if color.endswith('00'):
66
 
            self.ui['radio_launcher_color_cham'].set_active(True)
67
 
            self.ui.unsensitize(['color_launcher_color_cus'])
68
 
        else:
69
 
            self.ui['radio_launcher_color_cus'].set_active(True)
70
 
            self.ui.sensitize(['color_launcher_color_cus'])
71
 
        valid, gdkcolor = Gdk.Color.parse(color[:-2])
72
 
        if valid:
73
 
            self.ui['color_launcher_color_cus'].set_color(gdkcolor)
74
 
        del color, valid, gdkcolor
75
 
 
76
 
        # Show Desktop
77
 
        self.ui['sw_show_desktop'].set_active(True if 'unity://desktop-icon' in gsettings.launcher.get_strv('favorites') else False)
78
 
 
79
 
        # ====== Dash Helpers ===== #
80
 
        # Run Command History
81
 
        dependants = ['b_clear_run_history']
82
 
        if gsettings.runner.get_strv('history') == '[]':
83
 
            self.ui.unsensitize(dependants)
84
 
            self.ui['b_clear_run_history'].set_active(False)
85
 
        else:
86
 
            self.ui.sensitize(dependants)
87
 
        del dependants
88
 
 
89
 
 
90
 
        # ====== Panel Helpers ====== #
91
 
        self.ui['sc_panel_transparency'].set_value(gsettings.unityshell.get_double('panel-opacity'))
92
 
         # Default Player
93
 
        interested_players = gsettings.sound.get_strv('interested-media-players')
94
 
        preferred_players = gsettings.sound.get_strv('preferred-media-players')
95
 
 
96
 
        for player in interested_players:
97
 
            self.ui['cbox_default_player'].append_text(player.capitalize())
98
 
            if preferred_players[0] in interested_players:
99
 
                self.ui['cbox_default_player'].set_active(interested_players.index(preferred_players[0]))
100
 
 
101
 
        # ====== Unity Switcher helpers ====== #
102
 
        # Window Switcher accelerators
103
 
        model = self.ui['list_unity_switcher_windows_accelerators']
104
 
 
105
 
        alt_tab_forward = gsettings.unityshell.get_string('alt-tab-forward')
106
 
        iter_alt_tab_forward = model.get_iter_first()
107
 
        model.set_value(iter_alt_tab_forward, 1, alt_tab_forward)
108
 
 
109
 
        alt_tab_prev = gsettings.unityshell.get_string('alt-tab-prev')
110
 
        iter_alt_tab_prev = model.iter_next(iter_alt_tab_forward)
111
 
        model.set_value(iter_alt_tab_prev, 1, alt_tab_prev)
112
 
 
113
 
        alt_tab_forward_all = gsettings.unityshell.get_string('alt-tab-forward-all')
114
 
        iter_alt_tab_forward_all = model.iter_next(iter_alt_tab_prev)
115
 
        model.set_value(iter_alt_tab_forward_all, 1, alt_tab_forward_all)
116
 
 
117
 
        alt_tab_prev_all = gsettings.unityshell.get_string('alt-tab-prev-all')
118
 
        iter_alt_tab_prev_all = model.iter_next(iter_alt_tab_forward_all)
119
 
        model.set_value(iter_alt_tab_prev_all, 1, alt_tab_prev_all)
120
 
 
121
 
        alt_tab_right = gsettings.unityshell.get_string('alt-tab-right')
122
 
        iter_alt_tab_right = model.iter_next(iter_alt_tab_prev_all)
123
 
        model.set_value(iter_alt_tab_right, 1, alt_tab_right)
124
 
 
125
 
        alt_tab_left = gsettings.unityshell.get_string('alt-tab-left')
126
 
        iter_alt_tab_left = model.iter_next(iter_alt_tab_right)
127
 
        model.set_value(iter_alt_tab_left, 1, alt_tab_left)
128
 
 
129
 
        alt_tab_detail_start = gsettings.unityshell.get_string('alt-tab-detail-start')
130
 
        iter_alt_tab_detail_start = model.iter_next(iter_alt_tab_left)
131
 
        model.set_value(iter_alt_tab_detail_start, 1, alt_tab_detail_start)
132
 
 
133
 
        alt_tab_detail_stop = gsettings.unityshell.get_string('alt-tab-detail-stop')
134
 
        iter_alt_tab_detail_stop = model.iter_next(iter_alt_tab_detail_start)
135
 
        model.set_value(iter_alt_tab_detail_stop, 1, alt_tab_detail_stop)
136
 
 
137
 
        alt_tab_next_window = gsettings.unityshell.get_string('alt-tab-next-window')
138
 
        iter_alt_tab_next_window = model.iter_next(iter_alt_tab_detail_stop)
139
 
        model.set_value(iter_alt_tab_next_window, 1, alt_tab_next_window)
140
 
 
141
 
        alt_tab_prev_window = gsettings.unityshell.get_string('alt-tab-prev-window')
142
 
 
143
 
        iter_alt_tab_prev_window = model.iter_next(iter_alt_tab_next_window)
144
 
        model.set_value(iter_alt_tab_prev_window, 1, alt_tab_prev_window)
145
 
 
146
 
        del model
147
 
 
148
 
        # Launcher switcher accelerators
149
 
        model = self.ui['list_unity_switcher_launcher_accelerators']
150
 
 
151
 
        launcher_switcher_forward = gsettings.unityshell.get_string('launcher-switcher-forward')
152
 
        iter_launcher_switcher_forward = model.get_iter_first()
153
 
        model.set_value(iter_launcher_switcher_forward, 1, launcher_switcher_forward)
154
 
 
155
 
        launcher_switcher_prev = gsettings.unityshell.get_string('launcher-switcher-prev')
156
 
        iter_launcher_switcher_prev = model.iter_next(iter_launcher_switcher_forward)
157
 
        model.set_value(iter_launcher_switcher_prev, 1, launcher_switcher_prev)
158
 
 
159
 
        del model, launcher_switcher_forward, iter_launcher_switcher_forward, launcher_switcher_prev, iter_launcher_switcher_prev
160
 
 
161
 
 
162
 
        # ====== Unity Webapps helpers ===== #
163
 
        # Preauthorized domains
164
 
        self.ui['check_preauthorized_amazon'].set_active(True if 'amazon.ca' in gsettings.webapps.get_strv('preauthorized-domains') else False)
165
 
        self.ui['check_preauthorized_ubuntuone'].set_active(True if 'one.ubuntu.com' in gsettings.webapps.get_strv('preauthorized-domains') else False)
166
 
 
167
 
        # ====== Unity additional helpers ======= #
168
 
        model = self.ui['list_unity_additional_accelerators']
169
 
 
170
 
        show_hud = gsettings.unityshell.get_string('show-hud')
171
 
        iter_show_hud = model.get_iter_first()
172
 
        model.set_value(iter_show_hud, 1, show_hud)
173
 
 
174
 
        show_launcher = gsettings.unityshell.get_string('show-launcher')
175
 
        iter_show_launcher = model.iter_next(iter_show_hud)
176
 
        model.set_value(iter_show_launcher, 1, show_launcher)
177
 
 
178
 
        execute_command = gsettings.unityshell.get_string('execute-command')
179
 
        iter_execute_command = model.iter_next(iter_show_launcher)
180
 
        model.set_value(iter_execute_command, 1, execute_command)
181
 
 
182
 
        keyboard_focus = gsettings.unityshell.get_string('keyboard-focus')
183
 
        iter_keyboard_focus = model.iter_next(iter_execute_command)
184
 
        model.set_value(iter_keyboard_focus, 1, keyboard_focus)
185
 
 
186
 
        panel_first_menu = gsettings.unityshell.get_string('panel-first-menu')
187
 
        iter_panel_first_menu = model.iter_next(iter_keyboard_focus)
188
 
        model.set_value(iter_panel_first_menu, 1, panel_first_menu)
189
 
 
190
 
        del model, show_hud, iter_show_hud, show_launcher, iter_show_launcher, execute_command, iter_execute_command, keyboard_focus, iter_keyboard_focus, panel_first_menu, iter_panel_first_menu
191
 
 
192
 
 
193
 
# ===== BEGIN: Unity settings =====
194
 
# ----- BEGIN: Launcher -----
195
 
 
196
 
    def on_sc_reveal_sensitivity_value_changed(self, widget, udata = None):
197
 
        value = self.ui['sc_reveal_sensitivity'].get_value()
198
 
        gsettings.unityshell.set_double('edge-responsiveness', value)
199
 
        del value
200
 
    def on_sc_launcher_transparency_value_changed(self, widget, udata = None):
201
 
        opacity = self.ui['sc_launcher_transparency'].get_value()
202
 
        gsettings.unityshell.set_double('launcher-opacity', opacity)
203
 
    def on_radio_launcher_color_cus_toggled(self, widget, udata = None):
204
 
        dependants = ['color_launcher_color_cus']
205
 
        color = self.ui['color_launcher_color_cus'].get_color()
206
 
        colorhash = gsettings.color_to_hash(color)
207
 
        if self.ui['radio_launcher_color_cus'].get_active():
208
 
            self.ui.sensitize(dependants)
209
 
            gsettings.unityshell.set_string('background-color', colorhash)
210
 
        else:
211
 
            self.ui.unsensitize(dependants)
212
 
            gsettings.unityshell.set_string('background-color', colorhash[:-2]+'00')
213
 
 
214
 
 
215
 
    def on_sw_show_desktop_active_notify(self, widget, udata = None):
216
 
        fav = gsettings.launcher.get_strv('favorites')
217
 
        desktop = 'unity://desktop-icon'
218
 
        if self.ui['sw_show_desktop'].get_active():
219
 
            if desktop not in fav:
220
 
                fav.append(desktop)
221
 
                gsettings.launcher.set_strv('favorites', fav)
222
 
        else:
223
 
            if desktop in fav:
224
 
                fav.remove(desktop)
225
 
                gsettings.launcher.set_strv('favorites', fav)
226
 
        del desktop
227
 
 
228
 
    def on_b_unity_launcher_reset_clicked(self, widget):
229
 
        gsettings.unityshell.reset('background-color')
230
 
        gsettings.unityshell.reset('panel-opacity')
231
 
 
232
 
        # Launcher items
233
 
        fav = gsettings.launcher.get_strv('favorites')
234
 
        desktop = 'unity://desktop-icon'
235
 
        if desktop in fav:
236
 
            fav.remove(desktop)
237
 
            gsettings.launcher.set_strv('favorites', fav)
238
 
        del desktop
239
 
        del fav
240
 
 
241
 
        self.refresh()
242
 
 
243
 
# ----- END: Launcher -----
244
 
 
245
 
# ----- BEGIN: Dash -----
246
 
    def on_b_clear_run_history_clicked(self, widget):
247
 
        gsettings.runner.reset('history')
248
 
#----- END: Dash -------
249
 
 
250
 
#----- BEGIN: Panel -----
251
 
    def on_sc_panel_transparency_value_changed(self, widget, udata = None):
252
 
        panel_transparency = widget.get_value()
253
 
        gsettings.unityshell.set_double('panel-opacity', panel_transparency)
254
 
    def on_cbox_default_player_changed(self, widget, udata = None):
255
 
        combobox_text = self.ui['cbox_default_player'].get_active_text()
256
 
        gsettings.sound.set_strv('preferred-media-players', [combobox_text.lower()])
257
 
 
258
 
    def on_b_unity_panel_reset_clicked(self, widget):
259
 
        gsettings.sound.reset('preferred-media-players')
260
 
 
261
 
        self.refresh()
262
 
 
263
 
#----- END: Panel -----
264
 
 
265
 
#----- BEGIN: Switcher -----
266
 
    # keyboard widgets in unity-windows-switcher
267
 
 
268
 
    def on_craccel_unity_switcher_windows_accel_edited(self, craccel, path, key, mods, hwcode, model = None):
269
 
        model = self.ui['list_unity_switcher_windows_accelerators']
270
 
        accel = Gtk.accelerator_name(key, mods)
271
 
        titer = model.get_iter(path)
272
 
        model.set_value(titer, 1, accel)
273
 
        # Python has no switch statement, right?
274
 
 
275
 
        if path == '0':
276
 
            gsettings.unityshell.set_string('alt-tab-forward', accel)
277
 
        elif path == '1':
278
 
            gsettings.unityshell.set_string('alt-tab-prev', accel)
279
 
        elif path == '2':
280
 
            gsettings.unityshell.set_string('alt-tab-forward-all', accel)
281
 
        elif path == '3':
282
 
            gsettings.unityshell.set_string('alt-tab-prev-all', accel)
283
 
        elif path == '4':
284
 
            gsettings.unityshell.set_string('alt-tab-right', accel)
285
 
        elif path == '5':
286
 
            gsettings.unityshell.set_string('alt-tab-left', accel)
287
 
        elif path == '6':
288
 
            gsettings.unityshell.set_string('alt-tab-detail-start', accel)
289
 
        elif path == '7':
290
 
            gsettings.unityshell.set_string('alt-tab-detail-stop', accel)
291
 
        elif path == '8':
292
 
            gsettings.unityshell.set_string('alt-tab-next-window', accel)
293
 
        elif path == '9':
294
 
            gsettings.unityshell.set_string('alt-tab-prev-window', accel)
295
 
 
296
 
    def on_craccel_unity_switcher_windows_accel_cleared(self, craccel, path, model = None):
297
 
        model = self.ui['list_unity_switcher_windows_accelerators']
298
 
        titer = model.get_iter(path)
299
 
        model.set_value(titer, 1, 'Disabled')
300
 
        if path == '0':
301
 
            gsettings.unityshell.set_string('alt-tab-forward', 'Disabled')
302
 
        elif path == '1':
303
 
            gsettings.unityshell.set_string('alt-tab-prev', 'Disabled')
304
 
        elif path == '2':
305
 
            gsettings.unityshell.set_string('alt-tab-forward-all', 'Disabled')
306
 
        elif path == '3':
307
 
            gsettings.unityshell.set_string('alt-tab-prev-all', 'Disabled')
308
 
        elif path == '4':
309
 
            gsettings.unityshell.set_string('alt-tab-right', 'Disabled')
310
 
        elif path == '5':
311
 
            gsettings.unityshell.set_string('alt-tab-left', 'Disabled')
312
 
        elif path == '6':
313
 
            gsettings.unityshell.set_string('alt-tab-detail-start', 'Disabled')
314
 
        elif path == '7':
315
 
            gsettings.unityshell.set_string('alt-tab-detail-stop', 'Disabled')
316
 
        elif path == '8':
317
 
            gsettings.unityshell.set_string('alt-tab-next-window', 'Disabled')
318
 
        elif path == '9':
319
 
            gsettings.unityshell.set_string('alt-tab-prev-window', 'Disabled')
320
 
 
321
 
    # keyboard widgets in unity-launcher-switcher
322
 
 
323
 
    def on_craccel_unity_switcher_launcher_accel_edited(self, craccel, path, key, mods, hwcode, model = None):
324
 
        model = self.ui['list_unity_switcher_launcher_accelerators']
325
 
        accel = Gtk.accelerator_name(key, mods)
326
 
        titer = model.get_iter(path)
327
 
        model.set_value(titer, 1, accel)
328
 
        # Python has no switch statement, right?
329
 
 
330
 
        if path == '0':
331
 
            gsettings.unityshell.set_string('launcher-switcher-forward', accel)
332
 
        else:
333
 
            gsettings.unityshell.set_string('launcher-switcher-prev', accel)
334
 
 
335
 
    def on_craccel_unity_switcher_launcher_accel_cleared(self, craccel, path, model = None):
336
 
        model = self.ui['list_unity_switcher_launcher_accelerators']
337
 
        titer = model.get_iter(path)
338
 
        model.set_value(titer, 1, 'Disabled')
339
 
        if path == '0':
340
 
            gsettings.unityshell.set_string('launcher-switcher-forward', 'Disabled')
341
 
        else:
342
 
            gsettings.unityshell.set_string('launcher-switcher-prev', 'Disabled')
343
 
 
344
 
    def on_b_unity_switcher_reset_clicked(self, widget):
345
 
        gsettings.unityshell.reset('alt-tab-forward')
346
 
        gsettings.unityshell.reset('alt-tab-prev')
347
 
        gsettings.unityshell.reset('alt-tab-forward-all')
348
 
        gsettings.unityshell.reset('alt-tab-prev-all')
349
 
        gsettings.unityshell.reset('alt-tab-right')
350
 
        gsettings.unityshell.reset('alt-tab-left')
351
 
        gsettings.unityshell.reset('alt-tab-detail-start')
352
 
        gsettings.unityshell.reset('alt-tab-detail-stop')
353
 
        gsettings.unityshell.reset('alt-tab-next-window')
354
 
        gsettings.unityshell.reset('alt-tab-prev-window')
355
 
        gsettings.unityshell.reset('launcher-switcher-forward')
356
 
        gsettings.unityshell.reset('launcher-switcher-prev')
357
 
        self.refresh()
358
 
 
359
 
#----- END: Switch -----
360
 
 
361
 
#----- BEGIN: Webapps -----
362
 
    # Preauthorized domains - Amazon
363
 
    def on_check_preauthorized_amazon_toggled(self, widget):
364
 
        if self.ui['check_preauthorized_amazon'].get_active() == False:
365
 
            preauthorized = gsettings.webapps.get_strv('preauthorized-domains')
366
 
            amazonca = 'amazon.ca'
367
 
            if amazonca in preauthorized:
368
 
                amazonlist = ['amazon.ca', 'amazon.cn', 'amazon.com', 'amazon.co.uk', 'amazon.de', 'amazon.es', 'amazon.fr', 'amazon.it', 'www.amazon.ca', 'www.amazon.cn', 'www.amazon.com', 'www.amazon.co.uk', 'www.amazon.de', 'www.amazon.es', 'www.amazon.fr', 'www.amazon.it']
369
 
                for amazon in amazonlist:
370
 
                    preauthorized.remove(amazon)
371
 
                    gsettings.webapps.set_strv('preauthorized-domains', preauthorized)
372
 
            elif amazonca not in preauthorized:
373
 
                pass
374
 
        else:
375
 
            preauthorized = gsettings.webapps.get_strv('preauthorized-domains')
376
 
            amazonca = 'amazon.ca'
377
 
            if amazonca not in preauthorized:
378
 
                amazonlist = ['amazon.ca', 'amazon.cn', 'amazon.com', 'amazon.co.uk', 'amazon.de', 'amazon.es', 'amazon.fr', 'amazon.it', 'www.amazon.ca', 'www.amazon.cn', 'www.amazon.com', 'www.amazon.co.uk', 'www.amazon.de', 'www.amazon.es', 'www.amazon.fr', 'www.amazon.it']
379
 
                for amazon in amazonlist:
380
 
                    preauthorized.append(amazon)
381
 
                    gsettings.webapps.set_strv('preauthorized-domains', preauthorized)
382
 
            elif amazonca in preauthorized:
383
 
                pass
384
 
 
385
 
    # Preauthorized domains - Ubuntu One
386
 
    def on_check_preauthorized_ubuntuone_toggled(self, widget):
387
 
        if self.ui['check_preauthorized_ubuntuone'].get_active() == False:
388
 
            preauthorized = gsettings.webapps.get_strv('preauthorized-domains')
389
 
            ubuntuone = 'one.ubuntu.com'
390
 
            if ubuntuone in preauthorized:
391
 
                preauthorized.remove(ubuntuone)
392
 
                gsettings.webapps.set_strv('preauthorized-domains', preauthorized)
393
 
            elif ubuntuone not in preauthorized:
394
 
                pass
395
 
        else:
396
 
            preauthorized = gsettings.webapps.get_strv('preauthorized-domains')
397
 
            ubuntuone = 'one.ubuntu.com'
398
 
            if ubuntuone not in preauthorized:
399
 
                preauthorized.append(ubuntuone)
400
 
                gsettings.webapps.set_strv('preauthorized-domains', preauthorized)
401
 
            elif ubuntuone in preauthorized:
402
 
                pass
403
 
 
404
 
    # Reset button
405
 
    def on_b_unity_webapps_reset_clicked(self, widget):
406
 
        gsettings.webapps.reset('preauthorized-domains')
407
 
        self.refresh()
408
 
 
409
 
#----- END: Webapps -----
410
 
 
411
 
#----- BEGIN: Additional -----
412
 
    # keyboard widgets in unity-additional
413
 
 
414
 
    def on_craccel_unity_additional_accel_edited(self, craccel, path, key, mods, hwcode, model = None):
415
 
        # Glade has a habit of swapping arguments. beware.
416
 
        model = self.ui['list_unity_additional_accelerators']
417
 
        accel = Gtk.accelerator_name(key, mods)
418
 
        titer = model.get_iter(path)
419
 
        model.set_value(titer, 1, accel)
420
 
 
421
 
        # Python has no switch statement, right?
422
 
 
423
 
# You are right, jokerdino. Python has no switch statement.
424
 
# That is against OOP principles. -jpm
425
 
 
426
 
        if path == '0':
427
 
            gsettings.unityshell.set_string('show-hud', accel)
428
 
        elif path == '1':
429
 
            gsettings.unityshell.set_string('show-launcher', accel)
430
 
        elif path == '2':
431
 
            gsettings.unityshell.set_string('execute-command', accel)
432
 
        elif path == '3':
433
 
            gsettings.unityshell.set_string('keyboard-focus', accel)
434
 
        else:
435
 
            gsettings.unityshell.set_string('panel-first-menu', accel)
436
 
 
437
 
    def on_craccel_unity_additional_accel_cleared(self, craccel, path, model = None):
438
 
        model = self.ui['list_unity_additional_accelerators']
439
 
        titer = model.get_iter(path)
440
 
        model.set_value(titer, 1, 'Disabled')
441
 
        if path == '0':
442
 
            gsettings.unityshell.set_string('show-hud', 'Disabled')
443
 
        elif path == '1':
444
 
            gsettings.unityshell.set_string('show-launcher', 'Disabled')
445
 
        elif path == '2':
446
 
            gsettings.unityshell.set_string('execute-command', 'Disabled')
447
 
        elif path == '3':
448
 
            gsettings.unityshell.set_string('keyboard-focus', 'Disabled')
449
 
        else:
450
 
            gsettings.unityshell.set_string('panel-first-menu', 'Disabled')
451
 
 
452
 
    def on_b_unity_additional_reset_clicked(self, widget):
453
 
        gsettings.unityshell.reset('shortcut-overlay')
454
 
        gsettings.unityshell.reset('show-hud')
455
 
        gsettings.unityshell.reset('show-launcher')
456
 
        gsettings.unityshell.reset('execute-command')
457
 
        gsettings.unityshell.reset('keyboard-focus')
458
 
        gsettings.unityshell.reset('panel-first-menu')
459
 
        self.refresh()
460
 
 
461
 
#----- END: Additional -----
462