Merge lp:~djaler1/switchboard-plug-power/fix-bug-1598368 into lp:~elementary-apps/switchboard-plug-power/trunk

Proposed by Kirill Romanov
Status: Merged
Approved by: kay van der Zander
Approved revision: 332
Merged at revision: 332
Proposed branch: lp:~djaler1/switchboard-plug-power/fix-bug-1598368
Merge into: lp:~elementary-apps/switchboard-plug-power/trunk
Diff against target: 78 lines (+9/-21)
2 files modified
src/ActionComboBox.vala (+3/-5)
src/Plug.vala (+6/-16)
To merge this branch: bzr merge lp:~djaler1/switchboard-plug-power/fix-bug-1598368
Reviewer Review Type Date Requested Status
kay van der Zander (community) code Approve
Review via email: mp+300261@code.launchpad.net

Commit message

Remove deprecated keys: button-power, button-sleep, critical-battery-action. Add new key - power-button-action.

Description of the change

Fix bug#1598368

To post a comment you must log in.
Revision history for this message
kay van der Zander (kay20) wrote :

looks good thank you.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/ActionComboBox.vala'
--- src/ActionComboBox.vala 2016-07-04 02:25:39 +0000
+++ src/ActionComboBox.vala 2016-07-16 21:00:29 +0000
@@ -24,9 +24,9 @@
24 private string key;24 private string key;
2525
26 // this maps combobox indices to gsettings enums26 // this maps combobox indices to gsettings enums
27 private int[] map_to_sett = {1, 2, 3, 4, 5};27 private int[] map_to_sett = {0, 1, 2};
28 // and vice-versa28 // and vice-versa
29 private int[] map_to_list = {4, 0, 1, 2, 3, 4};29 private int[] map_to_list = {0, 1, 2};
3030
31 public ActionComboBox (string label_name, string key_value) {31 public ActionComboBox (string label_name, string key_value) {
32 key = key_value;32 key = key_value;
@@ -34,11 +34,9 @@
34 label.halign = Gtk.Align.END;34 label.halign = Gtk.Align.END;
35 ((Gtk.Misc) label).xalign = 1.0f;35 ((Gtk.Misc) label).xalign = 1.0f;
3636
37 append_text (_("Do nothing"));
37 append_text (_("Suspend"));38 append_text (_("Suspend"));
38 append_text (_("Shutdown"));
39 append_text (_("Hibernate"));39 append_text (_("Hibernate"));
40 append_text (_("Ask me"));
41 append_text (_("Do nothing"));
4240
43 hexpand = true;41 hexpand = true;
4442
4543
=== modified file 'src/Plug.vala'
--- src/Plug.vala 2016-07-07 04:27:29 +0000
+++ src/Plug.vala 2016-07-16 21:00:29 +0000
@@ -242,18 +242,13 @@
242 var screen_timeout = new TimeoutComboBox (pantheon_dpms_settings, "standby-time");242 var screen_timeout = new TimeoutComboBox (pantheon_dpms_settings, "standby-time");
243 screen_timeout.changed.connect (run_dpms_helper);243 screen_timeout.changed.connect (run_dpms_helper);
244244
245 var sleep_combobox = new ActionComboBox (_("Sleep button:"), "button-sleep");245 var power_combobox = new ActionComboBox (_("Power button:"), "power-button-action");
246 label_size.add_widget (sleep_combobox.label);
247
248 var power_combobox = new ActionComboBox (_("Power button:"), "button-power");
249 label_size.add_widget (power_combobox.label);246 label_size.add_widget (power_combobox.label);
250247
251 main_grid.attach (screen_timeout_label, 0, 3, 1, 1);248 main_grid.attach (screen_timeout_label, 0, 3, 1, 1);
252 main_grid.attach (screen_timeout, 1, 3, 1, 1);249 main_grid.attach (screen_timeout, 1, 3, 1, 1);
253 main_grid.attach (sleep_combobox.label, 0, 4, 1, 1);250 main_grid.attach (power_combobox.label, 0, 4, 1, 1);
254 main_grid.attach (sleep_combobox, 1, 4, 1, 1);251 main_grid.attach (power_combobox, 1, 4, 1, 1);
255 main_grid.attach (power_combobox.label, 0, 5, 1, 1);
256 main_grid.attach (power_combobox, 1, 5, 1, 1);
257252
258 return main_grid;253 return main_grid;
259 }254 }
@@ -307,20 +302,15 @@
307302
308 settings.bind ("idle-dim", dim_switch, "active", SettingsBindFlags.DEFAULT);303 settings.bind ("idle-dim", dim_switch, "active", SettingsBindFlags.DEFAULT);
309304
310 var critical_box = new ActionComboBox (_("When power is critically low:"), "critical-battery-action");
311 label_size.add_widget (critical_box.label);
312
313 lid_closed_box.sensitive = false;305 lid_closed_box.sensitive = false;
314 lid_closed_box.label.sensitive = false;306 lid_closed_box.label.sensitive = false;
315 label_size.add_widget (lid_closed_box.label);307 label_size.add_widget (lid_closed_box.label);
316308
317 grid.attach (dim_label, 0, 0, 1, 1);309 grid.attach (dim_label, 0, 0, 1, 1);
318 grid.attach (dim_switch, 1, 0, 1, 1);310 grid.attach (dim_switch, 1, 0, 1, 1);
319 grid.attach (critical_box.label, 0, 2, 1, 1);311 grid.attach (lid_closed_box.label, 0, 2, 1, 1);
320 grid.attach (critical_box, 1, 2, 1, 1);312 grid.attach (lid_closed_box, 1, 2, 1, 1);
321 grid.attach (lid_closed_box.label, 0, 3, 1, 1);313 grid.attach (lock_image2, 2, 2, 1, 1);
322 grid.attach (lid_closed_box, 1, 3, 1, 1);
323 grid.attach (lock_image2, 2, 3, 1, 1);
324314
325 } else if (battery.laptop) {315 } else if (battery.laptop) {
326 lid_dock_box.sensitive = false;316 lid_dock_box.sensitive = false;

Subscribers

People subscribed via source and target branches

to all changes: