Merge lp:~kay20/switchboard-plug-power/fix-1607554 into lp:~elementary-apps/switchboard-plug-power/trunk

Proposed by kay van der Zander
Status: Merged
Approved by: kay van der Zander
Approved revision: 353
Merged at revision: 366
Proposed branch: lp:~kay20/switchboard-plug-power/fix-1607554
Merge into: lp:~elementary-apps/switchboard-plug-power/trunk
Diff against target: 121 lines (+38/-36)
1 file modified
src/Plug.vala (+38/-36)
To merge this branch: bzr merge lp:~kay20/switchboard-plug-power/fix-1607554
Reviewer Review Type Date Requested Status
Zisu Andrei (community) Approve
Review via email: mp+304862@code.launchpad.net

Commit message

fix #1607554

Description of the change

this branch fixes bug #1607554 to make more clear that there are 2 settings and not lid close only on battery. it is lid close when no other screen is attached. so battery or pluged in is one setting.

so i moved the settings into the general settings for laptops.
because it has nothing to do with battery or pluged in

added a UI fix for "Turn of display when inactive for" layout wasn't the same as the other labels

To post a comment you must log in.
Revision history for this message
Zisu Andrei (matzipan) wrote :

Builds and runs, but it says "you have to restart for the settings to take effect", which I cannot do at the moment, sorry.

review: Approve (builds and runs)
Revision history for this message
Zisu Andrei (matzipan) wrote :

Code looks alright

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Plug.vala'
2--- src/Plug.vala 2016-09-04 09:21:16 +0000
3+++ src/Plug.vala 2016-09-04 11:40:04 +0000
4@@ -136,10 +136,10 @@
5 switcher_grid.add (stack_switcher);
6 switcher_grid.add (right_sep);
7
8- main_grid.attach (switcher_grid, 0, 6, 2, 1);
9+ main_grid.attach (switcher_grid, 0, 7, 2, 1);
10 }
11
12- main_grid.attach (stack, 0, 7, 2, 1);
13+ main_grid.attach (stack, 0, 8, 2, 1);
14 stack_container.add (main_grid);
15
16 stack_container.margin_bottom = 12;
17@@ -240,14 +240,50 @@
18 scale.value_changed.connect (on_scale_value_changed);
19 (screen as DBusProxy).g_properties_changed.connect (on_screen_properties_changed);
20
21+ var lid_closed_box = new LidCloseActionComboBox (_("When lid is closed:"), cli_communicator);
22+ lid_closed_box.sensitive = false;
23+ lid_closed_box.label.sensitive = false;
24+ label_size.add_widget (lid_closed_box.label);
25+
26+ var lid_dock_box = new LidCloseActionComboBox (_("When lid is closed with external monitor:"), cli_communicator);
27+ lid_dock_box.sensitive = false;
28+ lid_dock_box.label.sensitive = false;
29+ label_size.add_widget (lid_dock_box.label);
30+
31+ // lock and UI visible that settings are locked and unlocked
32+ get_permission ().notify["allowed"].connect (() => {
33+ if (get_permission ().allowed) {
34+ lid_closed_box.sensitive = true;
35+ lid_closed_box.label.sensitive = true;
36+ lid_dock_box.sensitive = true;
37+ lid_dock_box.label.sensitive = true;
38+ lock_image.visible = false;
39+ lock_image2.visible = false;
40+ } else {
41+ lid_closed_box.sensitive = false;
42+ lid_closed_box.label.sensitive = false;
43+ lid_dock_box.sensitive = false;
44+ lid_dock_box.label.sensitive = false;
45+ lock_image.visible = true;
46+ lock_image2.visible = true;
47+ }
48+ });
49+
50 main_grid.attach (brightness_label, 0, 0, 1, 1);
51 main_grid.attach (scale, 1, 0, 1, 1);
52 main_grid.attach (als_label, 0, 1, 1, 1);
53 main_grid.attach (als_switch, 1, 1, 1, 1);
54+ main_grid.attach (lid_closed_box.label, 0, 5, 1, 1);
55+ main_grid.attach (lid_closed_box, 1, 5, 1, 1);
56+ main_grid.attach (lock_image2, 2, 5, 1, 1);
57+ main_grid.attach (lid_dock_box.label, 0, 6, 1, 1);
58+ main_grid.attach (lid_dock_box, 1, 6, 1, 1);
59+ main_grid.attach (lock_image, 2, 6, 1, 1);
60 }
61
62 var screen_timeout_label = new Gtk.Label (_("Turn off display when inactive for:"));
63 screen_timeout_label.halign = Gtk.Align.END;
64+ screen_timeout_label.xalign = 1.0f;
65 label_size.add_widget (screen_timeout_label);
66
67 var screen_timeout = new TimeoutComboBox (pantheon_dpms_settings, "standby-time");
68@@ -301,9 +337,6 @@
69 grid.attach (sleep_timeout_label, 0, 1, 1, 1);
70 grid.attach (sleep_timeout, 1, 1, 1, 1);
71
72- var lid_dock_box = new LidCloseActionComboBox (_("When docked and lid is closed:"), cli_communicator);
73- var lid_closed_box = new LidCloseActionComboBox (_("When lid is closed:"), cli_communicator);
74-
75 if (!ac) {
76 var dim_label = new Gtk.Label (_("Dim display when inactive:"));
77 ((Gtk.Misc) dim_label).xalign = 1.0f;
78@@ -313,44 +346,13 @@
79
80 settings.bind ("idle-dim", dim_switch, "active", SettingsBindFlags.DEFAULT);
81
82- lid_closed_box.sensitive = false;
83- lid_closed_box.label.sensitive = false;
84- label_size.add_widget (lid_closed_box.label);
85-
86 grid.attach (dim_label, 0, 0, 1, 1);
87 grid.attach (dim_switch, 1, 0, 1, 1);
88- grid.attach (lid_closed_box.label, 0, 2, 1, 1);
89- grid.attach (lid_closed_box, 1, 2, 1, 1);
90- grid.attach (lock_image2, 2, 2, 1, 1);
91
92 } else if (battery.laptop) {
93- lid_dock_box.sensitive = false;
94- lid_dock_box.label.sensitive = false;
95- label_size.add_widget (lid_dock_box.label);
96
97- grid.attach (lid_dock_box.label, 0, 2, 1, 1);
98- grid.attach (lid_dock_box, 1, 2, 1, 1);
99- grid.attach (lock_image, 2, 2, 1, 1);
100 }
101
102- get_permission ().notify["allowed"].connect (() => {
103- if (get_permission ().allowed) {
104- lid_closed_box.sensitive = true;
105- lid_closed_box.label.sensitive = true;
106- lid_dock_box.sensitive = true;
107- lid_dock_box.label.sensitive = true;
108- lock_image.visible = false;
109- lock_image2.visible = false;
110- } else {
111- lid_closed_box.sensitive = false;
112- lid_closed_box.label.sensitive = false;
113- lid_dock_box.sensitive = false;
114- lid_dock_box.label.sensitive = false;
115- lock_image.visible = true;
116- lock_image2.visible = true;
117- }
118- });
119-
120 return grid;
121 }
122

Subscribers

People subscribed via source and target branches