Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MainView: subclass SettingsPage #247

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions src/MainView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Boston, MA 02110-1301, USA.
*/

public class Power.MainView : Gtk.Box {
public class Power.MainView : Switchboard.SettingsPage {
public Battery battery { get; private set; }
public Gtk.Stack stack { get; private set; }

Expand Down Expand Up @@ -47,6 +47,13 @@ public class Power.MainView : Gtk.Box {

private static Polkit.Permission? permission = null;

public MainView () {
Object (
title: _("Power"),
icon: new ThemedIcon ("preferences-system-power")
);
}

construct {
var touchpad_settings = new GLib.Settings ("org.gnome.desktop.peripherals.touchpad");
touchpad_settings.bind ("natural-scroll", this, "natural-scroll-touchpad", SettingsBindFlags.GET);
Expand All @@ -69,10 +76,6 @@ public class Power.MainView : Gtk.Box {

var main_grid = new Gtk.Grid () {
column_spacing = 12,
margin_start = 24,
margin_end = 24,
margin_top = 24,
margin_bottom = 24,
row_spacing = 12
};

Expand Down Expand Up @@ -284,6 +287,7 @@ public class Power.MainView : Gtk.Box {
revealed = false
};
infobar.add_child (infobar_label);
infobar.add_css_class (Granite.STYLE_CLASS_FRAME);

var helper = LogindHelper.get_logind_helper ();
if (helper != null) {
Expand All @@ -304,10 +308,11 @@ public class Power.MainView : Gtk.Box {
main_grid.attach (power_mode_button, 1, 10);
}

orientation = VERTICAL;
margin_bottom = 12;
append (infobar);
append (main_grid);
var box = new Gtk.Box (VERTICAL, 12);
box.append (infobar);
box.append (main_grid);

child = box;

label_size.add_widget (sleep_timeout_label);
label_size.add_widget (screen_timeout_label);
Expand Down
Loading