Merge lp:~l-admin-3/switchboard-plug-mouse-touchpad/frontend-update into lp:~elementary-pantheon/switchboard-plug-mouse-touchpad/trunk
- frontend-update
- Merge into trunk
Proposed by
Marcus Wichelmann
Status: | Merged | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Approved by: | Felipe Escoto | ||||||||||||
Approved revision: | 17 | ||||||||||||
Merged at revision: | 19 | ||||||||||||
Proposed branch: | lp:~l-admin-3/switchboard-plug-mouse-touchpad/frontend-update | ||||||||||||
Merge into: | lp:~elementary-pantheon/switchboard-plug-mouse-touchpad/trunk | ||||||||||||
Diff against target: |
1355 lines (+484/-663) 16 files modified
AUTHORS (+4/-3) COPYRIGHT (+0/-5) po/pantheon-mouse-touchpad.pot (+64/-58) src/Backend/MouseSettings.vala (+29/-0) src/Backend/TouchpadSettings.vala (+32/-0) src/CMakeLists.txt (+7/-8) src/Pages/Mouse/mouse-page.vala (+0/-95) src/Pages/Mouse/mouse-settings.vala (+0/-31) src/Pages/Touchpad/touchpad-page.vala (+0/-280) src/Pages/Touchpad/touchpad-settings.vala (+0/-41) src/Widgets/GeneralSection.vala (+58/-0) src/Widgets/MouseSection.vala (+62/-0) src/Widgets/Section.vala (+64/-0) src/Widgets/TouchpadSection.vala (+114/-0) src/mouse-touchpad.vala (+50/-115) src/page.vala (+0/-27) |
||||||||||||
To merge this branch: | bzr merge lp:~l-admin-3/switchboard-plug-mouse-touchpad/frontend-update | ||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Felipe Escoto (community) | code | Approve | |
Danielle Foré | ux | Approve | |
Review via email: mp+268857@code.launchpad.net |
Commit message
Frontend update.
Description of the change
This branch updates the gui of the plug like shown in the mockup together with some code improvements.
To post a comment you must log in.
Revision history for this message
Felipe Escoto (philip.scott) : | # |
review:
Approve
Revision history for this message
Felipe Escoto (philip.scott) : | # |
review:
Approve
(code)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '.bzrignore' (properties changed: -x to +x) |
2 | === modified file 'AUTHORS' (properties changed: -x to +x) |
3 | --- AUTHORS 2014-07-22 05:50:56 +0000 |
4 | +++ AUTHORS 2015-08-23 23:11:04 +0000 |
5 | @@ -1,4 +1,5 @@ |
6 | -Copyright (c) 2014 by XXX Developers |
7 | +Copyright (c) 2015 by elementary Developers |
8 | |
9 | -Written by XXX Developers: |
10 | -* YOUR NAME <email@provider.com> |
11 | +Written by elementary Developers: |
12 | +* Keith Gonyon |
13 | +* Marcus Wichelmann <marcus.wichelmann@hotmail.de> |
14 | |
15 | === modified file 'CMakeLists.txt' (properties changed: -x to +x) |
16 | === modified file 'COPYING' (properties changed: -x to +x) |
17 | === removed file 'COPYRIGHT' |
18 | --- COPYRIGHT 2014-07-22 05:50:56 +0000 |
19 | +++ COPYRIGHT 1970-01-01 00:00:00 +0000 |
20 | @@ -1,5 +0,0 @@ |
21 | -Sample |
22 | -Copyright (C) 2014 by the following: |
23 | - |
24 | -If you have contributed to this project then you deserve to be on this list. |
25 | -Contact us (see: AUTHORS) and we'll add you. |
26 | |
27 | === modified file 'INSTALL' (properties changed: -x to +x) |
28 | === modified file 'cmake/FindGirCompiler.cmake' (properties changed: -x to +x) |
29 | === modified file 'cmake/FindVala.cmake' (properties changed: -x to +x) |
30 | === modified file 'cmake/GObjectIntrospectionMacros.cmake' (properties changed: -x to +x) |
31 | === modified file 'cmake/GSettings.cmake' (properties changed: -x to +x) |
32 | === modified file 'cmake/ParseArguments.cmake' (properties changed: -x to +x) |
33 | === modified file 'cmake/README' (properties changed: -x to +x) |
34 | === modified file 'cmake/README.Vala.rst' (properties changed: -x to +x) |
35 | === modified file 'cmake/Tests.cmake' (properties changed: -x to +x) |
36 | === modified file 'cmake/Translations.cmake' (properties changed: -x to +x) |
37 | === modified file 'cmake/ValaPrecompile.cmake' (properties changed: -x to +x) |
38 | === modified file 'cmake/ValaVersion.cmake' (properties changed: -x to +x) |
39 | === modified file 'config.vala.cmake' (properties changed: -x to +x) |
40 | === modified file 'debian/changelog' (properties changed: -x to +x) |
41 | === modified file 'debian/compat' (properties changed: -x to +x) |
42 | === modified file 'debian/control' (properties changed: -x to +x) |
43 | === modified file 'debian/copyright' (properties changed: -x to +x) |
44 | === modified file 'debian/source/format' (properties changed: -x to +x) |
45 | === modified file 'plug.plugin' (properties changed: -x to +x) |
46 | === modified file 'po/CMakeLists.txt' (properties changed: -x to +x) |
47 | === modified file 'po/ca.po' (properties changed: -x to +x) |
48 | === modified file 'po/eo.po' (properties changed: -x to +x) |
49 | === modified file 'po/es.po' (properties changed: -x to +x) |
50 | === modified file 'po/fi.po' (properties changed: -x to +x) |
51 | === modified file 'po/fr.po' (properties changed: -x to +x) |
52 | === modified file 'po/it.po' (properties changed: -x to +x) |
53 | === modified file 'po/pantheon-mouse-touchpad.pot' (properties changed: -x to +x) |
54 | --- po/pantheon-mouse-touchpad.pot 2014-07-25 05:27:41 +0000 |
55 | +++ po/pantheon-mouse-touchpad.pot 2015-08-23 23:11:04 +0000 |
56 | @@ -1,3 +1,4 @@ |
57 | +# SOME DESCRIPTIVE TITLE. |
58 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER |
59 | # This file is distributed under the same license as the PACKAGE package. |
60 | # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
61 | @@ -7,7 +8,7 @@ |
62 | msgstr "" |
63 | "Project-Id-Version: PACKAGE VERSION\n" |
64 | "Report-Msgid-Bugs-To: \n" |
65 | -"POT-Creation-Date: 2014-07-24 22:24-0700\n" |
66 | +"POT-Creation-Date: 2015-08-24 01:07+0200\n" |
67 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
68 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
69 | "Language-Team: LANGUAGE <LL@li.org>\n" |
70 | @@ -16,73 +17,78 @@ |
71 | "Content-Type: text/plain; charset=CHARSET\n" |
72 | "Content-Transfer-Encoding: 8bit\n" |
73 | |
74 | -#: ../src/mouse-touchpad.vala:25 |
75 | +#: ../src/mouse-touchpad.vala:34 |
76 | msgid "Mouse & Touchpad" |
77 | msgstr "" |
78 | |
79 | -#: ../src/mouse-touchpad.vala:26 |
80 | +#: ../src/mouse-touchpad.vala:35 |
81 | msgid "Set your mouse and touchpad preferences" |
82 | msgstr "" |
83 | |
84 | -#: ../src/mouse-touchpad.vala:41 ../src/Pages/Touchpad/touchpad-page.vala:46 |
85 | -msgid "<b>General:</b>" |
86 | -msgstr "" |
87 | - |
88 | -#: ../src/mouse-touchpad.vala:43 |
89 | -msgid "Left-handed" |
90 | -msgstr "" |
91 | - |
92 | -#: ../src/mouse-touchpad.vala:45 |
93 | -msgid "Right-handed" |
94 | -msgstr "" |
95 | - |
96 | -#: ../src/mouse-touchpad.vala:47 |
97 | -msgid "Pointer Reveal" |
98 | -msgstr "" |
99 | - |
100 | -#: ../src/mouse-touchpad.vala:104 |
101 | +#: ../src/Widgets/GeneralSection.vala:27 |
102 | +msgid "General" |
103 | +msgstr "" |
104 | + |
105 | +#: ../src/Widgets/GeneralSection.vala:37 |
106 | +msgid "Left" |
107 | +msgstr "" |
108 | + |
109 | +#: ../src/Widgets/GeneralSection.vala:38 |
110 | +msgid "Right" |
111 | +msgstr "" |
112 | + |
113 | +#: ../src/Widgets/GeneralSection.vala:43 |
114 | +msgid "Primary Button:" |
115 | +msgstr "" |
116 | + |
117 | +#: ../src/Widgets/GeneralSection.vala:44 |
118 | +msgid "Reveal pointer:" |
119 | +msgstr "" |
120 | + |
121 | +#: ../src/Widgets/GeneralSection.vala:44 |
122 | +msgid "Pressing the control key will highlight the position of the pointer" |
123 | +msgstr "" |
124 | + |
125 | +#: ../src/Widgets/MouseSection.vala:26 |
126 | msgid "Mouse" |
127 | msgstr "" |
128 | |
129 | -#: ../src/mouse-touchpad.vala:105 |
130 | +#: ../src/Widgets/MouseSection.vala:40 ../src/Widgets/TouchpadSection.vala:64 |
131 | +msgid "Pointer speed:" |
132 | +msgstr "" |
133 | + |
134 | +#: ../src/Widgets/TouchpadSection.vala:31 |
135 | msgid "Touchpad" |
136 | msgstr "" |
137 | |
138 | -#: ../src/Pages/Mouse/mouse-page.vala:16 |
139 | -#: ../src/Pages/Touchpad/touchpad-page.vala:41 |
140 | -msgid "<b>Pointer Speed:</b>" |
141 | -msgstr "" |
142 | - |
143 | -#: ../src/Pages/Mouse/mouse-page.vala:17 |
144 | -#: ../src/Pages/Touchpad/touchpad-page.vala:42 |
145 | -msgid "<i>Slow</i>" |
146 | -msgstr "" |
147 | - |
148 | -#: ../src/Pages/Mouse/mouse-page.vala:18 |
149 | -#: ../src/Pages/Touchpad/touchpad-page.vala:43 |
150 | -msgid "<i>Fast</i>" |
151 | -msgstr "" |
152 | - |
153 | -#: ../src/Pages/Touchpad/touchpad-page.vala:47 |
154 | -msgid "Disable while typing" |
155 | -msgstr "" |
156 | - |
157 | -#: ../src/Pages/Touchpad/touchpad-page.vala:48 |
158 | -msgid "Tap to click" |
159 | -msgstr "" |
160 | - |
161 | -#: ../src/Pages/Touchpad/touchpad-page.vala:50 |
162 | -msgid "<b>Scrolling:</b>" |
163 | -msgstr "" |
164 | - |
165 | -#: ../src/Pages/Touchpad/touchpad-page.vala:52 |
166 | -msgid "Natural scrolling" |
167 | -msgstr "" |
168 | - |
169 | -#: ../src/Pages/Touchpad/touchpad-page.vala:53 |
170 | -msgid "Horizontal scrolling" |
171 | -msgstr "" |
172 | - |
173 | -#: ../src/Pages/Touchpad/touchpad-page.vala:54 |
174 | -msgid "Two finger scrolling" |
175 | +#: ../src/Widgets/TouchpadSection.vala:52 |
176 | +msgid "Two-finger" |
177 | +msgstr "" |
178 | + |
179 | +#: ../src/Widgets/TouchpadSection.vala:53 |
180 | +msgid "Edge" |
181 | +msgstr "" |
182 | + |
183 | +#: ../src/Widgets/TouchpadSection.vala:54 |
184 | +msgid "Disabled" |
185 | +msgstr "" |
186 | + |
187 | +#: ../src/Widgets/TouchpadSection.vala:62 |
188 | +msgid "Disable while typing:" |
189 | +msgstr "" |
190 | + |
191 | +#: ../src/Widgets/TouchpadSection.vala:63 |
192 | +msgid "Tap to click:" |
193 | +msgstr "" |
194 | + |
195 | +#: ../src/Widgets/TouchpadSection.vala:65 |
196 | +msgid "Scrolling:" |
197 | +msgstr "" |
198 | + |
199 | +#: ../src/Widgets/TouchpadSection.vala:66 |
200 | +msgid "Horizontal scrolling:" |
201 | +msgstr "" |
202 | + |
203 | +#: ../src/Widgets/TouchpadSection.vala:67 |
204 | +msgid "Natural scrolling:" |
205 | msgstr "" |
206 | |
207 | === modified file 'po/pl.po' (properties changed: -x to +x) |
208 | === added directory 'src/Backend' |
209 | === added file 'src/Backend/MouseSettings.vala' |
210 | --- src/Backend/MouseSettings.vala 1970-01-01 00:00:00 +0000 |
211 | +++ src/Backend/MouseSettings.vala 2015-08-23 23:11:04 +0000 |
212 | @@ -0,0 +1,29 @@ |
213 | +/* |
214 | + * Copyright (c) 2011-2015 elementary Developers (https://launchpad.net/elementary) |
215 | + * |
216 | + * This program is free software; you can redistribute it and/or |
217 | + * modify it under the terms of the GNU General Public |
218 | + * License as published by the Free Software Foundation; either |
219 | + * version 2 of the License, or (at your option) any later version. |
220 | + * |
221 | + * This program is distributed in the hope that it will be useful, |
222 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
223 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
224 | + * General Public License for more details. |
225 | + * |
226 | + * You should have received a copy of the GNU General Public |
227 | + * License along with this program; if not, write to the |
228 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
229 | + * Boston, MA 02111-1307, USA. |
230 | + */ |
231 | + |
232 | +public class MouseTouchpad.Backend.MouseSettings : Granite.Services.Settings { |
233 | + public bool left_handed { get; set; } |
234 | + public bool locate_pointer { get; set; } |
235 | + public double motion_acceleration { get; set; } |
236 | + public int motion_threshold { get; set; } |
237 | + |
238 | + public MouseSettings () { |
239 | + base ("org.gnome.settings-daemon.peripherals.mouse"); |
240 | + } |
241 | +} |
242 | \ No newline at end of file |
243 | |
244 | === added file 'src/Backend/TouchpadSettings.vala' |
245 | --- src/Backend/TouchpadSettings.vala 1970-01-01 00:00:00 +0000 |
246 | +++ src/Backend/TouchpadSettings.vala 2015-08-23 23:11:04 +0000 |
247 | @@ -0,0 +1,32 @@ |
248 | +/* |
249 | + * Copyright (c) 2011-2015 elementary Developers (https://launchpad.net/elementary) |
250 | + * |
251 | + * This program is free software; you can redistribute it and/or |
252 | + * modify it under the terms of the GNU General Public |
253 | + * License as published by the Free Software Foundation; either |
254 | + * version 2 of the License, or (at your option) any later version. |
255 | + * |
256 | + * This program is distributed in the hope that it will be useful, |
257 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
258 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
259 | + * General Public License for more details. |
260 | + * |
261 | + * You should have received a copy of the GNU General Public |
262 | + * License along with this program; if not, write to the |
263 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
264 | + * Boston, MA 02111-1307, USA. |
265 | + */ |
266 | + |
267 | +public class MouseTouchpad.Backend.TouchpadSettings : Granite.Services.Settings { |
268 | + public bool disable_while_typing { get; set; } |
269 | + public bool tap_to_click { get; set; } |
270 | + public double motion_acceleration { get; set; } |
271 | + public int motion_threshold { get; set; } |
272 | + public string scroll_method { get; set; } |
273 | + public bool horiz_scroll_enabled { get; set; } |
274 | + public bool natural_scroll { get; set; } |
275 | + |
276 | + public TouchpadSettings () { |
277 | + base ("org.gnome.settings-daemon.peripherals.touchpad"); |
278 | + } |
279 | +} |
280 | \ No newline at end of file |
281 | |
282 | === modified file 'src/CMakeLists.txt' (properties changed: -x to +x) |
283 | --- src/CMakeLists.txt 2014-07-23 01:13:33 +0000 |
284 | +++ src/CMakeLists.txt 2015-08-23 23:11:04 +0000 |
285 | @@ -4,6 +4,7 @@ |
286 | pkg_check_modules (DEPS REQUIRED gthread-2.0 gtk+-3.0 switchboard-2.0 granite) |
287 | |
288 | add_definitions (${DEPS_CFLAGS}) |
289 | +add_definitions ("-w") |
290 | link_directories (${DEPS_LIBRARY_DIRS}) |
291 | |
292 | find_package (Vala REQUIRED) |
293 | @@ -14,14 +15,12 @@ |
294 | # Add all your vala files and requires packages to the List below to include them in the build |
295 | vala_precompile (VALA_C ${CMAKE_PROJECT_NAME} |
296 | mouse-touchpad.vala |
297 | - page.vala |
298 | - |
299 | - Pages/Mouse/mouse-page.vala |
300 | - Pages/Mouse/mouse-settings.vala |
301 | - |
302 | - Pages/Touchpad/touchpad-page.vala |
303 | - Pages/Touchpad/touchpad-settings.vala |
304 | - |
305 | + Backend/MouseSettings.vala |
306 | + Backend/TouchpadSettings.vala |
307 | + Widgets/Section.vala |
308 | + Widgets/GeneralSection.vala |
309 | + Widgets/MouseSection.vala |
310 | + Widgets/TouchpadSection.vala |
311 | ${CMAKE_CURRENT_BINARY_DIR}/config.vala |
312 | PACKAGES |
313 | gtk+-3.0 |
314 | |
315 | === removed directory 'src/Pages' |
316 | === removed directory 'src/Pages/Mouse' |
317 | === removed file 'src/Pages/Mouse/mouse-page.vala' |
318 | --- src/Pages/Mouse/mouse-page.vala 2014-07-25 19:34:08 +0000 |
319 | +++ src/Pages/Mouse/mouse-page.vala 1970-01-01 00:00:00 +0000 |
320 | @@ -1,95 +0,0 @@ |
321 | -/*** |
322 | - Copyright (C) 2014 Keith Gonyon <kgonyon@gmail.com> |
323 | - This program is free software: you can redistribute it and/or modify it |
324 | - under the terms of the GNU Lesser General Public License version 3, as published |
325 | - by the Free Software Foundation. |
326 | - This program is distributed in the hope that it will be useful, but |
327 | - WITHOUT ANY WARRANTY; without even the implied warranties of |
328 | - MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
329 | - PURPOSE. See the GNU General Public License for more details. |
330 | - You should have received a copy of the GNU General Public License along |
331 | - with this program. If not, see |
332 | -***/ |
333 | -namespace MouseTouchpad { |
334 | - public class MousePage : AbstractPage { |
335 | - /* ---- Layout Variables ---- */ |
336 | - |
337 | - Gtk.Grid pointer_scale_grid; |
338 | - |
339 | - /* ---- Widget Variables ---- */ |
340 | - |
341 | - Gtk.Label pointer_speed_label; |
342 | - Gtk.Label acceleration_slow_label; |
343 | - Gtk.Label acceleration_fast_label; |
344 | - Gtk.Scale acceleration_scale; |
345 | - |
346 | - private MouseSettings mouse_settings; |
347 | - |
348 | - public MousePage () { |
349 | - /* ---- Init Settings ---- */ |
350 | - |
351 | - mouse_settings = new MouseSettings (); |
352 | - |
353 | - /* ---- Init Widgets ---- */ |
354 | - |
355 | - // Pointer speed |
356 | - pointer_scale_grid = new Gtk.Grid (); |
357 | - pointer_speed_label = new Gtk.Label (_("<b>Pointer Speed:</b>")); |
358 | - acceleration_slow_label = new Gtk.Label(_("<i>Slow</i>")); |
359 | - acceleration_fast_label = new Gtk.Label(_("<i>Fast</i>")); |
360 | - acceleration_scale = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 1, 10, 1); |
361 | - |
362 | - setup_widgets (); |
363 | - setup_signals (); |
364 | - |
365 | - /* ---- Attach widgets ---- */ |
366 | - |
367 | - // Pointer speed |
368 | - pointer_scale_grid.attach (acceleration_slow_label, 0, 1, 1, 1); |
369 | - pointer_scale_grid.attach (acceleration_scale, 1, 1, 3, 1); |
370 | - pointer_scale_grid.attach (acceleration_fast_label, 4, 1, 1, 1); |
371 | - this.attach (pointer_speed_label, 0, 0, 1, 1); |
372 | - this.attach (pointer_scale_grid, 0, 1, 1, 1); |
373 | - } |
374 | - |
375 | - public override void reset () { |
376 | - |
377 | - } |
378 | - |
379 | - private void setup_widgets () { |
380 | - /* ---- Grids ---- */ |
381 | - |
382 | - // Pointer Scale |
383 | - pointer_scale_grid.column_spacing = 12; |
384 | - pointer_scale_grid.margin_top = 12; |
385 | - pointer_scale_grid.margin_start = 12; |
386 | - pointer_scale_grid.column_homogeneous = false; |
387 | - pointer_scale_grid.row_homogeneous = false; |
388 | - |
389 | - /* ---- Widgets ---- */ |
390 | - |
391 | - // Pointer speed |
392 | - pointer_speed_label.halign = Gtk.Align.START; |
393 | - pointer_speed_label.use_markup = true; |
394 | - acceleration_fast_label.use_markup = true; |
395 | - acceleration_slow_label.use_markup = true; |
396 | - acceleration_scale.draw_value = false; |
397 | - acceleration_scale.hexpand = true; |
398 | - acceleration_scale.set_value (mouse_settings.motion_acceleration); |
399 | - |
400 | - } |
401 | - |
402 | - private void setup_signals () { |
403 | - // Pointer Speed |
404 | - acceleration_scale.value_changed.connect (() => { |
405 | - mouse_settings.motion_acceleration = acceleration_scale.adjustment.value; |
406 | - mouse_settings.motion_threshold = (int) (11.0 - acceleration_scale.adjustment.value); |
407 | - }); |
408 | - |
409 | - mouse_settings.changed["motion-acceleration"].connect (() => { |
410 | - acceleration_scale.adjustment.value = mouse_settings.motion_acceleration; |
411 | - }); |
412 | - |
413 | - } |
414 | - } |
415 | -} |
416 | \ No newline at end of file |
417 | |
418 | === removed file 'src/Pages/Mouse/mouse-settings.vala' |
419 | --- src/Pages/Mouse/mouse-settings.vala 2014-07-27 22:49:48 +0000 |
420 | +++ src/Pages/Mouse/mouse-settings.vala 1970-01-01 00:00:00 +0000 |
421 | @@ -1,31 +0,0 @@ |
422 | -/*** |
423 | - Copyright (C) 2014 Keith Gonyon <kgonyon@gmail.com> |
424 | - This program is free software: you can redistribute it and/or modify it |
425 | - under the terms of the GNU Lesser General Public License version 3, as published |
426 | - by the Free Software Foundation. |
427 | - This program is distributed in the hope that it will be useful, but |
428 | - WITHOUT ANY WARRANTY; without even the implied warranties of |
429 | - MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
430 | - PURPOSE. See the GNU General Public License for more details. |
431 | - You should have received a copy of the GNU General Public License along |
432 | - with this program. If not, see |
433 | -***/ |
434 | -namespace MouseTouchpad { |
435 | - class MouseSettings : Granite.Services.Settings { |
436 | - public double motion_acceleration { get; set; } |
437 | - public int motion_threshold { get; set; } |
438 | - public bool left_handed { get; set; } |
439 | - public bool locate_pointer { get; set; } |
440 | - |
441 | - public MouseSettings () { |
442 | - base ("org.gnome.settings-daemon.peripherals.mouse"); |
443 | - } |
444 | - |
445 | - // public void reset_all () { |
446 | - // schema.reset ("motion-acceleration"); |
447 | - // schema.reset ("motion-threshold"); |
448 | - // schema.reset ("left-handed"); |
449 | - // schema.reset ("locate-pointer"); |
450 | - // } |
451 | - } |
452 | -} |
453 | \ No newline at end of file |
454 | |
455 | === removed directory 'src/Pages/Touchpad' |
456 | === removed file 'src/Pages/Touchpad/touchpad-page.vala' |
457 | --- src/Pages/Touchpad/touchpad-page.vala 2014-07-27 22:49:48 +0000 |
458 | +++ src/Pages/Touchpad/touchpad-page.vala 1970-01-01 00:00:00 +0000 |
459 | @@ -1,280 +0,0 @@ |
460 | -/*** |
461 | - Copyright (C) 2014 Keith Gonyon <kgonyon@gmail.com> |
462 | - This program is free software: you can redistribute it and/or modify it |
463 | - under the terms of the GNU Lesser General Public License version 3, as published |
464 | - by the Free Software Foundation. |
465 | - This program is distributed in the hope that it will be useful, but |
466 | - WITHOUT ANY WARRANTY; without even the implied warranties of |
467 | - MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
468 | - PURPOSE. See the GNU General Public License for more details. |
469 | - You should have received a copy of the GNU General Public License along |
470 | - with this program. If not, see |
471 | -***/ |
472 | -namespace MouseTouchpad { |
473 | - public class TouchpadPage : AbstractPage { |
474 | - /* ---- Layout variables ---- */ |
475 | - |
476 | - // Pointer Speed |
477 | - Gtk.Grid pointer_speed_grid; |
478 | - Gtk.Grid pointer_scale_grid; |
479 | - |
480 | - // General |
481 | - Gtk.Grid general_grid; |
482 | - |
483 | - // Scrolling |
484 | - Gtk.Grid scrolling_grid; |
485 | - Gtk.Grid scrolling_label_grid; |
486 | - |
487 | - /* ---- Widget Variables ---- */ |
488 | - |
489 | - // Pointer speed variables |
490 | - Gtk.Label pointer_speed_label; |
491 | - Gtk.Label acceleration_slow_label; |
492 | - Gtk.Label acceleration_fast_label; |
493 | - Gtk.Scale acceleration_scale; |
494 | - |
495 | - // General variables |
496 | - Gtk.Label general_label; |
497 | - Gtk.CheckButton disable_while_typing_check; |
498 | - Gtk.CheckButton tap_to_click_check; |
499 | - |
500 | - // Scrolling variables |
501 | - Gtk.Label scrolling_label; |
502 | - Gtk.Switch scrolling_switch; |
503 | - Gtk.CheckButton natural_scrolling_check; |
504 | - Gtk.CheckButton horizontal_scrolling_check; |
505 | - Gtk.CheckButton scrolling_two_finger_radio; |
506 | - |
507 | - |
508 | - private TouchpadSettings touchpad_settings; |
509 | - private string previous_scroll_method; |
510 | - |
511 | - public TouchpadPage () { |
512 | - touchpad_settings = new TouchpadSettings (); |
513 | - /* ---- Init Grids ---- */ |
514 | - |
515 | - scrolling_grid = new Gtk.Grid (); |
516 | - scrolling_label_grid = new Gtk.Grid (); |
517 | - general_grid = new Gtk.Grid (); |
518 | - pointer_speed_grid = new Gtk.Grid (); |
519 | - pointer_scale_grid = new Gtk.Grid (); |
520 | - |
521 | - /* ---- Init Widgets ---- */ |
522 | - |
523 | - // Pointer speed |
524 | - pointer_speed_label = new Gtk.Label (_("<b>Pointer Speed:</b>")); |
525 | - acceleration_slow_label = new Gtk.Label(_("<i>Slow</i>")); |
526 | - acceleration_fast_label = new Gtk.Label(_("<i>Fast</i>")); |
527 | - acceleration_scale = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 1, 10, 1); |
528 | - |
529 | - //General |
530 | - general_label = new Gtk.Label (_("<b>General:</b>")); |
531 | - disable_while_typing_check = new Gtk.CheckButton.with_label (_("Disable while typing")); |
532 | - tap_to_click_check = new Gtk.CheckButton.with_label (_("Tap to click")); |
533 | - |
534 | - // Scrolling |
535 | - scrolling_label = new Gtk.Label (_("<b>Scrolling:</b>")); |
536 | - scrolling_switch = new Gtk.Switch (); |
537 | - natural_scrolling_check = new Gtk.CheckButton.with_label (_("Natural scrolling")); |
538 | - horizontal_scrolling_check = new Gtk.CheckButton.with_label (_("Horizontal scrolling")); |
539 | - scrolling_two_finger_radio = new Gtk.CheckButton.with_label (_("Two finger scrolling")); |
540 | - |
541 | - setup_widgets (); |
542 | - setup_signals (); |
543 | - |
544 | - /* ---- Attach widgets ---- */ |
545 | - |
546 | - // Pointer speed |
547 | - pointer_scale_grid.attach (acceleration_slow_label, 0, 1, 1, 1); |
548 | - pointer_scale_grid.attach (acceleration_scale, 1, 1, 3, 1); |
549 | - pointer_scale_grid.attach (acceleration_fast_label, 4, 1, 1, 1); |
550 | - pointer_speed_grid.attach (pointer_speed_label, 0, 0, 1, 1); |
551 | - pointer_speed_grid.attach (pointer_scale_grid, 0, 1, 1, 1); |
552 | - |
553 | - // General |
554 | - general_grid.attach(disable_while_typing_check, 0, 0, 1, 1); |
555 | - general_grid.attach(tap_to_click_check, 0, 1, 1, 1); |
556 | - |
557 | - // Scrolling |
558 | - scrolling_label_grid.attach (scrolling_label, 0, 0, 1, 1); |
559 | - scrolling_label_grid.attach (scrolling_switch, 1, 0, 1, 1); |
560 | - scrolling_grid.attach (natural_scrolling_check, 0, 0, 1, 1); |
561 | - scrolling_grid.attach (horizontal_scrolling_check, 0, 1, 1, 1); |
562 | - scrolling_grid.attach (scrolling_two_finger_radio, 0, 2, 1, 1); |
563 | - |
564 | - // Main |
565 | - this.attach (pointer_speed_grid, 0, 0, 2, 1); |
566 | - this.attach (general_label, 0, 1, 1, 1); |
567 | - this.attach (general_grid, 0, 2, 1, 1); |
568 | - this.attach (scrolling_label_grid, 1, 1, 1, 1); |
569 | - this.attach (scrolling_grid, 1, 2, 1, 1); |
570 | - } |
571 | - |
572 | - public override void reset () { |
573 | - |
574 | - } |
575 | - |
576 | - private void setup_widgets () { |
577 | - /* ---- Grids ---- */ |
578 | - |
579 | - // Pointer Speed |
580 | - pointer_scale_grid.row_spacing = 12; |
581 | - pointer_scale_grid.column_spacing = 12; |
582 | - pointer_scale_grid.margin_top = 12; |
583 | - pointer_scale_grid.margin_start = 12; |
584 | - pointer_scale_grid.column_homogeneous = false; |
585 | - pointer_scale_grid.row_homogeneous = false; |
586 | - pointer_speed_grid.row_spacing = 12; |
587 | - pointer_speed_grid.column_spacing = 12; |
588 | - pointer_speed_grid.column_homogeneous = false; |
589 | - pointer_speed_grid.row_homogeneous = false; |
590 | - |
591 | - //General |
592 | - general_grid.margin_start = 12; |
593 | - general_grid.row_spacing = 12; |
594 | - general_grid.column_spacing = 12; |
595 | - general_grid.column_homogeneous = false; |
596 | - general_grid.row_homogeneous = false; |
597 | - |
598 | - //Scrolling |
599 | - scrolling_grid.margin_start = 12; |
600 | - scrolling_grid.row_spacing = 12; |
601 | - scrolling_grid.column_spacing = 12; |
602 | - scrolling_grid.column_homogeneous = false; |
603 | - scrolling_grid.row_homogeneous = false; |
604 | - scrolling_label_grid.hexpand = false; |
605 | - scrolling_label_grid.column_homogeneous = false; |
606 | - scrolling_label_grid.column_spacing = 12; |
607 | - |
608 | - /* ---- Widgets ---- */ |
609 | - |
610 | - // Pointer speed |
611 | - pointer_speed_label.halign = Gtk.Align.START; |
612 | - pointer_speed_label.use_markup = true; |
613 | - acceleration_fast_label.use_markup = true; |
614 | - acceleration_slow_label.use_markup = true; |
615 | - acceleration_scale.draw_value = false; |
616 | - acceleration_scale.hexpand = true; |
617 | - acceleration_scale.set_value (touchpad_settings.motion_acceleration); |
618 | - |
619 | - // General |
620 | - general_label.halign = Gtk.Align.START; |
621 | - general_label.use_markup = true; |
622 | - tap_to_click_check.active = touchpad_settings.tap_to_click; |
623 | - disable_while_typing_check.active = touchpad_settings.disable_while_typing; |
624 | - |
625 | - // Scrolling |
626 | - scrolling_label.halign = Gtk.Align.START; |
627 | - scrolling_label.use_markup = true; |
628 | - natural_scrolling_check.active = touchpad_settings.natural_scroll; |
629 | - horizontal_scrolling_check.active = touchpad_settings.horiz_scroll_enabled; |
630 | - |
631 | - var scroll_method = touchpad_settings.scroll_method; |
632 | - if (scroll_method == TouchpadSettings.SCROLL_METHOD_DISABLED) { |
633 | - scrolling_switch.active = false; |
634 | - scrolling_two_finger_radio.sensitive = false; |
635 | - natural_scrolling_check.sensitive = false; |
636 | - horizontal_scrolling_check.sensitive = false; |
637 | - previous_scroll_method = TouchpadSettings.SCROLL_METHOD_EDGE; |
638 | - } |
639 | - else if (scroll_method == TouchpadSettings.SCROLL_METHOD_EDGE) { |
640 | - scrolling_switch.active = true; |
641 | - scrolling_two_finger_radio.active = false; |
642 | - } |
643 | - else if (scroll_method == TouchpadSettings.SCROLL_METHOD_TWO_FINGER) { |
644 | - scrolling_switch.active = true; |
645 | - scrolling_two_finger_radio.active = true; |
646 | - } |
647 | - } |
648 | - |
649 | - private void setup_signals () { |
650 | - // Pointer Speed |
651 | - acceleration_scale.value_changed.connect (() => { |
652 | - touchpad_settings.motion_acceleration = acceleration_scale.adjustment.value; |
653 | - touchpad_settings.motion_threshold = (int) (11 - acceleration_scale.adjustment.value); |
654 | - }); |
655 | - |
656 | - touchpad_settings.changed["motion-acceleration"].connect (() => { |
657 | - acceleration_scale.adjustment.value = touchpad_settings.motion_acceleration; |
658 | - }); |
659 | - |
660 | - //General |
661 | - touchpad_settings.changed["disable-while-typing"].connect (() => { |
662 | - disable_while_typing_check.active = touchpad_settings.disable_while_typing; |
663 | - }); |
664 | - |
665 | - touchpad_settings.changed["tap-to-click"].connect (() => { |
666 | - tap_to_click_check.active = touchpad_settings.tap_to_click; |
667 | - }); |
668 | - |
669 | - disable_while_typing_check.notify["active"].connect (() => { |
670 | - touchpad_settings.disable_while_typing = disable_while_typing_check.active; |
671 | - }); |
672 | - |
673 | - tap_to_click_check.notify["active"].connect (() => { |
674 | - touchpad_settings.tap_to_click = tap_to_click_check.active; |
675 | - }); |
676 | - |
677 | - // Scrolling |
678 | - touchpad_settings.changed["natural-scroll"].connect (() => { |
679 | - natural_scrolling_check.active = touchpad_settings.natural_scroll; |
680 | - }); |
681 | - |
682 | - touchpad_settings.changed["horiz-scroll-enabled"].connect (() => { |
683 | - horizontal_scrolling_check.active = touchpad_settings.horiz_scroll_enabled; |
684 | - }); |
685 | - |
686 | - touchpad_settings.changed["scroll-method"].connect (() => { |
687 | - var scroll_method = touchpad_settings.scroll_method; |
688 | - if (scroll_method == TouchpadSettings.SCROLL_METHOD_DISABLED) |
689 | - scrolling_switch.active = false; |
690 | - else if (scroll_method == TouchpadSettings.SCROLL_METHOD_EDGE) { |
691 | - scrolling_switch.active = true; |
692 | - scrolling_two_finger_radio.active = false; |
693 | - } |
694 | - else { |
695 | - scrolling_switch.active = true; |
696 | - scrolling_two_finger_radio.active = true; |
697 | - } |
698 | - }); |
699 | - |
700 | - natural_scrolling_check.notify["active"].connect (() => { |
701 | - touchpad_settings.natural_scroll = natural_scrolling_check.active; |
702 | - }); |
703 | - |
704 | - horizontal_scrolling_check.notify["active"].connect (() => { |
705 | - touchpad_settings.horiz_scroll_enabled = horizontal_scrolling_check.active; |
706 | - }); |
707 | - |
708 | - scrolling_switch.notify["active"].connect (() => { |
709 | - var active = scrolling_switch.active; |
710 | - scrolling_two_finger_radio.sensitive = active; |
711 | - natural_scrolling_check.sensitive = active; |
712 | - horizontal_scrolling_check.sensitive = active; |
713 | - |
714 | - if (!active) { |
715 | - if (scrolling_two_finger_radio.active) |
716 | - previous_scroll_method = TouchpadSettings.SCROLL_METHOD_TWO_FINGER; |
717 | - else |
718 | - previous_scroll_method = TouchpadSettings.SCROLL_METHOD_EDGE; |
719 | - touchpad_settings.scroll_method = TouchpadSettings.SCROLL_METHOD_DISABLED; |
720 | - } |
721 | - else { |
722 | - touchpad_settings.scroll_method = previous_scroll_method; |
723 | - if (previous_scroll_method == TouchpadSettings.SCROLL_METHOD_EDGE) |
724 | - scrolling_two_finger_radio.active = false; |
725 | - else |
726 | - scrolling_two_finger_radio.active = true; |
727 | - } |
728 | - }); |
729 | - |
730 | - scrolling_two_finger_radio.notify["active"].connect (() => { |
731 | - if (scrolling_two_finger_radio.active) |
732 | - touchpad_settings.scroll_method = TouchpadSettings.SCROLL_METHOD_TWO_FINGER; |
733 | - else |
734 | - touchpad_settings.scroll_method = TouchpadSettings.SCROLL_METHOD_EDGE; |
735 | - |
736 | - }); |
737 | - } |
738 | - } |
739 | -} |
740 | \ No newline at end of file |
741 | |
742 | === removed file 'src/Pages/Touchpad/touchpad-settings.vala' |
743 | --- src/Pages/Touchpad/touchpad-settings.vala 2014-07-27 22:49:48 +0000 |
744 | +++ src/Pages/Touchpad/touchpad-settings.vala 1970-01-01 00:00:00 +0000 |
745 | @@ -1,41 +0,0 @@ |
746 | -/*** |
747 | - Copyright (C) 2014 Keith Gonyon <kgonyon@gmail.com> |
748 | - This program is free software: you can redistribute it and/or modify it |
749 | - under the terms of the GNU Lesser General Public License version 3, as published |
750 | - by the Free Software Foundation. |
751 | - This program is distributed in the hope that it will be useful, but |
752 | - WITHOUT ANY WARRANTY; without even the implied warranties of |
753 | - MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
754 | - PURPOSE. See the GNU General Public License for more details. |
755 | - You should have received a copy of the GNU General Public License along |
756 | - with this program. If not, see |
757 | -***/ |
758 | -namespace MouseTouchpad { |
759 | - class TouchpadSettings : Granite.Services.Settings { |
760 | - public static string SCROLL_METHOD_DISABLED = "disabled"; |
761 | - public static string SCROLL_METHOD_EDGE = "edge-scrolling"; |
762 | - public static string SCROLL_METHOD_TWO_FINGER = "two-finger-scrolling"; |
763 | - |
764 | - public bool natural_scroll { get; set; } |
765 | - public bool horiz_scroll_enabled { get; set; } |
766 | - public bool tap_to_click { get; set; } |
767 | - public bool disable_while_typing { get; set; } |
768 | - public double motion_acceleration { get; set; } |
769 | - public int motion_threshold { get; set; } |
770 | - public string scroll_method { get; set; } |
771 | - |
772 | - public TouchpadSettings () { |
773 | - base ("org.gnome.settings-daemon.peripherals.touchpad"); |
774 | - } |
775 | - |
776 | - // public void reset_all () { |
777 | - // schema.reset ("natural-scroll"); |
778 | - // schema.reset ("horiz_scroll-enabled"); |
779 | - // schema.reset ("tab-to-click"); |
780 | - // schema.reset ("disable_while_typeing"); |
781 | - // schema.reset ("motion_acceleration"); |
782 | - // schema.reset ("motion_threshold"); |
783 | - // schema.reset ("scroll_method"); |
784 | - // } |
785 | - } |
786 | -} |
787 | \ No newline at end of file |
788 | |
789 | === added directory 'src/Widgets' |
790 | === added file 'src/Widgets/GeneralSection.vala' |
791 | --- src/Widgets/GeneralSection.vala 1970-01-01 00:00:00 +0000 |
792 | +++ src/Widgets/GeneralSection.vala 2015-08-23 23:11:04 +0000 |
793 | @@ -0,0 +1,58 @@ |
794 | +/* |
795 | + * Copyright (c) 2011-2015 elementary Developers (https://launchpad.net/elementary) |
796 | + * |
797 | + * This program is free software; you can redistribute it and/or |
798 | + * modify it under the terms of the GNU General Public |
799 | + * License as published by the Free Software Foundation; either |
800 | + * version 2 of the License, or (at your option) any later version. |
801 | + * |
802 | + * This program is distributed in the hope that it will be useful, |
803 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
804 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
805 | + * General Public License for more details. |
806 | + * |
807 | + * You should have received a copy of the GNU General Public |
808 | + * License along with this program; if not, write to the |
809 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
810 | + * Boston, MA 02111-1307, USA. |
811 | + */ |
812 | + |
813 | +public class MouseTouchpad.Widgets.GeneralSection : Section { |
814 | + private Backend.MouseSettings mouse_settings; |
815 | + |
816 | + private Granite.Widgets.ModeButton primary_button_switcher; |
817 | + private Gtk.Switch reveal_pointer_switch; |
818 | + |
819 | + public GeneralSection (Backend.MouseSettings mouse_settings) { |
820 | + base (_("General")); |
821 | + |
822 | + this.mouse_settings = mouse_settings; |
823 | + |
824 | + build_ui (); |
825 | + create_bindings (); |
826 | + } |
827 | + |
828 | + private void build_ui () { |
829 | + primary_button_switcher = new Granite.Widgets.ModeButton (); |
830 | + primary_button_switcher.append_text (_("Left")); |
831 | + primary_button_switcher.append_text (_("Right")); |
832 | + |
833 | + reveal_pointer_switch = new Gtk.Switch (); |
834 | + reveal_pointer_switch.halign = Gtk.Align.START; |
835 | + |
836 | + this.add_entry (_("Primary Button:"), primary_button_switcher); |
837 | + this.add_entry (_("Reveal pointer:"), reveal_pointer_switch, _("Pressing the control key will highlight the position of the pointer")); |
838 | + } |
839 | + |
840 | + private void create_bindings () { |
841 | + mouse_settings.bind_property ("left-handed", |
842 | + primary_button_switcher, |
843 | + "selected", |
844 | + BindingFlags.BIDIRECTIONAL | BindingFlags.SYNC_CREATE); |
845 | + |
846 | + mouse_settings.bind_property ("locate-pointer", |
847 | + reveal_pointer_switch, |
848 | + "state", |
849 | + BindingFlags.BIDIRECTIONAL | BindingFlags.SYNC_CREATE); |
850 | + } |
851 | +} |
852 | \ No newline at end of file |
853 | |
854 | === added file 'src/Widgets/MouseSection.vala' |
855 | --- src/Widgets/MouseSection.vala 1970-01-01 00:00:00 +0000 |
856 | +++ src/Widgets/MouseSection.vala 2015-08-23 23:11:04 +0000 |
857 | @@ -0,0 +1,62 @@ |
858 | +/* |
859 | + * Copyright (c) 2011-2015 elementary Developers (https://launchpad.net/elementary) |
860 | + * |
861 | + * This program is free software; you can redistribute it and/or |
862 | + * modify it under the terms of the GNU General Public |
863 | + * License as published by the Free Software Foundation; either |
864 | + * version 2 of the License, or (at your option) any later version. |
865 | + * |
866 | + * This program is distributed in the hope that it will be useful, |
867 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
868 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
869 | + * General Public License for more details. |
870 | + * |
871 | + * You should have received a copy of the GNU General Public |
872 | + * License along with this program; if not, write to the |
873 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
874 | + * Boston, MA 02111-1307, USA. |
875 | + */ |
876 | + |
877 | +public class MouseTouchpad.Widgets.MouseSection : Section { |
878 | + private Backend.MouseSettings mouse_settings; |
879 | + |
880 | + private Gtk.Scale pointer_speed_scale; |
881 | + |
882 | + public MouseSection (Backend.MouseSettings mouse_settings) { |
883 | + base (_("Mouse")); |
884 | + |
885 | + this.mouse_settings = mouse_settings; |
886 | + |
887 | + build_ui (); |
888 | + create_bindings (); |
889 | + } |
890 | + |
891 | + private void build_ui () { |
892 | + pointer_speed_scale = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 1, 10, 1); |
893 | + pointer_speed_scale.digits = 2; |
894 | + pointer_speed_scale.draw_value = false; |
895 | + pointer_speed_scale.set_size_request (160, -1); |
896 | + |
897 | + this.add_entry (_ ("Pointer speed:"), pointer_speed_scale); |
898 | + } |
899 | + |
900 | + private void create_bindings () { |
901 | + mouse_settings.bind_property ("motion-acceleration", |
902 | + pointer_speed_scale.adjustment, |
903 | + "value", |
904 | + BindingFlags.BIDIRECTIONAL | BindingFlags.SYNC_CREATE); |
905 | + |
906 | + pointer_speed_scale.adjustment.bind_property ("value", |
907 | + mouse_settings, |
908 | + "motion-threshold", |
909 | + BindingFlags.SYNC_CREATE, |
910 | + pointer_speed_scale_transform_func); |
911 | + } |
912 | + |
913 | + private bool pointer_speed_scale_transform_func (Binding binding, Value source_value, ref Value target_value) { |
914 | + int val = 11 - (int)source_value.get_double (); |
915 | + target_value.set_int (val); |
916 | + |
917 | + return true; |
918 | + } |
919 | +} |
920 | \ No newline at end of file |
921 | |
922 | === added file 'src/Widgets/Section.vala' |
923 | --- src/Widgets/Section.vala 1970-01-01 00:00:00 +0000 |
924 | +++ src/Widgets/Section.vala 2015-08-23 23:11:04 +0000 |
925 | @@ -0,0 +1,64 @@ |
926 | +/* |
927 | + * Copyright (c) 2011-2015 elementary Developers (https://launchpad.net/elementary) |
928 | + * |
929 | + * This program is free software; you can redistribute it and/or |
930 | + * modify it under the terms of the GNU General Public |
931 | + * License as published by the Free Software Foundation; either |
932 | + * version 2 of the License, or (at your option) any later version. |
933 | + * |
934 | + * This program is distributed in the hope that it will be useful, |
935 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
936 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
937 | + * General Public License for more details. |
938 | + * |
939 | + * You should have received a copy of the GNU General Public |
940 | + * License along with this program; if not, write to the |
941 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
942 | + * Boston, MA 02111-1307, USA. |
943 | + */ |
944 | + |
945 | +public class MouseTouchpad.Widgets.Section : Gtk.Grid { |
946 | + private Gtk.Label title_label; |
947 | + |
948 | + private int row_count = 0; |
949 | + |
950 | + public Section (string title) { |
951 | + build_ui (title); |
952 | + } |
953 | + |
954 | + public void add_entry (string option, Gtk.Widget widget, string description = "") { |
955 | + int row = row_count++; |
956 | + |
957 | + Gtk.Label option_label = new Gtk.Label (option); |
958 | + option_label.halign = Gtk.Align.END; |
959 | + |
960 | + this.attach (option_label, 0, row, 1, 1); |
961 | + |
962 | + if (description == "") { |
963 | + this.attach (widget, 1, row, 1, 1); |
964 | + } else { |
965 | + Gtk.Box widget_container = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); |
966 | + widget_container.hexpand = false; |
967 | + |
968 | + Gtk.Image help_icon = new Gtk.Image.from_icon_name ("help-info-symbolic", Gtk.IconSize.BUTTON); |
969 | + help_icon.tooltip_text = description; |
970 | + |
971 | + widget_container.add (widget); |
972 | + widget_container.add (help_icon); |
973 | + |
974 | + this.attach (widget_container, 1, row, 1, 1); |
975 | + } |
976 | + } |
977 | + |
978 | + private void build_ui (string title) { |
979 | + this.row_spacing = 12; |
980 | + this.column_spacing = 12; |
981 | + this.column_homogeneous = true; |
982 | + |
983 | + title_label = new Gtk.Label (title); |
984 | + title_label.halign = Gtk.Align.START; |
985 | + title_label.get_style_context ().add_class ("h4"); |
986 | + |
987 | + this.attach (title_label, 0, row_count++, 2, 1); |
988 | + } |
989 | +} |
990 | \ No newline at end of file |
991 | |
992 | === added file 'src/Widgets/TouchpadSection.vala' |
993 | --- src/Widgets/TouchpadSection.vala 1970-01-01 00:00:00 +0000 |
994 | +++ src/Widgets/TouchpadSection.vala 2015-08-23 23:11:04 +0000 |
995 | @@ -0,0 +1,114 @@ |
996 | +/* |
997 | + * Copyright (c) 2011-2015 elementary Developers (https://launchpad.net/elementary) |
998 | + * |
999 | + * This program is free software; you can redistribute it and/or |
1000 | + * modify it under the terms of the GNU General Public |
1001 | + * License as published by the Free Software Foundation; either |
1002 | + * version 2 of the License, or (at your option) any later version. |
1003 | + * |
1004 | + * This program is distributed in the hope that it will be useful, |
1005 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1006 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1007 | + * General Public License for more details. |
1008 | + * |
1009 | + * You should have received a copy of the GNU General Public |
1010 | + * License along with this program; if not, write to the |
1011 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
1012 | + * Boston, MA 02111-1307, USA. |
1013 | + */ |
1014 | + |
1015 | +public class MouseTouchpad.Widgets.TouchpadSection : Section { |
1016 | + private Backend.TouchpadSettings touchpad_settings; |
1017 | + |
1018 | + private Gtk.Switch disable_while_typing_switch; |
1019 | + private Gtk.Switch tap_to_click_switch; |
1020 | + private Gtk.Scale pointer_speed_scale; |
1021 | + private Gtk.ComboBoxText scrolling_combobox; |
1022 | + private Gtk.Switch horizontal_scrolling_switch; |
1023 | + private Gtk.Switch natural_scrolling_switch; |
1024 | + |
1025 | + public TouchpadSection (Backend.TouchpadSettings touchpad_settings) { |
1026 | + base (_("Touchpad")); |
1027 | + |
1028 | + this.touchpad_settings = touchpad_settings; |
1029 | + |
1030 | + build_ui (); |
1031 | + create_bindings (); |
1032 | + } |
1033 | + |
1034 | + private void build_ui () { |
1035 | + disable_while_typing_switch = new Gtk.Switch (); |
1036 | + disable_while_typing_switch.halign = Gtk.Align.START; |
1037 | + |
1038 | + tap_to_click_switch = new Gtk.Switch (); |
1039 | + tap_to_click_switch.halign = Gtk.Align.START; |
1040 | + |
1041 | + pointer_speed_scale = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 1, 10, 1); |
1042 | + pointer_speed_scale.digits = 2; |
1043 | + pointer_speed_scale.draw_value = false; |
1044 | + pointer_speed_scale.set_size_request (160, -1); |
1045 | + |
1046 | + scrolling_combobox = new Gtk.ComboBoxText (); |
1047 | + scrolling_combobox.append ("two-finger-scrolling", _("Two-finger")); |
1048 | + scrolling_combobox.append ("edge-scrolling", _("Edge")); |
1049 | + scrolling_combobox.append ("disabled", _("Disabled")); |
1050 | + |
1051 | + horizontal_scrolling_switch = new Gtk.Switch (); |
1052 | + horizontal_scrolling_switch.halign = Gtk.Align.START; |
1053 | + |
1054 | + natural_scrolling_switch = new Gtk.Switch (); |
1055 | + natural_scrolling_switch.halign = Gtk.Align.START; |
1056 | + |
1057 | + this.add_entry (_("Disable while typing:"), disable_while_typing_switch); |
1058 | + this.add_entry (_("Tap to click:"), tap_to_click_switch); |
1059 | + this.add_entry (_("Pointer speed:"), pointer_speed_scale); |
1060 | + this.add_entry (_("Scrolling:"), scrolling_combobox); |
1061 | + this.add_entry (_("Horizontal scrolling:"), horizontal_scrolling_switch); |
1062 | + this.add_entry (_("Natural scrolling:"), natural_scrolling_switch); |
1063 | + } |
1064 | + |
1065 | + private void create_bindings () { |
1066 | + touchpad_settings.bind_property ("disable-while-typing", |
1067 | + disable_while_typing_switch, |
1068 | + "state", |
1069 | + BindingFlags.BIDIRECTIONAL | BindingFlags.SYNC_CREATE); |
1070 | + |
1071 | + touchpad_settings.bind_property ("tap-to-click", |
1072 | + tap_to_click_switch, |
1073 | + "state", |
1074 | + BindingFlags.BIDIRECTIONAL | BindingFlags.SYNC_CREATE); |
1075 | + |
1076 | + touchpad_settings.bind_property ("motion-acceleration", |
1077 | + pointer_speed_scale.adjustment, |
1078 | + "value", |
1079 | + BindingFlags.BIDIRECTIONAL | BindingFlags.SYNC_CREATE); |
1080 | + |
1081 | + pointer_speed_scale.adjustment.bind_property ("value", |
1082 | + touchpad_settings, |
1083 | + "motion-threshold", |
1084 | + BindingFlags.SYNC_CREATE, |
1085 | + pointer_speed_scale_transform_func); |
1086 | + |
1087 | + touchpad_settings.bind_property ("scroll-method", |
1088 | + scrolling_combobox, |
1089 | + "active-id", |
1090 | + BindingFlags.BIDIRECTIONAL | BindingFlags.SYNC_CREATE); |
1091 | + |
1092 | + touchpad_settings.bind_property ("horiz-scroll-enabled", |
1093 | + horizontal_scrolling_switch, |
1094 | + "state", |
1095 | + BindingFlags.BIDIRECTIONAL | BindingFlags.SYNC_CREATE); |
1096 | + |
1097 | + touchpad_settings.bind_property ("natural-scroll", |
1098 | + natural_scrolling_switch, |
1099 | + "state", |
1100 | + BindingFlags.BIDIRECTIONAL | BindingFlags.SYNC_CREATE); |
1101 | + } |
1102 | + |
1103 | + private bool pointer_speed_scale_transform_func (Binding binding, Value source_value, ref Value target_value) { |
1104 | + int val = 11 - (int)source_value.get_double (); |
1105 | + target_value.set_int (val); |
1106 | + |
1107 | + return true; |
1108 | + } |
1109 | +} |
1110 | \ No newline at end of file |
1111 | |
1112 | === modified file 'src/mouse-touchpad.vala' (properties changed: -x to +x) |
1113 | --- src/mouse-touchpad.vala 2014-07-27 22:49:48 +0000 |
1114 | +++ src/mouse-touchpad.vala 2015-08-23 23:11:04 +0000 |
1115 | @@ -1,35 +1,32 @@ |
1116 | -/*** |
1117 | - Copyright (C) 2014 Keith Gonyon <kgonyon@gmail.com> |
1118 | - This program is free software: you can redistribute it and/or modify it |
1119 | - under the terms of the GNU Lesser General Public License version 3, as published |
1120 | - by the Free Software Foundation. |
1121 | - This program is distributed in the hope that it will be useful, but |
1122 | - WITHOUT ANY WARRANTY; without even the implied warranties of |
1123 | - MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
1124 | - PURPOSE. See the GNU General Public License for more details. |
1125 | - You should have received a copy of the GNU General Public License along |
1126 | - with this program. If not, see |
1127 | -***/ |
1128 | +/* |
1129 | + * Copyright (c) 2011-2015 elementary Developers (https://launchpad.net/elementary) |
1130 | + * |
1131 | + * This program is free software; you can redistribute it and/or |
1132 | + * modify it under the terms of the GNU General Public |
1133 | + * License as published by the Free Software Foundation; either |
1134 | + * version 2 of the License, or (at your option) any later version. |
1135 | + * |
1136 | + * This program is distributed in the hope that it will be useful, |
1137 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1138 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1139 | + * General Public License for more details. |
1140 | + * |
1141 | + * You should have received a copy of the GNU General Public |
1142 | + * License along with this program; if not, write to the |
1143 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
1144 | + * Boston, MA 02111-1307, USA. |
1145 | + */ |
1146 | + |
1147 | namespace MouseTouchpad { |
1148 | public class Plug : Switchboard.Plug { |
1149 | - /* ---- Layout Variables ---- */ |
1150 | - Gtk.Grid main_grid; |
1151 | - Gtk.Grid separator_grid; |
1152 | - Gtk.Separator left_separator; |
1153 | - Gtk.Separator right_separator; |
1154 | - Gtk.Stack pages; |
1155 | - Gtk.StackSwitcher page_switcher; |
1156 | - |
1157 | - /* ----- General settings variables ---- */ |
1158 | - Gtk.Label general_settings_label; |
1159 | - Gtk.ButtonBox handed_buttons; |
1160 | - Gtk.RadioButton left_handed_button; |
1161 | - Gtk.RadioButton right_handed_button; |
1162 | - Gtk.Grid pointer_reveal_grid; |
1163 | - Gtk.CheckButton pointer_reveal_check; |
1164 | - |
1165 | - // Settings |
1166 | - MouseSettings mouse_settings; |
1167 | + private Backend.MouseSettings mouse_settings; |
1168 | + private Backend.TouchpadSettings touchpad_settings; |
1169 | + |
1170 | + private Gtk.Grid main_grid; |
1171 | + |
1172 | + private Widgets.GeneralSection general_section; |
1173 | + private Widgets.MouseSection mouse_section; |
1174 | + private Widgets.TouchpadSection touchpad_section; |
1175 | |
1176 | public Plug () { |
1177 | Object (category: Category.HARDWARE, |
1178 | @@ -37,120 +34,58 @@ |
1179 | display_name: _("Mouse & Touchpad"), |
1180 | description: _("Set your mouse and touchpad preferences"), |
1181 | icon: "preferences-desktop-peripherals"); |
1182 | - |
1183 | - mouse_settings = new MouseSettings (); |
1184 | } |
1185 | |
1186 | public override Gtk.Widget get_widget () { |
1187 | if (main_grid == null) { |
1188 | - // Initialize variables |
1189 | - // Main |
1190 | - main_grid = new Gtk.Grid (); |
1191 | - separator_grid = new Gtk.Grid (); |
1192 | - pages = new Gtk.Stack (); |
1193 | - page_switcher = new Gtk.StackSwitcher (); |
1194 | - // General |
1195 | - general_settings_label = new Gtk.Label (_("<b>General:</b>")); |
1196 | - handed_buttons = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL); |
1197 | - left_handed_button = new Gtk.RadioButton.with_label (null, _("Left-handed")); |
1198 | - right_handed_button = new Gtk.RadioButton.with_label (left_handed_button.get_group(), |
1199 | - _("Right-handed")); |
1200 | - pointer_reveal_grid = new Gtk.Grid (); |
1201 | - pointer_reveal_check = new Gtk.CheckButton.with_label (_("Pointer Reveal")); |
1202 | - left_separator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL); |
1203 | - right_separator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL); |
1204 | - |
1205 | - setup_widgets (); |
1206 | - setup_signals (); |
1207 | - |
1208 | - // Attach |
1209 | - // General |
1210 | - handed_buttons.add (left_handed_button); |
1211 | - handed_buttons.add (right_handed_button); |
1212 | - pointer_reveal_grid.attach (pointer_reveal_check, 0, 0, 1, 1); |
1213 | - // Separator |
1214 | - separator_grid.add (left_separator); |
1215 | - separator_grid.add (page_switcher); |
1216 | - separator_grid.add (right_separator); |
1217 | - // Main |
1218 | - main_grid.attach (general_settings_label, 0, 0, 1, 1); |
1219 | - main_grid.attach (pointer_reveal_grid, 0, 1, 1, 1); |
1220 | - main_grid.attach (handed_buttons, 0, 2, 1, 1); |
1221 | - main_grid.attach (separator_grid, 0, 4, 1, 1); |
1222 | - main_grid.attach (pages, 0, 5, 1, 1); |
1223 | + load_settings (); |
1224 | + build_ui (); |
1225 | } |
1226 | |
1227 | - main_grid.show_all (); |
1228 | return main_grid; |
1229 | } |
1230 | |
1231 | public override void shown () { |
1232 | - |
1233 | } |
1234 | |
1235 | public override void hidden () { |
1236 | - |
1237 | } |
1238 | |
1239 | public override void search_callback (string location) { |
1240 | - |
1241 | } |
1242 | |
1243 | - // 'search' returns results like ("Keyboard → Behavior → Duration", "keyboard<sep>behavior") |
1244 | + /* 'search' returns results like ("Keyboard → Behavior → Duration", "keyboard<sep>behavior") */ |
1245 | public override async Gee.TreeMap<string, string> search (string search) { |
1246 | return new Gee.TreeMap<string, string> (null, null); |
1247 | } |
1248 | |
1249 | - private void setup_widgets () { |
1250 | - // Grid |
1251 | - main_grid.margin = 12; |
1252 | + private void load_settings () { |
1253 | + mouse_settings = new Backend.MouseSettings (); |
1254 | + touchpad_settings = new Backend.TouchpadSettings (); |
1255 | + } |
1256 | + |
1257 | + private void build_ui () { |
1258 | + main_grid = new Gtk.Grid (); |
1259 | + main_grid.margin = 12; |
1260 | main_grid.row_spacing = 12; |
1261 | - |
1262 | - separator_grid.hexpand = true; |
1263 | - left_separator.hexpand = true; |
1264 | - right_separator.hexpand = true; |
1265 | - |
1266 | - // Pages |
1267 | - page_switcher.set_stack(pages); |
1268 | - page_switcher.halign = Gtk.Align.CENTER; |
1269 | - pages.add_titled (new MousePage (), "mouse", _("Mouse")); |
1270 | - pages.add_titled (new TouchpadPage (), "touchpad", _("Touchpad")); |
1271 | - |
1272 | - // General |
1273 | - general_settings_label.use_markup = true; |
1274 | - general_settings_label.halign = Gtk.Align.START; |
1275 | - handed_buttons.layout_style = Gtk.ButtonBoxStyle.START; |
1276 | - handed_buttons.margin_start = 12; |
1277 | - pointer_reveal_grid.margin_start = 12; |
1278 | - pointer_reveal_grid.column_spacing = 12; |
1279 | - |
1280 | - left_handed_button.active = mouse_settings.left_handed; |
1281 | - right_handed_button.active = !mouse_settings.left_handed; |
1282 | - } |
1283 | - |
1284 | - private void setup_signals () { |
1285 | - mouse_settings.changed["left-handed"].connect (() => { |
1286 | - left_handed_button.active = mouse_settings.left_handed; |
1287 | - right_handed_button.active = !mouse_settings.left_handed; |
1288 | - }); |
1289 | - |
1290 | - mouse_settings.changed["locate-pointer"].connect (() => { |
1291 | - pointer_reveal_check.active = mouse_settings.locate_pointer; |
1292 | - }); |
1293 | - |
1294 | - left_handed_button.notify["active"].connect (() => { |
1295 | - mouse_settings.left_handed = left_handed_button.active; |
1296 | - }); |
1297 | - |
1298 | - pointer_reveal_check.notify["active"].connect (() => { |
1299 | - mouse_settings.locate_pointer = pointer_reveal_check.active; |
1300 | - }); |
1301 | + main_grid.halign = Gtk.Align.CENTER; |
1302 | + |
1303 | + general_section = new Widgets.GeneralSection (mouse_settings); |
1304 | + mouse_section = new Widgets.MouseSection (mouse_settings); |
1305 | + touchpad_section = new Widgets.TouchpadSection (touchpad_settings); |
1306 | + |
1307 | + main_grid.attach (general_section, 0, 0, 1, 1); |
1308 | + main_grid.attach (mouse_section, 0, 1, 1, 1); |
1309 | + main_grid.attach (touchpad_section, 0, 2, 1, 1); |
1310 | + main_grid.show_all (); |
1311 | } |
1312 | } |
1313 | } |
1314 | |
1315 | public Switchboard.Plug get_plug (Module module) { |
1316 | debug ("Activating Mouse-Touchpad plug"); |
1317 | + |
1318 | var plug = new MouseTouchpad.Plug (); |
1319 | + |
1320 | return plug; |
1321 | } |
1322 | \ No newline at end of file |
1323 | |
1324 | === removed file 'src/page.vala' |
1325 | --- src/page.vala 2014-07-25 19:34:08 +0000 |
1326 | +++ src/page.vala 1970-01-01 00:00:00 +0000 |
1327 | @@ -1,27 +0,0 @@ |
1328 | -/*** |
1329 | - Copyright (C) 2014 Keith Gonyon <kgonyon@gmail.com> |
1330 | - This program is free software: you can redistribute it and/or modify it |
1331 | - under the terms of the GNU Lesser General Public License version 3, as published |
1332 | - by the Free Software Foundation. |
1333 | - This program is distributed in the hope that it will be useful, but |
1334 | - WITHOUT ANY WARRANTY; without even the implied warranties of |
1335 | - MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
1336 | - PURPOSE. See the GNU General Public License for more details. |
1337 | - You should have received a copy of the GNU General Public License along |
1338 | - with this program. If not, see |
1339 | -***/ |
1340 | -namespace MouseTouchpad { |
1341 | - public abstract class AbstractPage : Gtk.Grid { |
1342 | - public AbstractPage () { |
1343 | - |
1344 | - this.row_spacing = 24; |
1345 | - this.column_spacing = 12; |
1346 | - this.margin_top = 12; |
1347 | - this.margin_bottom = 12; |
1348 | - this.column_homogeneous = true; |
1349 | - this.row_homogeneous = false; |
1350 | - } |
1351 | - |
1352 | - public abstract void reset (); |
1353 | - } |
1354 | -} |
1355 | \ No newline at end of file |
I can confirm that the settings work as expected here :)