Skip to content

Commit

Permalink
Merge pull request #60 from camellan/master
Browse files Browse the repository at this point in the history
Save theme setting
  • Loading branch information
Grabli66 authored Mar 31, 2019
2 parents 0671d48 + 1d3f4d6 commit d08979e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion data/com.github.rapidfingers.translator.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
Destination language
</description>
</key>

<key name="use-dark-theme" type="b">
<default>false</default>
<summary>Dark Theme</summary>
<description>Prefer Dark Theme</description>
</key>
</schema>
</schemalist>
2 changes: 2 additions & 0 deletions src/TranslatorWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,14 @@ public class TranslateWindow : Gtk.ApplicationWindow {
//settingsButton.set_tooltip_text(_("Settings"));

var gtk_settings = Gtk.Settings.get_default ();
GLib.Settings settings = new GLib.Settings (GlobalSettings.SCHEMA_NAME);

mode_switch = new Granite.ModeSwitch.from_icon_name ("display-brightness-symbolic", "weather-clear-night-symbolic");
mode_switch.primary_icon_tooltip_text = (_("Light background"));
mode_switch.secondary_icon_tooltip_text = (_("Dark background"));
mode_switch.valign = Gtk.Align.CENTER;
mode_switch.bind_property ("active", gtk_settings, "gtk_application_prefer_dark_theme");
settings.bind ("use-dark-theme", mode_switch, "active", GLib.SettingsBindFlags.DEFAULT);

_leftHeader.pack_start(leftLangCombo);
_leftHeader.pack_start(changeButton);
Expand Down

0 comments on commit d08979e

Please sign in to comment.