Merge lp:~parnold-x/wingpanel-indicator-a11y/session-support into lp:~wingpanel-devs/wingpanel-indicator-a11y/trunk
- session-support
- Merge into trunk
Proposed by
Djax
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Felipe Escoto | ||||
Approved revision: | 3 | ||||
Merged at revision: | 3 | ||||
Proposed branch: | lp:~parnold-x/wingpanel-indicator-a11y/session-support | ||||
Merge into: | lp:~wingpanel-devs/wingpanel-indicator-a11y/trunk | ||||
Diff against target: |
420 lines (+242/-107) 5 files modified
src/CMakeLists.txt (+5/-1) src/GreeterWidget.vala (+118/-0) src/Indicator.vala (+15/-106) src/SessionSettings.vala (+68/-0) src/SessionWidget.vala (+36/-0) |
||||
To merge this branch: | bzr merge lp:~parnold-x/wingpanel-indicator-a11y/session-support | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Felipe Escoto | Approve | ||
Review via email: mp+270599@code.launchpad.net |
Commit message
wingpanel session support
Description of the change
To post a comment you must log in.
Revision history for this message
Felipe Escoto (philip.scott) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/CMakeLists.txt' | |||
2 | --- src/CMakeLists.txt 2015-08-04 20:48:42 +0000 | |||
3 | +++ src/CMakeLists.txt 2015-09-09 21:31:57 +0000 | |||
4 | @@ -1,7 +1,7 @@ | |||
5 | 1 | find_package (PkgConfig) | 1 | find_package (PkgConfig) |
6 | 2 | 2 | ||
7 | 3 | # Add all your dependencies to the list below | 3 | # Add all your dependencies to the list below |
9 | 4 | pkg_check_modules (DEPS REQUIRED gthread-2.0 gtk+-3.0 wingpanel-2.0) | 4 | pkg_check_modules (DEPS REQUIRED gthread-2.0 gtk+-3.0 wingpanel-2.0 granite) |
10 | 5 | 5 | ||
11 | 6 | add_definitions (${DEPS_CFLAGS}) | 6 | add_definitions (${DEPS_CFLAGS}) |
12 | 7 | link_directories (${DEPS_LIBRARY_DIRS}) | 7 | link_directories (${DEPS_LIBRARY_DIRS}) |
13 | @@ -13,11 +13,15 @@ | |||
14 | 13 | include (ValaPrecompile) | 13 | include (ValaPrecompile) |
15 | 14 | # Add all your vala files and requires packages to the List below to include them in the build | 14 | # Add all your vala files and requires packages to the List below to include them in the build |
16 | 15 | vala_precompile (VALA_C ${CMAKE_PROJECT_NAME} | 15 | vala_precompile (VALA_C ${CMAKE_PROJECT_NAME} |
17 | 16 | GreeterWidget.vala | ||
18 | 16 | Indicator.vala | 17 | Indicator.vala |
19 | 18 | SessionSettings.vala | ||
20 | 19 | SessionWidget.vala | ||
21 | 17 | ${CMAKE_CURRENT_BINARY_DIR}/config.vala | 20 | ${CMAKE_CURRENT_BINARY_DIR}/config.vala |
22 | 18 | PACKAGES | 21 | PACKAGES |
23 | 19 | wingpanel-2.0 | 22 | wingpanel-2.0 |
24 | 20 | posix | 23 | posix |
25 | 24 | granite | ||
26 | 21 | OPTIONS | 25 | OPTIONS |
27 | 22 | --thread | 26 | --thread |
28 | 23 | ) | 27 | ) |
29 | 24 | 28 | ||
30 | === added file 'src/GreeterWidget.vala' | |||
31 | --- src/GreeterWidget.vala 1970-01-01 00:00:00 +0000 | |||
32 | +++ src/GreeterWidget.vala 2015-09-09 21:31:57 +0000 | |||
33 | @@ -0,0 +1,118 @@ | |||
34 | 1 | /* | ||
35 | 2 | * Copyright (c) 2011-2015 Wingpanel Developers (http://launchpad.net/wingpanel) | ||
36 | 3 | * | ||
37 | 4 | * This program is free software; you can redistribute it and/or | ||
38 | 5 | * modify it under the terms of the GNU General Public | ||
39 | 6 | * License as published by the Free Software Foundation; either | ||
40 | 7 | * version 2 of the License, or (at your option) any later version. | ||
41 | 8 | * | ||
42 | 9 | * This program is distributed in the hope that it will be useful, | ||
43 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
44 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
45 | 12 | * General Public License for more details. | ||
46 | 13 | * | ||
47 | 14 | * You should have received a copy of the GNU General Public | ||
48 | 15 | * License along with this program; if not, write to the | ||
49 | 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
50 | 17 | * Boston, MA 02111-1307, USA. | ||
51 | 18 | */ | ||
52 | 19 | |||
53 | 20 | public class A11Y.GreeterWidget : Gtk.Grid { | ||
54 | 21 | KeyFile settings; | ||
55 | 22 | Gtk.Window keyboard_window; | ||
56 | 23 | int keyboard_pid; | ||
57 | 24 | |||
58 | 25 | public GreeterWidget () { | ||
59 | 26 | settings = new KeyFile (); | ||
60 | 27 | |||
61 | 28 | /* | ||
62 | 29 | * we could load /etc/lightdm/pantheon-greeter.conf but all keys are commented there. | ||
63 | 30 | * setting defaults instead to prevent needless warnings | ||
64 | 31 | */ | ||
65 | 32 | settings.set_boolean ("greeter", "high-contrast", false); | ||
66 | 33 | settings.set_boolean ("greeter", "onscreen-keyboard", false); | ||
67 | 34 | /* | ||
68 | 35 | * try { | ||
69 | 36 | * settings.load_from_file ("/etc/lightdm/pantheon-greeter.conf", | ||
70 | 37 | * KeyFileFlags.KEEP_COMMENTS); | ||
71 | 38 | * } catch (Error e) { | ||
72 | 39 | * warning (e.message); | ||
73 | 40 | * } | ||
74 | 41 | */ | ||
75 | 42 | int position = 0; | ||
76 | 43 | var onscreen_keyboard = new Wingpanel.Widgets.Switch (_("Onscreen Keyboard"), false); | ||
77 | 44 | onscreen_keyboard.switched.connect (() => { | ||
78 | 45 | toggle_keyboard (onscreen_keyboard.get_active ()); | ||
79 | 46 | }); | ||
80 | 47 | attach (onscreen_keyboard, 0, position++, 1, 1); | ||
81 | 48 | try { | ||
82 | 49 | onscreen_keyboard.set_active (settings.get_boolean ("greeter", "onscreen-keyboard")); | ||
83 | 50 | } catch (Error e) { | ||
84 | 51 | warning (e.message); | ||
85 | 52 | } | ||
86 | 53 | |||
87 | 54 | var high_contrast = new Wingpanel.Widgets.Switch (_("HighContrast"), false); | ||
88 | 55 | high_contrast.switched.connect (() => { | ||
89 | 56 | Gtk.Settings.get_default ().gtk_theme_name = high_contrast.get_active () ? "HighContrastInverse" : "elementary"; | ||
90 | 57 | settings.set_boolean ("greeter", "high-contrast", high_contrast.get_active ()); | ||
91 | 58 | }); | ||
92 | 59 | attach (high_contrast, 0, position++, 1, 1); | ||
93 | 60 | try { | ||
94 | 61 | high_contrast.set_active (settings.get_boolean ("greeter", "high-contrast")); | ||
95 | 62 | } catch (Error e) { | ||
96 | 63 | warning (e.message); | ||
97 | 64 | } | ||
98 | 65 | } | ||
99 | 66 | |||
100 | 67 | ~GreeterWidget () { | ||
101 | 68 | if (keyboard_pid != 0) { | ||
102 | 69 | Posix.kill (keyboard_pid, Posix.SIGKILL); | ||
103 | 70 | int status; | ||
104 | 71 | Posix.waitpid (keyboard_pid, out status, 0); | ||
105 | 72 | keyboard_pid = 0; | ||
106 | 73 | } | ||
107 | 74 | } | ||
108 | 75 | |||
109 | 76 | private void toggle_keyboard (bool active) { | ||
110 | 77 | if (keyboard_window != null) { | ||
111 | 78 | keyboard_window.visible = active; | ||
112 | 79 | settings.set_boolean ("greeter", "onscreen-keyboard", active); | ||
113 | 80 | |||
114 | 81 | return; | ||
115 | 82 | } | ||
116 | 83 | |||
117 | 84 | int id = 0; | ||
118 | 85 | int onboard_stdout_fd; | ||
119 | 86 | |||
120 | 87 | try { | ||
121 | 88 | string[] argv; | ||
122 | 89 | Shell.parse_argv ("onboard --xid", out argv); | ||
123 | 90 | Process.spawn_async_with_pipes (null, argv, null, SpawnFlags.SEARCH_PATH, null, out keyboard_pid, null, out onboard_stdout_fd, null); | ||
124 | 91 | |||
125 | 92 | var f = FileStream.fdopen (onboard_stdout_fd, "r"); | ||
126 | 93 | var stdout_text = new char[1024]; | ||
127 | 94 | f.gets (stdout_text); | ||
128 | 95 | id = int.parse ((string)stdout_text); | ||
129 | 96 | } catch (Error e) { | ||
130 | 97 | warning (e.message); | ||
131 | 98 | } | ||
132 | 99 | |||
133 | 100 | var keyboard_socket = new Gtk.Socket (); | ||
134 | 101 | keyboard_window = new Gtk.Window (); | ||
135 | 102 | keyboard_window.accept_focus = false; | ||
136 | 103 | keyboard_window.focus_on_map = false; | ||
137 | 104 | keyboard_window.add (keyboard_socket); | ||
138 | 105 | keyboard_socket.add_id (id); | ||
139 | 106 | |||
140 | 107 | var screen = Gdk.Screen.get_default (); | ||
141 | 108 | var monitor = screen.get_primary_monitor (); | ||
142 | 109 | Gdk.Rectangle geom; | ||
143 | 110 | screen.get_monitor_geometry (monitor, out geom); | ||
144 | 111 | keyboard_window.move (geom.x, geom.y + geom.height - 200); | ||
145 | 112 | keyboard_window.resize (geom.width, 200); | ||
146 | 113 | keyboard_window.set_keep_above (true); | ||
147 | 114 | |||
148 | 115 | keyboard_window.show_all (); | ||
149 | 116 | settings.set_boolean ("greeter", "onscreen-keyboard", true); | ||
150 | 117 | } | ||
151 | 118 | } | ||
152 | 0 | 119 | ||
153 | === modified file 'src/Indicator.vala' | |||
154 | --- src/Indicator.vala 2015-08-04 20:33:38 +0000 | |||
155 | +++ src/Indicator.vala 2015-09-09 21:31:57 +0000 | |||
156 | @@ -21,41 +21,13 @@ | |||
157 | 21 | Wingpanel.Widgets.OverlayIcon panel_icon; | 21 | Wingpanel.Widgets.OverlayIcon panel_icon; |
158 | 22 | Gtk.Grid main_grid; | 22 | Gtk.Grid main_grid; |
159 | 23 | 23 | ||
163 | 24 | KeyFile settings; | 24 | public Wingpanel.IndicatorManager.ServerType server_type { get; construct set; } |
161 | 25 | Gtk.Window keyboard_window; | ||
162 | 26 | int keyboard_pid; | ||
164 | 27 | 25 | ||
166 | 28 | public Indicator () { | 26 | public Indicator (Wingpanel.IndicatorManager.ServerType indicator_server_type) { |
167 | 29 | Object (code_name: "a11y", | 27 | Object (code_name: "a11y", |
168 | 30 | display_name: _("Accessibility"), | 28 | display_name: _("Accessibility"), |
197 | 31 | description: _("Accessibility indicator")); | 29 | description: _("Accessibility indicator"), |
198 | 32 | 30 | server_type: indicator_server_type); | |
171 | 33 | this.visible = true; | ||
172 | 34 | settings = new KeyFile (); | ||
173 | 35 | |||
174 | 36 | /* | ||
175 | 37 | * we could load /etc/lightdm/pantheon-greeter.conf but all keys are commented there. | ||
176 | 38 | * setting defaults instead to prevent needless warnings | ||
177 | 39 | */ | ||
178 | 40 | settings.set_boolean ("greeter", "high-contrast", false); | ||
179 | 41 | settings.set_boolean ("greeter", "onscreen-keyboard", false); | ||
180 | 42 | /* | ||
181 | 43 | * try { | ||
182 | 44 | * settings.load_from_file ("/etc/lightdm/pantheon-greeter.conf", | ||
183 | 45 | * KeyFileFlags.KEEP_COMMENTS); | ||
184 | 46 | * } catch (Error e) { | ||
185 | 47 | * warning (e.message); | ||
186 | 48 | * } | ||
187 | 49 | */ | ||
188 | 50 | } | ||
189 | 51 | |||
190 | 52 | ~Indicator () { | ||
191 | 53 | if (keyboard_pid != 0) { | ||
192 | 54 | Posix.kill (keyboard_pid, Posix.SIGKILL); | ||
193 | 55 | int status; | ||
194 | 56 | Posix.waitpid (keyboard_pid, out status, 0); | ||
195 | 57 | keyboard_pid = 0; | ||
196 | 58 | } | ||
199 | 59 | } | 31 | } |
200 | 60 | 32 | ||
201 | 61 | public override Gtk.Widget get_display_widget () { | 33 | public override Gtk.Widget get_display_widget () { |
202 | @@ -68,79 +40,22 @@ | |||
203 | 68 | 40 | ||
204 | 69 | public override Gtk.Widget? get_widget () { | 41 | public override Gtk.Widget? get_widget () { |
205 | 70 | if (main_grid == null) { | 42 | if (main_grid == null) { |
230 | 71 | int position = 0; | 43 | if (server_type == Wingpanel.IndicatorManager.ServerType.GREETER) { |
231 | 72 | main_grid = new Gtk.Grid (); | 44 | this.visible = true; |
232 | 73 | 45 | main_grid = new GreeterWidget (); | |
233 | 74 | var onscreen_keyboard = new Wingpanel.Widgets.Switch (_("Onscreen Keyboard"), false); | 46 | } else { |
234 | 75 | onscreen_keyboard.switched.connect (() => { | 47 | var visible_settings = new A11ySettings (); |
235 | 76 | toggle_keyboard (onscreen_keyboard.get_active ()); | 48 | this.visible = visible_settings.always_show_universal_access_status; |
236 | 77 | }); | 49 | visible_settings.notify.connect (() => { |
237 | 78 | main_grid.attach (onscreen_keyboard, 0, position++, 1, 1); | 50 | this.visible = visible_settings.always_show_universal_access_status; |
238 | 79 | try { | 51 | }); |
239 | 80 | onscreen_keyboard.set_active (settings.get_boolean ("greeter", "onscreen-keyboard")); | 52 | main_grid = new SessionWidget (); |
216 | 81 | } catch (Error e) { | ||
217 | 82 | warning (e.message); | ||
218 | 83 | } | ||
219 | 84 | |||
220 | 85 | var high_contrast = new Wingpanel.Widgets.Switch (_("HighContrast"), false); | ||
221 | 86 | high_contrast.switched.connect (() => { | ||
222 | 87 | Gtk.Settings.get_default ().gtk_theme_name = high_contrast.get_active () ? "HighContrastInverse" : "elementary"; | ||
223 | 88 | settings.set_boolean ("greeter", "high-contrast", high_contrast.get_active ()); | ||
224 | 89 | }); | ||
225 | 90 | main_grid.attach (high_contrast, 0, position++, 1, 1); | ||
226 | 91 | try { | ||
227 | 92 | high_contrast.set_active (settings.get_boolean ("greeter", "high-contrast")); | ||
228 | 93 | } catch (Error e) { | ||
229 | 94 | warning (e.message); | ||
240 | 95 | } | 53 | } |
241 | 96 | } | 54 | } |
242 | 97 | 55 | ||
243 | 98 | return main_grid; | 56 | return main_grid; |
244 | 99 | } | 57 | } |
245 | 100 | 58 | ||
246 | 101 | private void toggle_keyboard (bool active) { | ||
247 | 102 | if (keyboard_window != null) { | ||
248 | 103 | keyboard_window.visible = active; | ||
249 | 104 | settings.set_boolean ("greeter", "onscreen-keyboard", active); | ||
250 | 105 | |||
251 | 106 | return; | ||
252 | 107 | } | ||
253 | 108 | |||
254 | 109 | int id = 0; | ||
255 | 110 | int onboard_stdout_fd; | ||
256 | 111 | |||
257 | 112 | try { | ||
258 | 113 | string[] argv; | ||
259 | 114 | Shell.parse_argv ("onboard --xid", out argv); | ||
260 | 115 | Process.spawn_async_with_pipes (null, argv, null, SpawnFlags.SEARCH_PATH, null, out keyboard_pid, null, out onboard_stdout_fd, null); | ||
261 | 116 | |||
262 | 117 | var f = FileStream.fdopen (onboard_stdout_fd, "r"); | ||
263 | 118 | var stdout_text = new char[1024]; | ||
264 | 119 | f.gets (stdout_text); | ||
265 | 120 | id = int.parse ((string)stdout_text); | ||
266 | 121 | } catch (Error e) { | ||
267 | 122 | warning (e.message); | ||
268 | 123 | } | ||
269 | 124 | |||
270 | 125 | var keyboard_socket = new Gtk.Socket (); | ||
271 | 126 | keyboard_window = new Gtk.Window (); | ||
272 | 127 | keyboard_window.accept_focus = false; | ||
273 | 128 | keyboard_window.focus_on_map = false; | ||
274 | 129 | keyboard_window.add (keyboard_socket); | ||
275 | 130 | keyboard_socket.add_id (id); | ||
276 | 131 | |||
277 | 132 | var screen = Gdk.Screen.get_default (); | ||
278 | 133 | var monitor = screen.get_primary_monitor (); | ||
279 | 134 | Gdk.Rectangle geom; | ||
280 | 135 | screen.get_monitor_geometry (monitor, out geom); | ||
281 | 136 | keyboard_window.move (geom.x, geom.y + geom.height - 200); | ||
282 | 137 | keyboard_window.resize (geom.width, 200); | ||
283 | 138 | keyboard_window.set_keep_above (true); | ||
284 | 139 | |||
285 | 140 | keyboard_window.show_all (); | ||
286 | 141 | settings.set_boolean ("greeter", "onscreen-keyboard", true); | ||
287 | 142 | } | ||
288 | 143 | |||
289 | 144 | public override void opened () { | 59 | public override void opened () { |
290 | 145 | } | 60 | } |
291 | 146 | 61 | ||
292 | @@ -150,11 +65,5 @@ | |||
293 | 150 | 65 | ||
294 | 151 | public Wingpanel.Indicator? get_indicator (Module module, Wingpanel.IndicatorManager.ServerType server_type) { | 66 | public Wingpanel.Indicator? get_indicator (Module module, Wingpanel.IndicatorManager.ServerType server_type) { |
295 | 152 | debug ("Activating Accessibility Indicator"); | 67 | debug ("Activating Accessibility Indicator"); |
303 | 153 | 68 | return new A11Y.Indicator (server_type); | |
297 | 154 | /* Only show a11y in greeter */ | ||
298 | 155 | if (server_type == Wingpanel.IndicatorManager.ServerType.GREETER) { | ||
299 | 156 | return new A11Y.Indicator (); | ||
300 | 157 | } | ||
301 | 158 | |||
302 | 159 | return null; | ||
304 | 160 | } | 69 | } |
305 | 161 | \ No newline at end of file | 70 | \ No newline at end of file |
306 | 162 | 71 | ||
307 | === added file 'src/SessionSettings.vala' | |||
308 | --- src/SessionSettings.vala 1970-01-01 00:00:00 +0000 | |||
309 | +++ src/SessionSettings.vala 2015-09-09 21:31:57 +0000 | |||
310 | @@ -0,0 +1,68 @@ | |||
311 | 1 | /* | ||
312 | 2 | * Copyright (c) 2015 Pantheon Developers (https://launchpad.net/switchboardswitchboard-plug-a11y) | ||
313 | 3 | * | ||
314 | 4 | * This library is free software; you can redistribute it and/or | ||
315 | 5 | * modify it under the terms of the GNU Library General Public | ||
316 | 6 | * License as published by the Free Software Foundation; either | ||
317 | 7 | * version 3 of the License, or (at your option) any later version. | ||
318 | 8 | * | ||
319 | 9 | * This library is distributed in the hope that it will be useful, | ||
320 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
321 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
322 | 12 | * Library General Public License for more details. | ||
323 | 13 | * | ||
324 | 14 | * You should have received a copy of the GNU Library General Public | ||
325 | 15 | * License along with this library; if not, write to the | ||
326 | 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
327 | 17 | * Boston, MA 02111-1307, USA.Actualy, if you have windows just use | ||
328 | 18 | * | ||
329 | 19 | * Authored by: Felipe Escoto <felescoto95@hotmail.com> | ||
330 | 20 | */ | ||
331 | 21 | |||
332 | 22 | public class A11Y.DesktopInterface : Granite.Services.Settings { | ||
333 | 23 | private const string HIGH_CONTRAST_THEME = "HighContrast"; | ||
334 | 24 | |||
335 | 25 | public string gtk_theme { get; set; } | ||
336 | 26 | public string icon_theme { get; set; } | ||
337 | 27 | |||
338 | 28 | private WmSettings wm_settings; | ||
339 | 29 | |||
340 | 30 | public DesktopInterface () { | ||
341 | 31 | base ("org.gnome.desktop.interface"); | ||
342 | 32 | wm_settings = new WmSettings (); | ||
343 | 33 | } | ||
344 | 34 | |||
345 | 35 | public bool get_high_contrast () { | ||
346 | 36 | if (gtk_theme == HIGH_CONTRAST_THEME) { | ||
347 | 37 | return true; | ||
348 | 38 | } else { | ||
349 | 39 | return false; | ||
350 | 40 | } | ||
351 | 41 | } | ||
352 | 42 | |||
353 | 43 | public void set_high_contrast (bool state) { | ||
354 | 44 | if (state) { | ||
355 | 45 | gtk_theme = HIGH_CONTRAST_THEME; | ||
356 | 46 | icon_theme = HIGH_CONTRAST_THEME; | ||
357 | 47 | } else { | ||
358 | 48 | schema.reset ("gtk-theme"); | ||
359 | 49 | schema.reset ("icon-theme"); | ||
360 | 50 | wm_settings.schema.reset ("theme"); | ||
361 | 51 | } | ||
362 | 52 | } | ||
363 | 53 | } | ||
364 | 54 | |||
365 | 55 | public class A11Y.A11ySettings : Granite.Services.Settings { | ||
366 | 56 | public bool always_show_universal_access_status { get; set; } | ||
367 | 57 | |||
368 | 58 | public A11ySettings () { | ||
369 | 59 | base ("org.gnome.desktop.a11y"); | ||
370 | 60 | } | ||
371 | 61 | } | ||
372 | 62 | |||
373 | 63 | public class A11Y.WmSettings : Granite.Services.Settings { | ||
374 | 64 | public string? theme { get; set; } | ||
375 | 65 | public WmSettings () { | ||
376 | 66 | base ("org.gnome.desktop.wm.preferences"); | ||
377 | 67 | } | ||
378 | 68 | } | ||
379 | 0 | \ No newline at end of file | 69 | \ No newline at end of file |
380 | 1 | 70 | ||
381 | === added file 'src/SessionWidget.vala' | |||
382 | --- src/SessionWidget.vala 1970-01-01 00:00:00 +0000 | |||
383 | +++ src/SessionWidget.vala 2015-09-09 21:31:57 +0000 | |||
384 | @@ -0,0 +1,36 @@ | |||
385 | 1 | /* | ||
386 | 2 | * Copyright (c) 2011-2015 Wingpanel Developers (http://launchpad.net/wingpanel) | ||
387 | 3 | * | ||
388 | 4 | * This program is free software; you can redistribute it and/or | ||
389 | 5 | * modify it under the terms of the GNU General Public | ||
390 | 6 | * License as published by the Free Software Foundation; either | ||
391 | 7 | * version 2 of the License, or (at your option) any later version. | ||
392 | 8 | * | ||
393 | 9 | * This program is distributed in the hope that it will be useful, | ||
394 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
395 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
396 | 12 | * General Public License for more details. | ||
397 | 13 | * | ||
398 | 14 | * You should have received a copy of the GNU General Public | ||
399 | 15 | * License along with this program; if not, write to the | ||
400 | 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
401 | 17 | * Boston, MA 02111-1307, USA. | ||
402 | 18 | */ | ||
403 | 19 | |||
404 | 20 | public class A11Y.SessionWidget : Gtk.Grid { | ||
405 | 21 | |||
406 | 22 | public SessionWidget () { | ||
407 | 23 | var desktop_interface = new DesktopInterface (); | ||
408 | 24 | |||
409 | 25 | var high_contrast = new Wingpanel.Widgets.Switch (_("HighContrast"), false); | ||
410 | 26 | high_contrast.switched.connect (() => { | ||
411 | 27 | desktop_interface.set_high_contrast (high_contrast.get_active ()); | ||
412 | 28 | }); | ||
413 | 29 | attach (high_contrast, 0, 0, 1, 1); | ||
414 | 30 | high_contrast.set_active (desktop_interface.get_high_contrast ()); | ||
415 | 31 | desktop_interface.notify["gtk-theme"].connect (() => { | ||
416 | 32 | high_contrast.set_active (desktop_interface.get_high_contrast ()); | ||
417 | 33 | }); | ||
418 | 34 | } | ||
419 | 35 | |||
420 | 36 | } |