-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6f3bcb
commit ec80037
Showing
3 changed files
with
54 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright 2024 elementary, Inc. (https://elementary.io) | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
|
||
public class StyleManagerView : Gtk.Box { | ||
construct { | ||
var label = new Gtk.Label (_("Override the application theme:")); | ||
|
||
var dont_button = new Gtk.CheckButton.with_label (_("Use system theme")) { | ||
active = true | ||
}; | ||
|
||
var force_light = new Gtk.CheckButton.with_label (_("Force light theme")) { | ||
group = dont_button | ||
}; | ||
|
||
var force_dark = new Gtk.CheckButton.with_label (_("Force dark theme")) { | ||
group = force_light | ||
}; | ||
|
||
halign = CENTER; | ||
valign = CENTER; | ||
orientation = VERTICAL; | ||
spacing = 6; | ||
append (label); | ||
append (dont_button); | ||
append (force_light); | ||
append (force_dark); | ||
|
||
var style_manager = Granite.StyleManager.get_instance (); | ||
|
||
dont_button.toggled.connect (() => { | ||
if (dont_button.active) { | ||
style_manager.color_scheme_override = NO_PREFERENCE; | ||
} | ||
}); | ||
|
||
force_light.toggled.connect (() => { | ||
if (force_light.active) { | ||
style_manager.color_scheme_override = LIGHT; | ||
} | ||
}); | ||
|
||
force_dark.toggled.connect (() => { | ||
if (force_dark.active) { | ||
style_manager.color_scheme_override = DARK; | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters