|
19 | 19 | */ |
20 | 20 |
|
21 | 21 | public class PantheonShell.Appearance : Switchboard.SettingsPage { |
22 | | - private const string INTERFACE_SCHEMA = "org.gnome.desktop.interface"; |
23 | | - private const string STYLESHEET_KEY = "gtk-theme"; |
24 | | - private const string STYLESHEET_PREFIX = "io.elementary.stylesheet."; |
25 | | - |
26 | 22 | private enum AccentColor { |
27 | 23 | NO_PREFERENCE, |
28 | 24 | RED, |
@@ -58,9 +54,9 @@ public class PantheonShell.Appearance : Switchboard.SettingsPage { |
58 | 54 | return "cocoa"; |
59 | 55 | case GRAY: |
60 | 56 | return "slate"; |
| 57 | + default: |
| 58 | + return "auto"; |
61 | 59 | } |
62 | | - |
63 | | - return "auto"; |
64 | 60 | } |
65 | 61 | } |
66 | 62 |
|
@@ -220,68 +216,61 @@ public class PantheonShell.Appearance : Switchboard.SettingsPage { |
220 | 216 |
|
221 | 217 | schedule_manual_radio.bind_property ("active", schedule_manual_box, "sensitive", BindingFlags.SYNC_CREATE); |
222 | 218 |
|
223 | | - var interface_settings = new GLib.Settings (INTERFACE_SCHEMA); |
224 | | - var current_stylesheet = interface_settings.get_string (STYLESHEET_KEY); |
225 | | - |
226 | | - debug ("Current stylesheet: %s", current_stylesheet); |
| 219 | + var blueberry_button = new PrefersAccentColorButton (AccentColor.BLUE); |
| 220 | + blueberry_button.tooltip_text = _("Blueberry"); |
227 | 221 |
|
228 | | - if (current_stylesheet.has_prefix (STYLESHEET_PREFIX)) { |
229 | | - var blueberry_button = new PrefersAccentColorButton (AccentColor.BLUE); |
230 | | - blueberry_button.tooltip_text = _("Blueberry"); |
| 222 | + var mint_button = new PrefersAccentColorButton (AccentColor.MINT, blueberry_button); |
| 223 | + mint_button.tooltip_text = _("Mint"); |
231 | 224 |
|
232 | | - var mint_button = new PrefersAccentColorButton (AccentColor.MINT, blueberry_button); |
233 | | - mint_button.tooltip_text = _("Mint"); |
| 225 | + var lime_button = new PrefersAccentColorButton (AccentColor.GREEN, blueberry_button); |
| 226 | + lime_button.tooltip_text = _("Lime"); |
234 | 227 |
|
235 | | - var lime_button = new PrefersAccentColorButton (AccentColor.GREEN, blueberry_button); |
236 | | - lime_button.tooltip_text = _("Lime"); |
| 228 | + var banana_button = new PrefersAccentColorButton (AccentColor.YELLOW, blueberry_button); |
| 229 | + banana_button.tooltip_text = _("Banana"); |
237 | 230 |
|
238 | | - var banana_button = new PrefersAccentColorButton (AccentColor.YELLOW, blueberry_button); |
239 | | - banana_button.tooltip_text = _("Banana"); |
| 231 | + var orange_button = new PrefersAccentColorButton (AccentColor.ORANGE, blueberry_button); |
| 232 | + orange_button.tooltip_text = _("Orange"); |
240 | 233 |
|
241 | | - var orange_button = new PrefersAccentColorButton (AccentColor.ORANGE, blueberry_button); |
242 | | - orange_button.tooltip_text = _("Orange"); |
| 234 | + var strawberry_button = new PrefersAccentColorButton (AccentColor.RED, blueberry_button); |
| 235 | + strawberry_button.tooltip_text = _("Strawberry"); |
243 | 236 |
|
244 | | - var strawberry_button = new PrefersAccentColorButton (AccentColor.RED, blueberry_button); |
245 | | - strawberry_button.tooltip_text = _("Strawberry"); |
| 237 | + var bubblegum_button = new PrefersAccentColorButton (AccentColor.PINK, blueberry_button); |
| 238 | + bubblegum_button.tooltip_text = _("Bubblegum"); |
246 | 239 |
|
247 | | - var bubblegum_button = new PrefersAccentColorButton (AccentColor.PINK, blueberry_button); |
248 | | - bubblegum_button.tooltip_text = _("Bubblegum"); |
| 240 | + var grape_button = new PrefersAccentColorButton (AccentColor.PURPLE, blueberry_button); |
| 241 | + grape_button.tooltip_text = _("Grape"); |
249 | 242 |
|
250 | | - var grape_button = new PrefersAccentColorButton (AccentColor.PURPLE, blueberry_button); |
251 | | - grape_button.tooltip_text = _("Grape"); |
| 243 | + var cocoa_button = new PrefersAccentColorButton (AccentColor.BROWN, blueberry_button); |
| 244 | + cocoa_button.tooltip_text = _("Cocoa"); |
252 | 245 |
|
253 | | - var cocoa_button = new PrefersAccentColorButton (AccentColor.BROWN, blueberry_button); |
254 | | - cocoa_button.tooltip_text = _("Cocoa"); |
| 246 | + var slate_button = new PrefersAccentColorButton (AccentColor.GRAY, blueberry_button); |
| 247 | + slate_button.tooltip_text = _("Slate"); |
255 | 248 |
|
256 | | - var slate_button = new PrefersAccentColorButton (AccentColor.GRAY, blueberry_button); |
257 | | - slate_button.tooltip_text = _("Slate"); |
| 249 | + var auto_button = new PrefersAccentColorButton (AccentColor.NO_PREFERENCE, blueberry_button); |
| 250 | + auto_button.tooltip_text = _("Automatic based on wallpaper"); |
258 | 251 |
|
259 | | - var auto_button = new PrefersAccentColorButton (AccentColor.NO_PREFERENCE, blueberry_button); |
260 | | - auto_button.tooltip_text = _("Automatic based on wallpaper"); |
261 | | - |
262 | | - var accent_box = new Gtk.Box (HORIZONTAL, 6) { |
263 | | - accessible_role = Gtk.AccessibleRole.LIST |
264 | | - }; |
265 | | - accent_box.append (blueberry_button); |
266 | | - accent_box.append (mint_button); |
267 | | - accent_box.append (lime_button); |
268 | | - accent_box.append (banana_button); |
269 | | - accent_box.append (orange_button); |
270 | | - accent_box.append (strawberry_button); |
271 | | - accent_box.append (bubblegum_button); |
272 | | - accent_box.append (grape_button); |
273 | | - accent_box.append (cocoa_button); |
274 | | - accent_box.append (slate_button); |
275 | | - accent_box.append (auto_button); |
276 | | - |
277 | | - var accent_label = new Granite.HeaderLabel (_("Accent Color")) { |
278 | | - margin_top = 18, |
279 | | - mnemonic_widget = accent_box |
280 | | - }; |
| 252 | + var accent_box = new Gtk.Box (HORIZONTAL, 6) { |
| 253 | + accessible_role = Gtk.AccessibleRole.LIST |
| 254 | + }; |
| 255 | + accent_box.append (blueberry_button); |
| 256 | + accent_box.append (mint_button); |
| 257 | + accent_box.append (lime_button); |
| 258 | + accent_box.append (banana_button); |
| 259 | + accent_box.append (orange_button); |
| 260 | + accent_box.append (strawberry_button); |
| 261 | + accent_box.append (bubblegum_button); |
| 262 | + accent_box.append (grape_button); |
| 263 | + accent_box.append (cocoa_button); |
| 264 | + accent_box.append (slate_button); |
| 265 | + accent_box.append (auto_button); |
| 266 | + |
| 267 | + var accent_label = new Granite.HeaderLabel (_("Accent Color")) { |
| 268 | + margin_top = 18, |
| 269 | + mnemonic_widget = accent_box |
| 270 | + }; |
281 | 271 |
|
282 | | - grid.attach (accent_label, 0, 8, 2); |
283 | | - grid.attach (accent_box, 0, 9, 2); |
284 | | - } |
| 272 | + grid.attach (accent_label, 0, 8, 2); |
| 273 | + grid.attach (accent_box, 0, 9, 2); |
285 | 274 |
|
286 | 275 | var animations_switch = new Gtk.Switch () { |
287 | 276 | halign = Gtk.Align.END, |
@@ -328,6 +317,7 @@ public class PantheonShell.Appearance : Switchboard.SettingsPage { |
328 | 317 | animations_settings.set_boolean ("enable-animations", !animations_switch.active); |
329 | 318 | }); |
330 | 319 |
|
| 320 | + var interface_settings = new GLib.Settings ("org.gnome.desktop.interface"); |
331 | 321 | interface_settings.bind ("overlay-scrolling", scrollbar_switch, "active", INVERT_BOOLEAN); |
332 | 322 | interface_settings.bind ("enable-animations", animations_switch, "active", INVERT_BOOLEAN); |
333 | 323 |
|
@@ -360,13 +350,6 @@ public class PantheonShell.Appearance : Switchboard.SettingsPage { |
360 | 350 | if (!accent_color_action.get_state ().equal (value)) { |
361 | 351 | accent_color_action.set_state (value); |
362 | 352 | pantheon_act.prefers_accent_color = value.get_int32 (); |
363 | | - |
364 | | - if (value != AccentColor.NO_PREFERENCE) { |
365 | | - interface_settings.set_string ( |
366 | | - STYLESHEET_KEY, |
367 | | - STYLESHEET_PREFIX + ((AccentColor) value).to_string () |
368 | | - ); |
369 | | - } |
370 | 353 | } |
371 | 354 | }); |
372 | 355 | } |
|
0 commit comments