diff --git a/src/MainView.vala b/src/MainView.vala index 877a03b1..cbd3205c 100644 --- a/src/MainView.vala +++ b/src/MainView.vala @@ -192,6 +192,17 @@ public class Power.MainView : Switchboard.SettingsPage { } } + var idle_dim_switch = new Gtk.Switch () { + halign = END + }; + + var idle_dim_label = new Gtk.Label (_("Automatically Dim Display")) { + mnemonic_widget = idle_dim_switch, + xalign = 0 + }; + + label_size.add_widget (idle_dim_label); + var screen_timeout_label = new Gtk.Label (_("Automatic Display Off")) { xalign = 0 }; @@ -218,6 +229,8 @@ public class Power.MainView : Switchboard.SettingsPage { column_spacing = 12, row_spacing = 12 }; + main_grid.attach (idle_dim_label, 0, 3); + main_grid.attach (idle_dim_switch, 1, 3); main_grid.attach (screen_timeout_label, 0, 4); main_grid.attach (screen_timeout, 1, 4); main_grid.attach (powerbutton_label, 0, 5); @@ -345,6 +358,8 @@ public class Power.MainView : Switchboard.SettingsPage { update_powerbutton_dropdown (); settings.changed["power-button-action"].connect (update_powerbutton_dropdown); + settings.bind ("idle-dim", idle_dim_switch, "active", DEFAULT); + powerbutton_dropdown.notify["selected"].connect (() => { int[] map = {0, 1, 3}; settings.set_enum ( diff --git a/src/Plug.vala b/src/Plug.vala index c65ef2b2..71d54b65 100644 --- a/src/Plug.vala +++ b/src/Plug.vala @@ -84,6 +84,7 @@ namespace Power { public override async Gee.TreeMap search (string search) { var search_results = new Gee.TreeMap ((GLib.CompareDataFunc)strcmp, (Gee.EqualDataFunc)str_equal); search_results.set ("%s → %s".printf (display_name, _("Automatically Adjust Brightness")), ""); + search_results.set ("%s → %s".printf (display_name, _("Automatically Dim Display")), ""); search_results.set ("%s → %s".printf (display_name, _("Automatically Save Power")), ""); search_results.set ("%s → %s".printf (display_name, _("Automatic Display Off")), ""); search_results.set ("%s → %s".printf (display_name, _("Battery Level")), "");