Skip to content

Commit

Permalink
GuestSettingsView: use Switchboard.SettingsPage (#219)
Browse files Browse the repository at this point in the history
Co-authored-by: Jeremy Wootten <jeremywootten@gmail.com>
  • Loading branch information
danirabbit and jeremypw authored Mar 7, 2024
1 parent 57fb07a commit 61b941d
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/Views/GuestSettingsView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
*/

public class SwitchboardPlugUserAccounts.Widgets.GuestSettingsView : Granite.SimpleSettingsPage {
public class SwitchboardPlugUserAccounts.Widgets.GuestSettingsView : Switchboard.SettingsPage {
public signal void guest_switch_changed ();

public GuestSettingsView () {
Expand All @@ -13,7 +13,7 @@ public class SwitchboardPlugUserAccounts.Widgets.GuestSettingsView : Granite.Sim
description: "%s %s".printf (
_("The Guest Session allows someone to use a temporary default account without a password."),
_("Once they log out, all of their settings and data will be deleted.")),
icon_name: "avatar-default",
icon: new ThemedIcon ("avatar-default"),
title: _("Guest Session")
);
}
Expand All @@ -25,8 +25,9 @@ public class SwitchboardPlugUserAccounts.Widgets.GuestSettingsView : Granite.Sim

var guest_autologin_label = new Gtk.Label (_("Log In automatically:"));

content_area.attach (guest_autologin_label, 0, 0);
content_area.attach (guest_autologin_switch, 1, 0);
var autologin_box = new Gtk.Box (HORIZONTAL, 12);
autologin_box.append (guest_autologin_label);
autologin_box.append (guest_autologin_switch);

var infobar_reboot = new Gtk.InfoBar () {
message_type = WARNING,
Expand All @@ -35,13 +36,17 @@ public class SwitchboardPlugUserAccounts.Widgets.GuestSettingsView : Granite.Sim
infobar_reboot.add_child (new Gtk.Label (_("Guest session changes will not take effect until you restart your system")));
infobar_reboot.add_css_class (Granite.STYLE_CLASS_FRAME);

action_area.append (infobar_reboot);
var box = new Gtk.Box (VERTICAL, 24);
box.append (autologin_box);
box.append (infobar_reboot);

child = box;

status_switch.active = get_guest_session_state ("show");

guest_autologin_switch.active = get_guest_session_state ("show-autologin");

status_switch.bind_property ("active", content_area, "sensitive", BindingFlags.DEFAULT);
status_switch.bind_property ("active", autologin_box, "sensitive", BindingFlags.DEFAULT);

status_switch.notify["active"].connect (() => {
if (get_guest_session_state ("show") != status_switch.active) {
Expand Down

0 comments on commit 61b941d

Please sign in to comment.