Skip to content
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
109 changes: 46 additions & 63 deletions src/Views/Appearance.vala
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
*/

public class PantheonShell.Appearance : Switchboard.SettingsPage {
private const string INTERFACE_SCHEMA = "org.gnome.desktop.interface";
private const string STYLESHEET_KEY = "gtk-theme";
private const string STYLESHEET_PREFIX = "io.elementary.stylesheet.";

private enum AccentColor {
NO_PREFERENCE,
RED,
Expand Down Expand Up @@ -58,9 +54,9 @@ public class PantheonShell.Appearance : Switchboard.SettingsPage {
return "cocoa";
case GRAY:
return "slate";
default:
return "auto";
}

return "auto";
}
}

Expand Down Expand Up @@ -220,68 +216,61 @@ public class PantheonShell.Appearance : Switchboard.SettingsPage {

schedule_manual_radio.bind_property ("active", schedule_manual_box, "sensitive", BindingFlags.SYNC_CREATE);

var interface_settings = new GLib.Settings (INTERFACE_SCHEMA);
var current_stylesheet = interface_settings.get_string (STYLESHEET_KEY);

debug ("Current stylesheet: %s", current_stylesheet);
var blueberry_button = new PrefersAccentColorButton (AccentColor.BLUE);
blueberry_button.tooltip_text = _("Blueberry");

if (current_stylesheet.has_prefix (STYLESHEET_PREFIX)) {
var blueberry_button = new PrefersAccentColorButton (AccentColor.BLUE);
blueberry_button.tooltip_text = _("Blueberry");
var mint_button = new PrefersAccentColorButton (AccentColor.MINT, blueberry_button);
mint_button.tooltip_text = _("Mint");

var mint_button = new PrefersAccentColorButton (AccentColor.MINT, blueberry_button);
mint_button.tooltip_text = _("Mint");
var lime_button = new PrefersAccentColorButton (AccentColor.GREEN, blueberry_button);
lime_button.tooltip_text = _("Lime");

var lime_button = new PrefersAccentColorButton (AccentColor.GREEN, blueberry_button);
lime_button.tooltip_text = _("Lime");
var banana_button = new PrefersAccentColorButton (AccentColor.YELLOW, blueberry_button);
banana_button.tooltip_text = _("Banana");

var banana_button = new PrefersAccentColorButton (AccentColor.YELLOW, blueberry_button);
banana_button.tooltip_text = _("Banana");
var orange_button = new PrefersAccentColorButton (AccentColor.ORANGE, blueberry_button);
orange_button.tooltip_text = _("Orange");

var orange_button = new PrefersAccentColorButton (AccentColor.ORANGE, blueberry_button);
orange_button.tooltip_text = _("Orange");
var strawberry_button = new PrefersAccentColorButton (AccentColor.RED, blueberry_button);
strawberry_button.tooltip_text = _("Strawberry");

var strawberry_button = new PrefersAccentColorButton (AccentColor.RED, blueberry_button);
strawberry_button.tooltip_text = _("Strawberry");
var bubblegum_button = new PrefersAccentColorButton (AccentColor.PINK, blueberry_button);
bubblegum_button.tooltip_text = _("Bubblegum");

var bubblegum_button = new PrefersAccentColorButton (AccentColor.PINK, blueberry_button);
bubblegum_button.tooltip_text = _("Bubblegum");
var grape_button = new PrefersAccentColorButton (AccentColor.PURPLE, blueberry_button);
grape_button.tooltip_text = _("Grape");

var grape_button = new PrefersAccentColorButton (AccentColor.PURPLE, blueberry_button);
grape_button.tooltip_text = _("Grape");
var cocoa_button = new PrefersAccentColorButton (AccentColor.BROWN, blueberry_button);
cocoa_button.tooltip_text = _("Cocoa");

var cocoa_button = new PrefersAccentColorButton (AccentColor.BROWN, blueberry_button);
cocoa_button.tooltip_text = _("Cocoa");
var slate_button = new PrefersAccentColorButton (AccentColor.GRAY, blueberry_button);
slate_button.tooltip_text = _("Slate");

var slate_button = new PrefersAccentColorButton (AccentColor.GRAY, blueberry_button);
slate_button.tooltip_text = _("Slate");
var auto_button = new PrefersAccentColorButton (AccentColor.NO_PREFERENCE, blueberry_button);
auto_button.tooltip_text = _("Automatic based on wallpaper");

var auto_button = new PrefersAccentColorButton (AccentColor.NO_PREFERENCE, blueberry_button);
auto_button.tooltip_text = _("Automatic based on wallpaper");

var accent_box = new Gtk.Box (HORIZONTAL, 6) {
accessible_role = Gtk.AccessibleRole.LIST
};
accent_box.append (blueberry_button);
accent_box.append (mint_button);
accent_box.append (lime_button);
accent_box.append (banana_button);
accent_box.append (orange_button);
accent_box.append (strawberry_button);
accent_box.append (bubblegum_button);
accent_box.append (grape_button);
accent_box.append (cocoa_button);
accent_box.append (slate_button);
accent_box.append (auto_button);

var accent_label = new Granite.HeaderLabel (_("Accent Color")) {
margin_top = 18,
mnemonic_widget = accent_box
};
var accent_box = new Gtk.Box (HORIZONTAL, 6) {
accessible_role = Gtk.AccessibleRole.LIST
};
accent_box.append (blueberry_button);
accent_box.append (mint_button);
accent_box.append (lime_button);
accent_box.append (banana_button);
accent_box.append (orange_button);
accent_box.append (strawberry_button);
accent_box.append (bubblegum_button);
accent_box.append (grape_button);
accent_box.append (cocoa_button);
accent_box.append (slate_button);
accent_box.append (auto_button);

var accent_label = new Granite.HeaderLabel (_("Accent Color")) {
margin_top = 18,
mnemonic_widget = accent_box
};

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

var animations_switch = new Gtk.Switch () {
halign = Gtk.Align.END,
Expand Down Expand Up @@ -328,6 +317,7 @@ public class PantheonShell.Appearance : Switchboard.SettingsPage {
animations_settings.set_boolean ("enable-animations", !animations_switch.active);
});

var interface_settings = new GLib.Settings ("org.gnome.desktop.interface");
interface_settings.bind ("overlay-scrolling", scrollbar_switch, "active", INVERT_BOOLEAN);
interface_settings.bind ("enable-animations", animations_switch, "active", INVERT_BOOLEAN);

Expand Down Expand Up @@ -360,13 +350,6 @@ public class PantheonShell.Appearance : Switchboard.SettingsPage {
if (!accent_color_action.get_state ().equal (value)) {
accent_color_action.set_state (value);
pantheon_act.prefers_accent_color = value.get_int32 ();

if (value != AccentColor.NO_PREFERENCE) {
interface_settings.set_string (
STYLESHEET_KEY,
STYLESHEET_PREFIX + ((AccentColor) value).to_string ()
);
}
}
});
}
Expand Down