Merge lp:~elementary-pantheon/switchboard-plug-keyboard/behavior-sensitive-bind into lp:~elementary-pantheon/switchboard-plug-keyboard/trunk

Proposed by Danielle Foré
Status: Merged
Approved by: Danielle Foré
Approved revision: 500
Merged at revision: 504
Proposed branch: lp:~elementary-pantheon/switchboard-plug-keyboard/behavior-sensitive-bind
Merge into: lp:~elementary-pantheon/switchboard-plug-keyboard/trunk
Diff against target: 120 lines (+27/-63)
1 file modified
src/Pages/behaviour.vala (+27/-63)
To merge this branch: bzr merge lp:~elementary-pantheon/switchboard-plug-keyboard/behavior-sensitive-bind
Reviewer Review Type Date Requested Status
David Hewitt Approve
elementary Pantheon team Pending
Review via email: mp+316639@code.launchpad.net

Commit message

behaviour.vala: set widget sensitivity with property bindings

Description of the change

This is the first of many branches that will constitute a rewrite. I originally made a much larger branch, but it quickly was such a crazy diff that it can't be reviewed. So my intention here is to submit multiple smaller branches that each do a single thing.

To post a comment you must log in.
Revision history for this message
David Hewitt (davidmhewitt) wrote :

Can confirm that the exact same functionality is replicated with the much cleaner code.

review: Approve
Revision history for this message
RabbitBot (rabbitbot-a) wrote :

Attempt to merge into lp:switchboard-plug-keyboard failed due to conflicts:

text conflict in src/Pages/behaviour.vala

500. By Danielle Foré

use property bindings

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Pages/behaviour.vala'
2--- src/Pages/behaviour.vala 2017-02-07 22:52:29 +0000
3+++ src/Pages/behaviour.vala 2017-02-11 23:36:31 +0000
4@@ -68,13 +68,6 @@
5
6 switch_repeat.active = settings_repeat.repeat;
7
8- scale_repeat_delay.sensitive = switch_repeat.active;
9- label_repeat_delay.sensitive = switch_repeat.active;
10- spin_repeat_delay.sensitive = switch_repeat.active;
11- scale_repeat_speed.sensitive = switch_repeat.active;
12- label_repeat_speed.sensitive = switch_repeat.active;
13- spin_repeat_speed.sensitive = switch_repeat.active;
14-
15 // connect signals
16 scale_repeat_delay.value_changed.connect (() => {
17 settings_repeat.delay = (uint) (spin_repeat_delay.adjustment.value = scale_repeat_delay.adjustment.value);
18@@ -100,31 +93,13 @@
19 scale_repeat_speed.adjustment.value = spin_repeat_speed.adjustment.value = (double) settings_repeat.repeat_interval;
20 } );
21
22- switch_repeat.notify["active"].connect (() =>
23- {
24- var active = switch_repeat.active;
25-
26- scale_repeat_delay.sensitive = active;
27- label_repeat_delay.sensitive = active;
28- spin_repeat_delay.sensitive = active;
29- scale_repeat_speed.sensitive = active;
30- label_repeat_speed.sensitive = active;
31- spin_repeat_speed.sensitive = active;
32- settings_repeat.repeat = active;
33- } );
34-
35- settings_repeat.changed["repeat"].connect (() =>
36- {
37- var active = settings_repeat.repeat;
38-
39- scale_repeat_delay.sensitive = active;
40- label_repeat_delay.sensitive = active;
41- spin_repeat_delay.sensitive = active;
42- scale_repeat_speed.sensitive = active;
43- label_repeat_speed.sensitive = active;
44- spin_repeat_speed.sensitive = active;
45- switch_repeat.active = active;
46- } );
47+ switch_repeat.notify["active"].connect (() => {
48+ settings_repeat.repeat = switch_repeat.active;
49+ });
50+
51+ settings_repeat.changed["repeat"].connect (() => {
52+ switch_repeat.active = settings_repeat.repeat;
53+ });
54
55 var label_blink = new Gtk.Label (_("Cursor Blinking:"));
56 label_blink.get_style_context ().add_class ("h4");
57@@ -180,12 +155,19 @@
58
59 switch_blink.active = settings_blink.cursor_blink;
60
61- scale_blink_speed.sensitive = switch_blink.active;
62- label_blink_speed.sensitive = switch_blink.active;
63- spin_blink_speed.sensitive = switch_blink.active;
64- scale_blink_time.sensitive = switch_blink.active;
65- label_blink_time.sensitive = switch_blink.active;
66- spin_blink_time.sensitive = switch_blink.active;
67+ switch_blink.bind_property ("active", label_blink_speed, "sensitive", BindingFlags.DEFAULT);
68+ switch_blink.bind_property ("active", label_blink_time, "sensitive", BindingFlags.DEFAULT);
69+ switch_blink.bind_property ("active", scale_blink_speed, "sensitive", BindingFlags.DEFAULT);
70+ switch_blink.bind_property ("active", scale_blink_time, "sensitive", BindingFlags.DEFAULT);
71+ switch_blink.bind_property ("active", spin_blink_speed, "sensitive", BindingFlags.DEFAULT);
72+ switch_blink.bind_property ("active", spin_blink_time, "sensitive", BindingFlags.DEFAULT);
73+
74+ switch_repeat.bind_property ("active", label_repeat_delay, "sensitive", BindingFlags.DEFAULT);
75+ switch_repeat.bind_property ("active", label_repeat_speed, "sensitive", BindingFlags.DEFAULT);
76+ switch_repeat.bind_property ("active", scale_repeat_delay, "sensitive", BindingFlags.DEFAULT);
77+ switch_repeat.bind_property ("active", scale_repeat_speed, "sensitive", BindingFlags.DEFAULT);
78+ switch_repeat.bind_property ("active", spin_repeat_delay, "sensitive", BindingFlags.DEFAULT);
79+ switch_repeat.bind_property ("active", spin_repeat_speed, "sensitive", BindingFlags.DEFAULT);
80
81 // connect signals
82 scale_blink_speed.value_changed.connect (() => {
83@@ -212,31 +194,13 @@
84 scale_blink_time.adjustment.value = spin_blink_time.adjustment.value = (double) settings_blink.cursor_blink_timeout;
85 } );
86
87- switch_blink.notify["active"].connect (() =>
88- {
89- var active = switch_blink.active;
90-
91- scale_blink_speed.sensitive = active;
92- label_blink_speed.sensitive = active;
93- spin_blink_speed.sensitive = active;
94- scale_blink_time.sensitive = active;
95- label_blink_time.sensitive = active;
96- spin_blink_time.sensitive = active;
97- settings_blink.cursor_blink = active;
98- } );
99-
100- settings_blink.changed["cursor-blink"].connect (() =>
101- {
102- var active = settings_blink.cursor_blink;
103-
104- scale_blink_speed.sensitive = active;
105- label_blink_speed.sensitive = active;
106- spin_blink_speed.sensitive = active;
107- scale_blink_time.sensitive = active;
108- label_blink_time.sensitive = active;
109- spin_blink_time.sensitive = active;
110- switch_blink.active = active;
111- } );
112+ switch_blink.notify["active"].connect (() => {
113+ settings_blink.cursor_blink = switch_blink.active;
114+ });
115+
116+ settings_blink.changed["cursor-blink"].connect (() => {
117+ switch_blink.active = settings_blink.cursor_blink;
118+ });
119
120 /** Test Settings **/
121

Subscribers

People subscribed via source and target branches