Merge lp:~l-admin-3/switchboard-plug-mouse-touchpad/frontend-update into lp:~elementary-pantheon/switchboard-plug-mouse-touchpad/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
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
Danielle Foré (danrabbit) wrote :

I can confirm that the settings work as expected here :)

review: Approve (ux)
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
=== modified file '.bzrignore' (properties changed: -x to +x)
=== modified file 'AUTHORS' (properties changed: -x to +x)
--- AUTHORS 2014-07-22 05:50:56 +0000
+++ AUTHORS 2015-08-23 23:11:04 +0000
@@ -1,4 +1,5 @@
1Copyright (c) 2014 by XXX Developers1Copyright (c) 2015 by elementary Developers
22
3Written by XXX Developers:3Written by elementary Developers:
4* YOUR NAME <email@provider.com>4* Keith Gonyon
5* Marcus Wichelmann <marcus.wichelmann@hotmail.de>
56
=== modified file 'CMakeLists.txt' (properties changed: -x to +x)
=== modified file 'COPYING' (properties changed: -x to +x)
=== removed file 'COPYRIGHT'
--- COPYRIGHT 2014-07-22 05:50:56 +0000
+++ COPYRIGHT 1970-01-01 00:00:00 +0000
@@ -1,5 +0,0 @@
1Sample
2Copyright (C) 2014 by the following:
3
4If you have contributed to this project then you deserve to be on this list.
5Contact us (see: AUTHORS) and we'll add you.
60
=== modified file 'INSTALL' (properties changed: -x to +x)
=== modified file 'cmake/FindGirCompiler.cmake' (properties changed: -x to +x)
=== modified file 'cmake/FindVala.cmake' (properties changed: -x to +x)
=== modified file 'cmake/GObjectIntrospectionMacros.cmake' (properties changed: -x to +x)
=== modified file 'cmake/GSettings.cmake' (properties changed: -x to +x)
=== modified file 'cmake/ParseArguments.cmake' (properties changed: -x to +x)
=== modified file 'cmake/README' (properties changed: -x to +x)
=== modified file 'cmake/README.Vala.rst' (properties changed: -x to +x)
=== modified file 'cmake/Tests.cmake' (properties changed: -x to +x)
=== modified file 'cmake/Translations.cmake' (properties changed: -x to +x)
=== modified file 'cmake/ValaPrecompile.cmake' (properties changed: -x to +x)
=== modified file 'cmake/ValaVersion.cmake' (properties changed: -x to +x)
=== modified file 'config.vala.cmake' (properties changed: -x to +x)
=== modified file 'debian/changelog' (properties changed: -x to +x)
=== modified file 'debian/compat' (properties changed: -x to +x)
=== modified file 'debian/control' (properties changed: -x to +x)
=== modified file 'debian/copyright' (properties changed: -x to +x)
=== modified file 'debian/source/format' (properties changed: -x to +x)
=== modified file 'plug.plugin' (properties changed: -x to +x)
=== modified file 'po/CMakeLists.txt' (properties changed: -x to +x)
=== modified file 'po/ca.po' (properties changed: -x to +x)
=== modified file 'po/eo.po' (properties changed: -x to +x)
=== modified file 'po/es.po' (properties changed: -x to +x)
=== modified file 'po/fi.po' (properties changed: -x to +x)
=== modified file 'po/fr.po' (properties changed: -x to +x)
=== modified file 'po/it.po' (properties changed: -x to +x)
=== modified file 'po/pantheon-mouse-touchpad.pot' (properties changed: -x to +x)
--- po/pantheon-mouse-touchpad.pot 2014-07-25 05:27:41 +0000
+++ po/pantheon-mouse-touchpad.pot 2015-08-23 23:11:04 +0000
@@ -1,3 +1,4 @@
1# SOME DESCRIPTIVE TITLE.
1# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER2# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
2# This file is distributed under the same license as the PACKAGE package.3# This file is distributed under the same license as the PACKAGE package.
3# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.4# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
@@ -7,7 +8,7 @@
7msgstr ""8msgstr ""
8"Project-Id-Version: PACKAGE VERSION\n"9"Project-Id-Version: PACKAGE VERSION\n"
9"Report-Msgid-Bugs-To: \n"10"Report-Msgid-Bugs-To: \n"
10"POT-Creation-Date: 2014-07-24 22:24-0700\n"11"POT-Creation-Date: 2015-08-24 01:07+0200\n"
11"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13"Language-Team: LANGUAGE <LL@li.org>\n"14"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -16,73 +17,78 @@
16"Content-Type: text/plain; charset=CHARSET\n"17"Content-Type: text/plain; charset=CHARSET\n"
17"Content-Transfer-Encoding: 8bit\n"18"Content-Transfer-Encoding: 8bit\n"
1819
19#: ../src/mouse-touchpad.vala:2520#: ../src/mouse-touchpad.vala:34
20msgid "Mouse & Touchpad"21msgid "Mouse & Touchpad"
21msgstr ""22msgstr ""
2223
23#: ../src/mouse-touchpad.vala:2624#: ../src/mouse-touchpad.vala:35
24msgid "Set your mouse and touchpad preferences"25msgid "Set your mouse and touchpad preferences"
25msgstr ""26msgstr ""
2627
27#: ../src/mouse-touchpad.vala:41 ../src/Pages/Touchpad/touchpad-page.vala:4628#: ../src/Widgets/GeneralSection.vala:27
28msgid "<b>General:</b>"29msgid "General"
29msgstr ""30msgstr ""
3031
31#: ../src/mouse-touchpad.vala:4332#: ../src/Widgets/GeneralSection.vala:37
32msgid "Left-handed"33msgid "Left"
33msgstr ""34msgstr ""
3435
35#: ../src/mouse-touchpad.vala:4536#: ../src/Widgets/GeneralSection.vala:38
36msgid "Right-handed"37msgid "Right"
37msgstr ""38msgstr ""
3839
39#: ../src/mouse-touchpad.vala:4740#: ../src/Widgets/GeneralSection.vala:43
40msgid "Pointer Reveal"41msgid "Primary Button:"
41msgstr ""42msgstr ""
4243
43#: ../src/mouse-touchpad.vala:10444#: ../src/Widgets/GeneralSection.vala:44
45msgid "Reveal pointer:"
46msgstr ""
47
48#: ../src/Widgets/GeneralSection.vala:44
49msgid "Pressing the control key will highlight the position of the pointer"
50msgstr ""
51
52#: ../src/Widgets/MouseSection.vala:26
44msgid "Mouse"53msgid "Mouse"
45msgstr ""54msgstr ""
4655
47#: ../src/mouse-touchpad.vala:10556#: ../src/Widgets/MouseSection.vala:40 ../src/Widgets/TouchpadSection.vala:64
57msgid "Pointer speed:"
58msgstr ""
59
60#: ../src/Widgets/TouchpadSection.vala:31
48msgid "Touchpad"61msgid "Touchpad"
49msgstr ""62msgstr ""
5063
51#: ../src/Pages/Mouse/mouse-page.vala:1664#: ../src/Widgets/TouchpadSection.vala:52
52#: ../src/Pages/Touchpad/touchpad-page.vala:4165msgid "Two-finger"
53msgid "<b>Pointer Speed:</b>"66msgstr ""
54msgstr ""67
5568#: ../src/Widgets/TouchpadSection.vala:53
56#: ../src/Pages/Mouse/mouse-page.vala:1769msgid "Edge"
57#: ../src/Pages/Touchpad/touchpad-page.vala:4270msgstr ""
58msgid "<i>Slow</i>"71
59msgstr ""72#: ../src/Widgets/TouchpadSection.vala:54
6073msgid "Disabled"
61#: ../src/Pages/Mouse/mouse-page.vala:1874msgstr ""
62#: ../src/Pages/Touchpad/touchpad-page.vala:4375
63msgid "<i>Fast</i>"76#: ../src/Widgets/TouchpadSection.vala:62
64msgstr ""77msgid "Disable while typing:"
6578msgstr ""
66#: ../src/Pages/Touchpad/touchpad-page.vala:4779
67msgid "Disable while typing"80#: ../src/Widgets/TouchpadSection.vala:63
68msgstr ""81msgid "Tap to click:"
6982msgstr ""
70#: ../src/Pages/Touchpad/touchpad-page.vala:4883
71msgid "Tap to click"84#: ../src/Widgets/TouchpadSection.vala:65
72msgstr ""85msgid "Scrolling:"
7386msgstr ""
74#: ../src/Pages/Touchpad/touchpad-page.vala:5087
75msgid "<b>Scrolling:</b>"88#: ../src/Widgets/TouchpadSection.vala:66
76msgstr ""89msgid "Horizontal scrolling:"
7790msgstr ""
78#: ../src/Pages/Touchpad/touchpad-page.vala:5291
79msgid "Natural scrolling"92#: ../src/Widgets/TouchpadSection.vala:67
80msgstr ""93msgid "Natural scrolling:"
81
82#: ../src/Pages/Touchpad/touchpad-page.vala:53
83msgid "Horizontal scrolling"
84msgstr ""
85
86#: ../src/Pages/Touchpad/touchpad-page.vala:54
87msgid "Two finger scrolling"
88msgstr ""94msgstr ""
8995
=== modified file 'po/pl.po' (properties changed: -x to +x)
=== added directory 'src/Backend'
=== added file 'src/Backend/MouseSettings.vala'
--- src/Backend/MouseSettings.vala 1970-01-01 00:00:00 +0000
+++ src/Backend/MouseSettings.vala 2015-08-23 23:11:04 +0000
@@ -0,0 +1,29 @@
1/*
2 * Copyright (c) 2011-2015 elementary Developers (https://launchpad.net/elementary)
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 */
19
20public class MouseTouchpad.Backend.MouseSettings : Granite.Services.Settings {
21 public bool left_handed { get; set; }
22 public bool locate_pointer { get; set; }
23 public double motion_acceleration { get; set; }
24 public int motion_threshold { get; set; }
25
26 public MouseSettings () {
27 base ("org.gnome.settings-daemon.peripherals.mouse");
28 }
29}
0\ No newline at end of file30\ No newline at end of file
131
=== added file 'src/Backend/TouchpadSettings.vala'
--- src/Backend/TouchpadSettings.vala 1970-01-01 00:00:00 +0000
+++ src/Backend/TouchpadSettings.vala 2015-08-23 23:11:04 +0000
@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2011-2015 elementary Developers (https://launchpad.net/elementary)
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 */
19
20public class MouseTouchpad.Backend.TouchpadSettings : Granite.Services.Settings {
21 public bool disable_while_typing { get; set; }
22 public bool tap_to_click { get; set; }
23 public double motion_acceleration { get; set; }
24 public int motion_threshold { get; set; }
25 public string scroll_method { get; set; }
26 public bool horiz_scroll_enabled { get; set; }
27 public bool natural_scroll { get; set; }
28
29 public TouchpadSettings () {
30 base ("org.gnome.settings-daemon.peripherals.touchpad");
31 }
32}
0\ No newline at end of file33\ No newline at end of file
134
=== modified file 'src/CMakeLists.txt' (properties changed: -x to +x)
--- src/CMakeLists.txt 2014-07-23 01:13:33 +0000
+++ src/CMakeLists.txt 2015-08-23 23:11:04 +0000
@@ -4,6 +4,7 @@
4pkg_check_modules (DEPS REQUIRED gthread-2.0 gtk+-3.0 switchboard-2.0 granite)4pkg_check_modules (DEPS REQUIRED gthread-2.0 gtk+-3.0 switchboard-2.0 granite)
55
6add_definitions (${DEPS_CFLAGS})6add_definitions (${DEPS_CFLAGS})
7add_definitions ("-w")
7link_directories (${DEPS_LIBRARY_DIRS})8link_directories (${DEPS_LIBRARY_DIRS})
89
9find_package (Vala REQUIRED)10find_package (Vala REQUIRED)
@@ -14,14 +15,12 @@
14# Add all your vala files and requires packages to the List below to include them in the build15# Add all your vala files and requires packages to the List below to include them in the build
15vala_precompile (VALA_C ${CMAKE_PROJECT_NAME}16vala_precompile (VALA_C ${CMAKE_PROJECT_NAME}
16 mouse-touchpad.vala17 mouse-touchpad.vala
17 page.vala18 Backend/MouseSettings.vala
1819 Backend/TouchpadSettings.vala
19 Pages/Mouse/mouse-page.vala20 Widgets/Section.vala
20 Pages/Mouse/mouse-settings.vala21 Widgets/GeneralSection.vala
2122 Widgets/MouseSection.vala
22 Pages/Touchpad/touchpad-page.vala23 Widgets/TouchpadSection.vala
23 Pages/Touchpad/touchpad-settings.vala
24
25 ${CMAKE_CURRENT_BINARY_DIR}/config.vala24 ${CMAKE_CURRENT_BINARY_DIR}/config.vala
26PACKAGES25PACKAGES
27 gtk+-3.026 gtk+-3.0
2827
=== removed directory 'src/Pages'
=== removed directory 'src/Pages/Mouse'
=== removed file 'src/Pages/Mouse/mouse-page.vala'
--- src/Pages/Mouse/mouse-page.vala 2014-07-25 19:34:08 +0000
+++ src/Pages/Mouse/mouse-page.vala 1970-01-01 00:00:00 +0000
@@ -1,95 +0,0 @@
1/***
2 Copyright (C) 2014 Keith Gonyon <kgonyon@gmail.com>
3 This program is free software: you can redistribute it and/or modify it
4 under the terms of the GNU Lesser General Public License version 3, as published
5 by the Free Software Foundation.
6 This program is distributed in the hope that it will be useful, but
7 WITHOUT ANY WARRANTY; without even the implied warranties of
8 MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
9 PURPOSE. See the GNU General Public License for more details.
10 You should have received a copy of the GNU General Public License along
11 with this program. If not, see
12***/
13namespace MouseTouchpad {
14 public class MousePage : AbstractPage {
15 /* ---- Layout Variables ---- */
16
17 Gtk.Grid pointer_scale_grid;
18
19 /* ---- Widget Variables ---- */
20
21 Gtk.Label pointer_speed_label;
22 Gtk.Label acceleration_slow_label;
23 Gtk.Label acceleration_fast_label;
24 Gtk.Scale acceleration_scale;
25
26 private MouseSettings mouse_settings;
27
28 public MousePage () {
29 /* ---- Init Settings ---- */
30
31 mouse_settings = new MouseSettings ();
32
33 /* ---- Init Widgets ---- */
34
35 // Pointer speed
36 pointer_scale_grid = new Gtk.Grid ();
37 pointer_speed_label = new Gtk.Label (_("<b>Pointer Speed:</b>"));
38 acceleration_slow_label = new Gtk.Label(_("<i>Slow</i>"));
39 acceleration_fast_label = new Gtk.Label(_("<i>Fast</i>"));
40 acceleration_scale = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 1, 10, 1);
41
42 setup_widgets ();
43 setup_signals ();
44
45 /* ---- Attach widgets ---- */
46
47 // Pointer speed
48 pointer_scale_grid.attach (acceleration_slow_label, 0, 1, 1, 1);
49 pointer_scale_grid.attach (acceleration_scale, 1, 1, 3, 1);
50 pointer_scale_grid.attach (acceleration_fast_label, 4, 1, 1, 1);
51 this.attach (pointer_speed_label, 0, 0, 1, 1);
52 this.attach (pointer_scale_grid, 0, 1, 1, 1);
53 }
54
55 public override void reset () {
56
57 }
58
59 private void setup_widgets () {
60 /* ---- Grids ---- */
61
62 // Pointer Scale
63 pointer_scale_grid.column_spacing = 12;
64 pointer_scale_grid.margin_top = 12;
65 pointer_scale_grid.margin_start = 12;
66 pointer_scale_grid.column_homogeneous = false;
67 pointer_scale_grid.row_homogeneous = false;
68
69 /* ---- Widgets ---- */
70
71 // Pointer speed
72 pointer_speed_label.halign = Gtk.Align.START;
73 pointer_speed_label.use_markup = true;
74 acceleration_fast_label.use_markup = true;
75 acceleration_slow_label.use_markup = true;
76 acceleration_scale.draw_value = false;
77 acceleration_scale.hexpand = true;
78 acceleration_scale.set_value (mouse_settings.motion_acceleration);
79
80 }
81
82 private void setup_signals () {
83 // Pointer Speed
84 acceleration_scale.value_changed.connect (() => {
85 mouse_settings.motion_acceleration = acceleration_scale.adjustment.value;
86 mouse_settings.motion_threshold = (int) (11.0 - acceleration_scale.adjustment.value);
87 });
88
89 mouse_settings.changed["motion-acceleration"].connect (() => {
90 acceleration_scale.adjustment.value = mouse_settings.motion_acceleration;
91 });
92
93 }
94 }
95}
96\ No newline at end of file0\ No newline at end of file
971
=== removed file 'src/Pages/Mouse/mouse-settings.vala'
--- src/Pages/Mouse/mouse-settings.vala 2014-07-27 22:49:48 +0000
+++ src/Pages/Mouse/mouse-settings.vala 1970-01-01 00:00:00 +0000
@@ -1,31 +0,0 @@
1/***
2 Copyright (C) 2014 Keith Gonyon <kgonyon@gmail.com>
3 This program is free software: you can redistribute it and/or modify it
4 under the terms of the GNU Lesser General Public License version 3, as published
5 by the Free Software Foundation.
6 This program is distributed in the hope that it will be useful, but
7 WITHOUT ANY WARRANTY; without even the implied warranties of
8 MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
9 PURPOSE. See the GNU General Public License for more details.
10 You should have received a copy of the GNU General Public License along
11 with this program. If not, see
12***/
13namespace MouseTouchpad {
14 class MouseSettings : Granite.Services.Settings {
15 public double motion_acceleration { get; set; }
16 public int motion_threshold { get; set; }
17 public bool left_handed { get; set; }
18 public bool locate_pointer { get; set; }
19
20 public MouseSettings () {
21 base ("org.gnome.settings-daemon.peripherals.mouse");
22 }
23
24 // public void reset_all () {
25 // schema.reset ("motion-acceleration");
26 // schema.reset ("motion-threshold");
27 // schema.reset ("left-handed");
28 // schema.reset ("locate-pointer");
29 // }
30 }
31}
32\ No newline at end of file0\ No newline at end of file
331
=== removed directory 'src/Pages/Touchpad'
=== removed file 'src/Pages/Touchpad/touchpad-page.vala'
--- src/Pages/Touchpad/touchpad-page.vala 2014-07-27 22:49:48 +0000
+++ src/Pages/Touchpad/touchpad-page.vala 1970-01-01 00:00:00 +0000
@@ -1,280 +0,0 @@
1/***
2 Copyright (C) 2014 Keith Gonyon <kgonyon@gmail.com>
3 This program is free software: you can redistribute it and/or modify it
4 under the terms of the GNU Lesser General Public License version 3, as published
5 by the Free Software Foundation.
6 This program is distributed in the hope that it will be useful, but
7 WITHOUT ANY WARRANTY; without even the implied warranties of
8 MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
9 PURPOSE. See the GNU General Public License for more details.
10 You should have received a copy of the GNU General Public License along
11 with this program. If not, see
12***/
13namespace MouseTouchpad {
14 public class TouchpadPage : AbstractPage {
15 /* ---- Layout variables ---- */
16
17 // Pointer Speed
18 Gtk.Grid pointer_speed_grid;
19 Gtk.Grid pointer_scale_grid;
20
21 // General
22 Gtk.Grid general_grid;
23
24 // Scrolling
25 Gtk.Grid scrolling_grid;
26 Gtk.Grid scrolling_label_grid;
27
28 /* ---- Widget Variables ---- */
29
30 // Pointer speed variables
31 Gtk.Label pointer_speed_label;
32 Gtk.Label acceleration_slow_label;
33 Gtk.Label acceleration_fast_label;
34 Gtk.Scale acceleration_scale;
35
36 // General variables
37 Gtk.Label general_label;
38 Gtk.CheckButton disable_while_typing_check;
39 Gtk.CheckButton tap_to_click_check;
40
41 // Scrolling variables
42 Gtk.Label scrolling_label;
43 Gtk.Switch scrolling_switch;
44 Gtk.CheckButton natural_scrolling_check;
45 Gtk.CheckButton horizontal_scrolling_check;
46 Gtk.CheckButton scrolling_two_finger_radio;
47
48
49 private TouchpadSettings touchpad_settings;
50 private string previous_scroll_method;
51
52 public TouchpadPage () {
53 touchpad_settings = new TouchpadSettings ();
54 /* ---- Init Grids ---- */
55
56 scrolling_grid = new Gtk.Grid ();
57 scrolling_label_grid = new Gtk.Grid ();
58 general_grid = new Gtk.Grid ();
59 pointer_speed_grid = new Gtk.Grid ();
60 pointer_scale_grid = new Gtk.Grid ();
61
62 /* ---- Init Widgets ---- */
63
64 // Pointer speed
65 pointer_speed_label = new Gtk.Label (_("<b>Pointer Speed:</b>"));
66 acceleration_slow_label = new Gtk.Label(_("<i>Slow</i>"));
67 acceleration_fast_label = new Gtk.Label(_("<i>Fast</i>"));
68 acceleration_scale = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 1, 10, 1);
69
70 //General
71 general_label = new Gtk.Label (_("<b>General:</b>"));
72 disable_while_typing_check = new Gtk.CheckButton.with_label (_("Disable while typing"));
73 tap_to_click_check = new Gtk.CheckButton.with_label (_("Tap to click"));
74
75 // Scrolling
76 scrolling_label = new Gtk.Label (_("<b>Scrolling:</b>"));
77 scrolling_switch = new Gtk.Switch ();
78 natural_scrolling_check = new Gtk.CheckButton.with_label (_("Natural scrolling"));
79 horizontal_scrolling_check = new Gtk.CheckButton.with_label (_("Horizontal scrolling"));
80 scrolling_two_finger_radio = new Gtk.CheckButton.with_label (_("Two finger scrolling"));
81
82 setup_widgets ();
83 setup_signals ();
84
85 /* ---- Attach widgets ---- */
86
87 // Pointer speed
88 pointer_scale_grid.attach (acceleration_slow_label, 0, 1, 1, 1);
89 pointer_scale_grid.attach (acceleration_scale, 1, 1, 3, 1);
90 pointer_scale_grid.attach (acceleration_fast_label, 4, 1, 1, 1);
91 pointer_speed_grid.attach (pointer_speed_label, 0, 0, 1, 1);
92 pointer_speed_grid.attach (pointer_scale_grid, 0, 1, 1, 1);
93
94 // General
95 general_grid.attach(disable_while_typing_check, 0, 0, 1, 1);
96 general_grid.attach(tap_to_click_check, 0, 1, 1, 1);
97
98 // Scrolling
99 scrolling_label_grid.attach (scrolling_label, 0, 0, 1, 1);
100 scrolling_label_grid.attach (scrolling_switch, 1, 0, 1, 1);
101 scrolling_grid.attach (natural_scrolling_check, 0, 0, 1, 1);
102 scrolling_grid.attach (horizontal_scrolling_check, 0, 1, 1, 1);
103 scrolling_grid.attach (scrolling_two_finger_radio, 0, 2, 1, 1);
104
105 // Main
106 this.attach (pointer_speed_grid, 0, 0, 2, 1);
107 this.attach (general_label, 0, 1, 1, 1);
108 this.attach (general_grid, 0, 2, 1, 1);
109 this.attach (scrolling_label_grid, 1, 1, 1, 1);
110 this.attach (scrolling_grid, 1, 2, 1, 1);
111 }
112
113 public override void reset () {
114
115 }
116
117 private void setup_widgets () {
118 /* ---- Grids ---- */
119
120 // Pointer Speed
121 pointer_scale_grid.row_spacing = 12;
122 pointer_scale_grid.column_spacing = 12;
123 pointer_scale_grid.margin_top = 12;
124 pointer_scale_grid.margin_start = 12;
125 pointer_scale_grid.column_homogeneous = false;
126 pointer_scale_grid.row_homogeneous = false;
127 pointer_speed_grid.row_spacing = 12;
128 pointer_speed_grid.column_spacing = 12;
129 pointer_speed_grid.column_homogeneous = false;
130 pointer_speed_grid.row_homogeneous = false;
131
132 //General
133 general_grid.margin_start = 12;
134 general_grid.row_spacing = 12;
135 general_grid.column_spacing = 12;
136 general_grid.column_homogeneous = false;
137 general_grid.row_homogeneous = false;
138
139 //Scrolling
140 scrolling_grid.margin_start = 12;
141 scrolling_grid.row_spacing = 12;
142 scrolling_grid.column_spacing = 12;
143 scrolling_grid.column_homogeneous = false;
144 scrolling_grid.row_homogeneous = false;
145 scrolling_label_grid.hexpand = false;
146 scrolling_label_grid.column_homogeneous = false;
147 scrolling_label_grid.column_spacing = 12;
148
149 /* ---- Widgets ---- */
150
151 // Pointer speed
152 pointer_speed_label.halign = Gtk.Align.START;
153 pointer_speed_label.use_markup = true;
154 acceleration_fast_label.use_markup = true;
155 acceleration_slow_label.use_markup = true;
156 acceleration_scale.draw_value = false;
157 acceleration_scale.hexpand = true;
158 acceleration_scale.set_value (touchpad_settings.motion_acceleration);
159
160 // General
161 general_label.halign = Gtk.Align.START;
162 general_label.use_markup = true;
163 tap_to_click_check.active = touchpad_settings.tap_to_click;
164 disable_while_typing_check.active = touchpad_settings.disable_while_typing;
165
166 // Scrolling
167 scrolling_label.halign = Gtk.Align.START;
168 scrolling_label.use_markup = true;
169 natural_scrolling_check.active = touchpad_settings.natural_scroll;
170 horizontal_scrolling_check.active = touchpad_settings.horiz_scroll_enabled;
171
172 var scroll_method = touchpad_settings.scroll_method;
173 if (scroll_method == TouchpadSettings.SCROLL_METHOD_DISABLED) {
174 scrolling_switch.active = false;
175 scrolling_two_finger_radio.sensitive = false;
176 natural_scrolling_check.sensitive = false;
177 horizontal_scrolling_check.sensitive = false;
178 previous_scroll_method = TouchpadSettings.SCROLL_METHOD_EDGE;
179 }
180 else if (scroll_method == TouchpadSettings.SCROLL_METHOD_EDGE) {
181 scrolling_switch.active = true;
182 scrolling_two_finger_radio.active = false;
183 }
184 else if (scroll_method == TouchpadSettings.SCROLL_METHOD_TWO_FINGER) {
185 scrolling_switch.active = true;
186 scrolling_two_finger_radio.active = true;
187 }
188 }
189
190 private void setup_signals () {
191 // Pointer Speed
192 acceleration_scale.value_changed.connect (() => {
193 touchpad_settings.motion_acceleration = acceleration_scale.adjustment.value;
194 touchpad_settings.motion_threshold = (int) (11 - acceleration_scale.adjustment.value);
195 });
196
197 touchpad_settings.changed["motion-acceleration"].connect (() => {
198 acceleration_scale.adjustment.value = touchpad_settings.motion_acceleration;
199 });
200
201 //General
202 touchpad_settings.changed["disable-while-typing"].connect (() => {
203 disable_while_typing_check.active = touchpad_settings.disable_while_typing;
204 });
205
206 touchpad_settings.changed["tap-to-click"].connect (() => {
207 tap_to_click_check.active = touchpad_settings.tap_to_click;
208 });
209
210 disable_while_typing_check.notify["active"].connect (() => {
211 touchpad_settings.disable_while_typing = disable_while_typing_check.active;
212 });
213
214 tap_to_click_check.notify["active"].connect (() => {
215 touchpad_settings.tap_to_click = tap_to_click_check.active;
216 });
217
218 // Scrolling
219 touchpad_settings.changed["natural-scroll"].connect (() => {
220 natural_scrolling_check.active = touchpad_settings.natural_scroll;
221 });
222
223 touchpad_settings.changed["horiz-scroll-enabled"].connect (() => {
224 horizontal_scrolling_check.active = touchpad_settings.horiz_scroll_enabled;
225 });
226
227 touchpad_settings.changed["scroll-method"].connect (() => {
228 var scroll_method = touchpad_settings.scroll_method;
229 if (scroll_method == TouchpadSettings.SCROLL_METHOD_DISABLED)
230 scrolling_switch.active = false;
231 else if (scroll_method == TouchpadSettings.SCROLL_METHOD_EDGE) {
232 scrolling_switch.active = true;
233 scrolling_two_finger_radio.active = false;
234 }
235 else {
236 scrolling_switch.active = true;
237 scrolling_two_finger_radio.active = true;
238 }
239 });
240
241 natural_scrolling_check.notify["active"].connect (() => {
242 touchpad_settings.natural_scroll = natural_scrolling_check.active;
243 });
244
245 horizontal_scrolling_check.notify["active"].connect (() => {
246 touchpad_settings.horiz_scroll_enabled = horizontal_scrolling_check.active;
247 });
248
249 scrolling_switch.notify["active"].connect (() => {
250 var active = scrolling_switch.active;
251 scrolling_two_finger_radio.sensitive = active;
252 natural_scrolling_check.sensitive = active;
253 horizontal_scrolling_check.sensitive = active;
254
255 if (!active) {
256 if (scrolling_two_finger_radio.active)
257 previous_scroll_method = TouchpadSettings.SCROLL_METHOD_TWO_FINGER;
258 else
259 previous_scroll_method = TouchpadSettings.SCROLL_METHOD_EDGE;
260 touchpad_settings.scroll_method = TouchpadSettings.SCROLL_METHOD_DISABLED;
261 }
262 else {
263 touchpad_settings.scroll_method = previous_scroll_method;
264 if (previous_scroll_method == TouchpadSettings.SCROLL_METHOD_EDGE)
265 scrolling_two_finger_radio.active = false;
266 else
267 scrolling_two_finger_radio.active = true;
268 }
269 });
270
271 scrolling_two_finger_radio.notify["active"].connect (() => {
272 if (scrolling_two_finger_radio.active)
273 touchpad_settings.scroll_method = TouchpadSettings.SCROLL_METHOD_TWO_FINGER;
274 else
275 touchpad_settings.scroll_method = TouchpadSettings.SCROLL_METHOD_EDGE;
276
277 });
278 }
279 }
280}
281\ No newline at end of file0\ No newline at end of file
2821
=== removed file 'src/Pages/Touchpad/touchpad-settings.vala'
--- src/Pages/Touchpad/touchpad-settings.vala 2014-07-27 22:49:48 +0000
+++ src/Pages/Touchpad/touchpad-settings.vala 1970-01-01 00:00:00 +0000
@@ -1,41 +0,0 @@
1/***
2 Copyright (C) 2014 Keith Gonyon <kgonyon@gmail.com>
3 This program is free software: you can redistribute it and/or modify it
4 under the terms of the GNU Lesser General Public License version 3, as published
5 by the Free Software Foundation.
6 This program is distributed in the hope that it will be useful, but
7 WITHOUT ANY WARRANTY; without even the implied warranties of
8 MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
9 PURPOSE. See the GNU General Public License for more details.
10 You should have received a copy of the GNU General Public License along
11 with this program. If not, see
12***/
13namespace MouseTouchpad {
14 class TouchpadSettings : Granite.Services.Settings {
15 public static string SCROLL_METHOD_DISABLED = "disabled";
16 public static string SCROLL_METHOD_EDGE = "edge-scrolling";
17 public static string SCROLL_METHOD_TWO_FINGER = "two-finger-scrolling";
18
19 public bool natural_scroll { get; set; }
20 public bool horiz_scroll_enabled { get; set; }
21 public bool tap_to_click { get; set; }
22 public bool disable_while_typing { get; set; }
23 public double motion_acceleration { get; set; }
24 public int motion_threshold { get; set; }
25 public string scroll_method { get; set; }
26
27 public TouchpadSettings () {
28 base ("org.gnome.settings-daemon.peripherals.touchpad");
29 }
30
31 // public void reset_all () {
32 // schema.reset ("natural-scroll");
33 // schema.reset ("horiz_scroll-enabled");
34 // schema.reset ("tab-to-click");
35 // schema.reset ("disable_while_typeing");
36 // schema.reset ("motion_acceleration");
37 // schema.reset ("motion_threshold");
38 // schema.reset ("scroll_method");
39 // }
40 }
41}
42\ No newline at end of file0\ No newline at end of file
431
=== added directory 'src/Widgets'
=== added file 'src/Widgets/GeneralSection.vala'
--- src/Widgets/GeneralSection.vala 1970-01-01 00:00:00 +0000
+++ src/Widgets/GeneralSection.vala 2015-08-23 23:11:04 +0000
@@ -0,0 +1,58 @@
1/*
2 * Copyright (c) 2011-2015 elementary Developers (https://launchpad.net/elementary)
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 */
19
20public class MouseTouchpad.Widgets.GeneralSection : Section {
21 private Backend.MouseSettings mouse_settings;
22
23 private Granite.Widgets.ModeButton primary_button_switcher;
24 private Gtk.Switch reveal_pointer_switch;
25
26 public GeneralSection (Backend.MouseSettings mouse_settings) {
27 base (_("General"));
28
29 this.mouse_settings = mouse_settings;
30
31 build_ui ();
32 create_bindings ();
33 }
34
35 private void build_ui () {
36 primary_button_switcher = new Granite.Widgets.ModeButton ();
37 primary_button_switcher.append_text (_("Left"));
38 primary_button_switcher.append_text (_("Right"));
39
40 reveal_pointer_switch = new Gtk.Switch ();
41 reveal_pointer_switch.halign = Gtk.Align.START;
42
43 this.add_entry (_("Primary Button:"), primary_button_switcher);
44 this.add_entry (_("Reveal pointer:"), reveal_pointer_switch, _("Pressing the control key will highlight the position of the pointer"));
45 }
46
47 private void create_bindings () {
48 mouse_settings.bind_property ("left-handed",
49 primary_button_switcher,
50 "selected",
51 BindingFlags.BIDIRECTIONAL | BindingFlags.SYNC_CREATE);
52
53 mouse_settings.bind_property ("locate-pointer",
54 reveal_pointer_switch,
55 "state",
56 BindingFlags.BIDIRECTIONAL | BindingFlags.SYNC_CREATE);
57 }
58}
0\ No newline at end of file59\ No newline at end of file
160
=== added file 'src/Widgets/MouseSection.vala'
--- src/Widgets/MouseSection.vala 1970-01-01 00:00:00 +0000
+++ src/Widgets/MouseSection.vala 2015-08-23 23:11:04 +0000
@@ -0,0 +1,62 @@
1/*
2 * Copyright (c) 2011-2015 elementary Developers (https://launchpad.net/elementary)
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 */
19
20public class MouseTouchpad.Widgets.MouseSection : Section {
21 private Backend.MouseSettings mouse_settings;
22
23 private Gtk.Scale pointer_speed_scale;
24
25 public MouseSection (Backend.MouseSettings mouse_settings) {
26 base (_("Mouse"));
27
28 this.mouse_settings = mouse_settings;
29
30 build_ui ();
31 create_bindings ();
32 }
33
34 private void build_ui () {
35 pointer_speed_scale = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 1, 10, 1);
36 pointer_speed_scale.digits = 2;
37 pointer_speed_scale.draw_value = false;
38 pointer_speed_scale.set_size_request (160, -1);
39
40 this.add_entry (_ ("Pointer speed:"), pointer_speed_scale);
41 }
42
43 private void create_bindings () {
44 mouse_settings.bind_property ("motion-acceleration",
45 pointer_speed_scale.adjustment,
46 "value",
47 BindingFlags.BIDIRECTIONAL | BindingFlags.SYNC_CREATE);
48
49 pointer_speed_scale.adjustment.bind_property ("value",
50 mouse_settings,
51 "motion-threshold",
52 BindingFlags.SYNC_CREATE,
53 pointer_speed_scale_transform_func);
54 }
55
56 private bool pointer_speed_scale_transform_func (Binding binding, Value source_value, ref Value target_value) {
57 int val = 11 - (int)source_value.get_double ();
58 target_value.set_int (val);
59
60 return true;
61 }
62}
0\ No newline at end of file63\ No newline at end of file
164
=== added file 'src/Widgets/Section.vala'
--- src/Widgets/Section.vala 1970-01-01 00:00:00 +0000
+++ src/Widgets/Section.vala 2015-08-23 23:11:04 +0000
@@ -0,0 +1,64 @@
1/*
2 * Copyright (c) 2011-2015 elementary Developers (https://launchpad.net/elementary)
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 */
19
20public class MouseTouchpad.Widgets.Section : Gtk.Grid {
21 private Gtk.Label title_label;
22
23 private int row_count = 0;
24
25 public Section (string title) {
26 build_ui (title);
27 }
28
29 public void add_entry (string option, Gtk.Widget widget, string description = "") {
30 int row = row_count++;
31
32 Gtk.Label option_label = new Gtk.Label (option);
33 option_label.halign = Gtk.Align.END;
34
35 this.attach (option_label, 0, row, 1, 1);
36
37 if (description == "") {
38 this.attach (widget, 1, row, 1, 1);
39 } else {
40 Gtk.Box widget_container = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
41 widget_container.hexpand = false;
42
43 Gtk.Image help_icon = new Gtk.Image.from_icon_name ("help-info-symbolic", Gtk.IconSize.BUTTON);
44 help_icon.tooltip_text = description;
45
46 widget_container.add (widget);
47 widget_container.add (help_icon);
48
49 this.attach (widget_container, 1, row, 1, 1);
50 }
51 }
52
53 private void build_ui (string title) {
54 this.row_spacing = 12;
55 this.column_spacing = 12;
56 this.column_homogeneous = true;
57
58 title_label = new Gtk.Label (title);
59 title_label.halign = Gtk.Align.START;
60 title_label.get_style_context ().add_class ("h4");
61
62 this.attach (title_label, 0, row_count++, 2, 1);
63 }
64}
0\ No newline at end of file65\ No newline at end of file
166
=== added file 'src/Widgets/TouchpadSection.vala'
--- src/Widgets/TouchpadSection.vala 1970-01-01 00:00:00 +0000
+++ src/Widgets/TouchpadSection.vala 2015-08-23 23:11:04 +0000
@@ -0,0 +1,114 @@
1/*
2 * Copyright (c) 2011-2015 elementary Developers (https://launchpad.net/elementary)
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 */
19
20public class MouseTouchpad.Widgets.TouchpadSection : Section {
21 private Backend.TouchpadSettings touchpad_settings;
22
23 private Gtk.Switch disable_while_typing_switch;
24 private Gtk.Switch tap_to_click_switch;
25 private Gtk.Scale pointer_speed_scale;
26 private Gtk.ComboBoxText scrolling_combobox;
27 private Gtk.Switch horizontal_scrolling_switch;
28 private Gtk.Switch natural_scrolling_switch;
29
30 public TouchpadSection (Backend.TouchpadSettings touchpad_settings) {
31 base (_("Touchpad"));
32
33 this.touchpad_settings = touchpad_settings;
34
35 build_ui ();
36 create_bindings ();
37 }
38
39 private void build_ui () {
40 disable_while_typing_switch = new Gtk.Switch ();
41 disable_while_typing_switch.halign = Gtk.Align.START;
42
43 tap_to_click_switch = new Gtk.Switch ();
44 tap_to_click_switch.halign = Gtk.Align.START;
45
46 pointer_speed_scale = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 1, 10, 1);
47 pointer_speed_scale.digits = 2;
48 pointer_speed_scale.draw_value = false;
49 pointer_speed_scale.set_size_request (160, -1);
50
51 scrolling_combobox = new Gtk.ComboBoxText ();
52 scrolling_combobox.append ("two-finger-scrolling", _("Two-finger"));
53 scrolling_combobox.append ("edge-scrolling", _("Edge"));
54 scrolling_combobox.append ("disabled", _("Disabled"));
55
56 horizontal_scrolling_switch = new Gtk.Switch ();
57 horizontal_scrolling_switch.halign = Gtk.Align.START;
58
59 natural_scrolling_switch = new Gtk.Switch ();
60 natural_scrolling_switch.halign = Gtk.Align.START;
61
62 this.add_entry (_("Disable while typing:"), disable_while_typing_switch);
63 this.add_entry (_("Tap to click:"), tap_to_click_switch);
64 this.add_entry (_("Pointer speed:"), pointer_speed_scale);
65 this.add_entry (_("Scrolling:"), scrolling_combobox);
66 this.add_entry (_("Horizontal scrolling:"), horizontal_scrolling_switch);
67 this.add_entry (_("Natural scrolling:"), natural_scrolling_switch);
68 }
69
70 private void create_bindings () {
71 touchpad_settings.bind_property ("disable-while-typing",
72 disable_while_typing_switch,
73 "state",
74 BindingFlags.BIDIRECTIONAL | BindingFlags.SYNC_CREATE);
75
76 touchpad_settings.bind_property ("tap-to-click",
77 tap_to_click_switch,
78 "state",
79 BindingFlags.BIDIRECTIONAL | BindingFlags.SYNC_CREATE);
80
81 touchpad_settings.bind_property ("motion-acceleration",
82 pointer_speed_scale.adjustment,
83 "value",
84 BindingFlags.BIDIRECTIONAL | BindingFlags.SYNC_CREATE);
85
86 pointer_speed_scale.adjustment.bind_property ("value",
87 touchpad_settings,
88 "motion-threshold",
89 BindingFlags.SYNC_CREATE,
90 pointer_speed_scale_transform_func);
91
92 touchpad_settings.bind_property ("scroll-method",
93 scrolling_combobox,
94 "active-id",
95 BindingFlags.BIDIRECTIONAL | BindingFlags.SYNC_CREATE);
96
97 touchpad_settings.bind_property ("horiz-scroll-enabled",
98 horizontal_scrolling_switch,
99 "state",
100 BindingFlags.BIDIRECTIONAL | BindingFlags.SYNC_CREATE);
101
102 touchpad_settings.bind_property ("natural-scroll",
103 natural_scrolling_switch,
104 "state",
105 BindingFlags.BIDIRECTIONAL | BindingFlags.SYNC_CREATE);
106 }
107
108 private bool pointer_speed_scale_transform_func (Binding binding, Value source_value, ref Value target_value) {
109 int val = 11 - (int)source_value.get_double ();
110 target_value.set_int (val);
111
112 return true;
113 }
114}
0\ No newline at end of file115\ No newline at end of file
1116
=== modified file 'src/mouse-touchpad.vala' (properties changed: -x to +x)
--- src/mouse-touchpad.vala 2014-07-27 22:49:48 +0000
+++ src/mouse-touchpad.vala 2015-08-23 23:11:04 +0000
@@ -1,35 +1,32 @@
1/***1/*
2 Copyright (C) 2014 Keith Gonyon <kgonyon@gmail.com>2 * Copyright (c) 2011-2015 elementary Developers (https://launchpad.net/elementary)
3 This program is free software: you can redistribute it and/or modify it3 *
4 under the terms of the GNU Lesser General Public License version 3, as published4 * This program is free software; you can redistribute it and/or
5 by the Free Software Foundation.5 * modify it under the terms of the GNU General Public
6 This program is distributed in the hope that it will be useful, but6 * License as published by the Free Software Foundation; either
7 WITHOUT ANY WARRANTY; without even the implied warranties of7 * version 2 of the License, or (at your option) any later version.
8 MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR8 *
9 PURPOSE. See the GNU General Public License for more details.9 * This program is distributed in the hope that it will be useful,
10 You should have received a copy of the GNU General Public License along10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 with this program. If not, see 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12***/12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 */
19
13namespace MouseTouchpad {20namespace MouseTouchpad {
14 public class Plug : Switchboard.Plug {21 public class Plug : Switchboard.Plug {
15 /* ---- Layout Variables ---- */22 private Backend.MouseSettings mouse_settings;
16 Gtk.Grid main_grid;23 private Backend.TouchpadSettings touchpad_settings;
17 Gtk.Grid separator_grid;24
18 Gtk.Separator left_separator;25 private Gtk.Grid main_grid;
19 Gtk.Separator right_separator;26
20 Gtk.Stack pages;27 private Widgets.GeneralSection general_section;
21 Gtk.StackSwitcher page_switcher;28 private Widgets.MouseSection mouse_section;
2229 private Widgets.TouchpadSection touchpad_section;
23 /* ----- General settings variables ---- */
24 Gtk.Label general_settings_label;
25 Gtk.ButtonBox handed_buttons;
26 Gtk.RadioButton left_handed_button;
27 Gtk.RadioButton right_handed_button;
28 Gtk.Grid pointer_reveal_grid;
29 Gtk.CheckButton pointer_reveal_check;
30
31 // Settings
32 MouseSettings mouse_settings;
3330
34 public Plug () {31 public Plug () {
35 Object (category: Category.HARDWARE,32 Object (category: Category.HARDWARE,
@@ -37,120 +34,58 @@
37 display_name: _("Mouse & Touchpad"),34 display_name: _("Mouse & Touchpad"),
38 description: _("Set your mouse and touchpad preferences"),35 description: _("Set your mouse and touchpad preferences"),
39 icon: "preferences-desktop-peripherals");36 icon: "preferences-desktop-peripherals");
40
41 mouse_settings = new MouseSettings ();
42 }37 }
4338
44 public override Gtk.Widget get_widget () {39 public override Gtk.Widget get_widget () {
45 if (main_grid == null) {40 if (main_grid == null) {
46 // Initialize variables41 load_settings ();
47 // Main42 build_ui ();
48 main_grid = new Gtk.Grid ();
49 separator_grid = new Gtk.Grid ();
50 pages = new Gtk.Stack ();
51 page_switcher = new Gtk.StackSwitcher ();
52 // General
53 general_settings_label = new Gtk.Label (_("<b>General:</b>"));
54 handed_buttons = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL);
55 left_handed_button = new Gtk.RadioButton.with_label (null, _("Left-handed"));
56 right_handed_button = new Gtk.RadioButton.with_label (left_handed_button.get_group(),
57 _("Right-handed"));
58 pointer_reveal_grid = new Gtk.Grid ();
59 pointer_reveal_check = new Gtk.CheckButton.with_label (_("Pointer Reveal"));
60 left_separator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL);
61 right_separator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL);
62
63 setup_widgets ();
64 setup_signals ();
65
66 // Attach
67 // General
68 handed_buttons.add (left_handed_button);
69 handed_buttons.add (right_handed_button);
70 pointer_reveal_grid.attach (pointer_reveal_check, 0, 0, 1, 1);
71 // Separator
72 separator_grid.add (left_separator);
73 separator_grid.add (page_switcher);
74 separator_grid.add (right_separator);
75 // Main
76 main_grid.attach (general_settings_label, 0, 0, 1, 1);
77 main_grid.attach (pointer_reveal_grid, 0, 1, 1, 1);
78 main_grid.attach (handed_buttons, 0, 2, 1, 1);
79 main_grid.attach (separator_grid, 0, 4, 1, 1);
80 main_grid.attach (pages, 0, 5, 1, 1);
81 }43 }
8244
83 main_grid.show_all ();
84 return main_grid;45 return main_grid;
85 }46 }
8647
87 public override void shown () {48 public override void shown () {
88
89 }49 }
9050
91 public override void hidden () {51 public override void hidden () {
92
93 }52 }
9453
95 public override void search_callback (string location) {54 public override void search_callback (string location) {
96
97 }55 }
9856
99 // 'search' returns results like ("Keyboard → Behavior → Duration", "keyboard<sep>behavior")57 /* 'search' returns results like ("Keyboard → Behavior → Duration", "keyboard<sep>behavior") */
100 public override async Gee.TreeMap<string, string> search (string search) {58 public override async Gee.TreeMap<string, string> search (string search) {
101 return new Gee.TreeMap<string, string> (null, null);59 return new Gee.TreeMap<string, string> (null, null);
102 }60 }
10361
104 private void setup_widgets () {62 private void load_settings () {
105 // Grid63 mouse_settings = new Backend.MouseSettings ();
106 main_grid.margin = 12;64 touchpad_settings = new Backend.TouchpadSettings ();
65 }
66
67 private void build_ui () {
68 main_grid = new Gtk.Grid ();
69 main_grid.margin = 12;
107 main_grid.row_spacing = 12;70 main_grid.row_spacing = 12;
10871 main_grid.halign = Gtk.Align.CENTER;
109 separator_grid.hexpand = true;72
110 left_separator.hexpand = true;73 general_section = new Widgets.GeneralSection (mouse_settings);
111 right_separator.hexpand = true;74 mouse_section = new Widgets.MouseSection (mouse_settings);
11275 touchpad_section = new Widgets.TouchpadSection (touchpad_settings);
113 // Pages76
114 page_switcher.set_stack(pages);77 main_grid.attach (general_section, 0, 0, 1, 1);
115 page_switcher.halign = Gtk.Align.CENTER;78 main_grid.attach (mouse_section, 0, 1, 1, 1);
116 pages.add_titled (new MousePage (), "mouse", _("Mouse"));79 main_grid.attach (touchpad_section, 0, 2, 1, 1);
117 pages.add_titled (new TouchpadPage (), "touchpad", _("Touchpad"));80 main_grid.show_all ();
118
119 // General
120 general_settings_label.use_markup = true;
121 general_settings_label.halign = Gtk.Align.START;
122 handed_buttons.layout_style = Gtk.ButtonBoxStyle.START;
123 handed_buttons.margin_start = 12;
124 pointer_reveal_grid.margin_start = 12;
125 pointer_reveal_grid.column_spacing = 12;
126
127 left_handed_button.active = mouse_settings.left_handed;
128 right_handed_button.active = !mouse_settings.left_handed;
129 }
130
131 private void setup_signals () {
132 mouse_settings.changed["left-handed"].connect (() => {
133 left_handed_button.active = mouse_settings.left_handed;
134 right_handed_button.active = !mouse_settings.left_handed;
135 });
136
137 mouse_settings.changed["locate-pointer"].connect (() => {
138 pointer_reveal_check.active = mouse_settings.locate_pointer;
139 });
140
141 left_handed_button.notify["active"].connect (() => {
142 mouse_settings.left_handed = left_handed_button.active;
143 });
144
145 pointer_reveal_check.notify["active"].connect (() => {
146 mouse_settings.locate_pointer = pointer_reveal_check.active;
147 });
148 }81 }
149 }82 }
150}83}
15184
152public Switchboard.Plug get_plug (Module module) {85public Switchboard.Plug get_plug (Module module) {
153 debug ("Activating Mouse-Touchpad plug");86 debug ("Activating Mouse-Touchpad plug");
87
154 var plug = new MouseTouchpad.Plug ();88 var plug = new MouseTouchpad.Plug ();
89
155 return plug;90 return plug;
156}91}
157\ No newline at end of file92\ No newline at end of file
15893
=== removed file 'src/page.vala'
--- src/page.vala 2014-07-25 19:34:08 +0000
+++ src/page.vala 1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
1/***
2 Copyright (C) 2014 Keith Gonyon <kgonyon@gmail.com>
3 This program is free software: you can redistribute it and/or modify it
4 under the terms of the GNU Lesser General Public License version 3, as published
5 by the Free Software Foundation.
6 This program is distributed in the hope that it will be useful, but
7 WITHOUT ANY WARRANTY; without even the implied warranties of
8 MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
9 PURPOSE. See the GNU General Public License for more details.
10 You should have received a copy of the GNU General Public License along
11 with this program. If not, see
12***/
13namespace MouseTouchpad {
14 public abstract class AbstractPage : Gtk.Grid {
15 public AbstractPage () {
16
17 this.row_spacing = 24;
18 this.column_spacing = 12;
19 this.margin_top = 12;
20 this.margin_bottom = 12;
21 this.column_homogeneous = true;
22 this.row_homogeneous = false;
23 }
24
25 public abstract void reset ();
26 }
27}
28\ No newline at end of file0\ No newline at end of file

Subscribers

People subscribed via source and target branches