Skip to content

Commit

Permalink
Move dim wallpaper setting to appearance
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit committed May 18, 2024
1 parent 65cdd5c commit 9b16781
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 21 deletions.
1 change: 1 addition & 0 deletions src/Plug.vala
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public class PantheonShell.Plug : Switchboard.Plug {
search_results.set ("%s%s%s".printf (display_name, _("Dock & Panel"), _("Panel translucency")), "dock");
search_results.set ("%s%s".printf (display_name, _("Appearance")), "appearance");
search_results.set ("%s%s%s".printf (display_name, _("Appearance"), _("Dark style")), "appearance");
search_results.set ("%s%s%s".printf (display_name, _("Appearance"), _("Dim Wallpaper With Dark Style")), "appearance");
search_results.set ("%s%s%s".printf (display_name, _("Appearance"), _("Accent Color")), "appearance");
search_results.set ("%s%s%s".printf (display_name, _("Appearance"), _("Always Show Scrollbars")), "appearance");
search_results.set ("%s%s%s".printf (display_name, _("Appearance"), _("Reduce Motion")), "appearance");
Expand Down
33 changes: 26 additions & 7 deletions src/Views/Appearance.vala
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,21 @@ public class PantheonShell.Appearance : Gtk.Box {
prefer_style_box.append (prefer_default_radio);
prefer_style_box.append (prefer_dark_radio);

var dim_switch = new Gtk.Switch () {
valign = CENTER
};

var dim_label = new Granite.HeaderLabel (_("Dim Wallpaper With Dark Style")) {
hexpand = true,
mnemonic_widget = dim_switch
};

var dim_box = new Gtk.Box (HORIZONTAL, 12) {
margin_top = 18
};
dim_box.append (dim_label);
dim_box.append (dim_switch);

var schedule_label = new Granite.HeaderLabel (_("Schedule"));

var schedule_disabled_radio = new Gtk.CheckButton.with_label (_("Disabled")) {
Expand Down Expand Up @@ -178,11 +193,12 @@ public class PantheonShell.Appearance : Gtk.Box {
if (((GLib.DBusProxy) pantheon_act).get_cached_property ("PrefersColorScheme") != null) {
grid.attach (dark_label, 0, 0, 2);
grid.attach (prefer_style_box, 0, 2, 2);
grid.attach (schedule_label, 0, 3, 2);
grid.attach (schedule_disabled_radio, 0, 4, 2);
grid.attach (schedule_sunset_radio, 0, 5, 2);
grid.attach (schedule_manual_radio, 0, 6);
grid.attach (schedule_manual_box, 1, 6);
grid.attach (dim_box, 0, 3, 2);
grid.attach (schedule_label, 0, 4, 2);
grid.attach (schedule_disabled_radio, 0, 5, 2);
grid.attach (schedule_sunset_radio, 0, 6, 2);
grid.attach (schedule_manual_radio, 0, 7);
grid.attach (schedule_manual_box, 1, 7);

switch (pantheon_act.prefers_color_scheme) {
case Granite.Settings.ColorScheme.DARK:
Expand Down Expand Up @@ -355,8 +371,8 @@ public class PantheonShell.Appearance : Gtk.Box {
accent_box.append (slate_button);
accent_box.append (auto_button);

grid.attach (accent_label, 0, 7, 2);
grid.attach (accent_box, 0, 8, 2);
grid.attach (accent_label, 0, 8, 2);
grid.attach (accent_box, 0, 9, 2);
}

var animations_switch = new Gtk.Switch () {
Expand Down Expand Up @@ -405,6 +421,9 @@ public class PantheonShell.Appearance : Gtk.Box {
animations_settings.bind ("enable-animations", animations_switch, "active", SettingsBindFlags.INVERT_BOOLEAN);

interface_settings.bind ("overlay-scrolling", scrollbar_switch, "active", INVERT_BOOLEAN);

var background_settings = new GLib.Settings ("io.elementary.desktop.background");
background_settings.bind ("dim-wallpaper-in-dark-style", dim_switch, "active", DEFAULT);
}

private class PrefersAccentColorButton : Gtk.CheckButton {
Expand Down
14 changes: 0 additions & 14 deletions src/Views/Wallpaper.vala
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ public class PantheonShell.Wallpaper : Gtk.Box {
public Switchboard.Plug plug { get; construct set; }

private static GLib.Settings gnome_background_settings;
private static GLib.Settings gala_background_settings;

private Gtk.ScrolledWindow wallpaper_scrolled_window;
private Gtk.FlowBox wallpaper_view;
private Gtk.Overlay view_overlay;
private Gtk.Switch dim_switch;
private Gtk.ComboBoxText combo;
private Gtk.ColorButton color_button;

Expand All @@ -48,7 +46,6 @@ public class PantheonShell.Wallpaper : Gtk.Box {

static construct {
gnome_background_settings = new GLib.Settings ("org.gnome.desktop.background");
gala_background_settings = new GLib.Settings ("io.elementary.desktop.background");
}

construct {
Expand Down Expand Up @@ -89,13 +86,6 @@ public class PantheonShell.Wallpaper : Gtk.Box {
margin_start = 12
};

var dim_label = new Gtk.Label (_("Dim with dark style:"));

dim_switch = new Gtk.Switch () {
margin_end = 6,
valign = CENTER
};

combo = new Gtk.ComboBoxText () {
margin_end = 6,
valign = CENTER
Expand Down Expand Up @@ -131,8 +121,6 @@ public class PantheonShell.Wallpaper : Gtk.Box {
actionbar.pack_start (add_wallpaper_button);
actionbar.pack_end (color_button);
actionbar.pack_end (combo);
actionbar.pack_end (dim_switch);
actionbar.pack_end (dim_label);

orientation = VERTICAL;
append (separator);
Expand Down Expand Up @@ -178,8 +166,6 @@ public class PantheonShell.Wallpaper : Gtk.Box {
}

private void load_settings () {
gala_background_settings.bind ("dim-wallpaper-in-dark-style", dim_switch, "active", SettingsBindFlags.DEFAULT);

// TODO: need to store the previous state, before changing to none
// when a solid color is selected, because the combobox doesn't know
// about it anymore. The previous state should be loaded instead here.
Expand Down

0 comments on commit 9b16781

Please sign in to comment.