summaryrefslogtreecommitdiff
path: root/src/dialogs/Preferences.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2018-09-30 14:09:32 +0200
committerJörg Frings-Fürst <debian@jff.email>2018-09-30 14:09:32 +0200
commit0537caaf4af94a9ead8b292679f6b34c90b55e06 (patch)
tree6761cfdf959926be7af3147cf770e7f253390fe8 /src/dialogs/Preferences.vala
parenteca5837e235a356c8db9416bbbc13577db3e6f76 (diff)
parent5e9f4eea451a77ba3b93db3747841ed2bd969e9f (diff)
Update upstream source from tag 'upstream/0.30.1'
Update to upstream version '0.30.1' with Debian dir dc242531effff8d9c6fab093414edee28b403c6a
Diffstat (limited to 'src/dialogs/Preferences.vala')
-rw-r--r--src/dialogs/Preferences.vala57
1 files changed, 12 insertions, 45 deletions
diff --git a/src/dialogs/Preferences.vala b/src/dialogs/Preferences.vala
index 0a18547..17b16cf 100644
--- a/src/dialogs/Preferences.vala
+++ b/src/dialogs/Preferences.vala
@@ -19,9 +19,8 @@ public class PreferencesDialog : Gtk.Dialog {
private static PreferencesDialog preferences_dialog;
[GtkChild]
- private Gtk.Adjustment bg_color_adjustment;
- [GtkChild]
- private Gtk.Scale bg_color_slider;
+ private Gtk.Switch switch_dark;
+
[GtkChild]
private Gtk.ComboBox photo_editor_combo;
[GtkChild]
@@ -72,12 +71,6 @@ public class PreferencesDialog : Gtk.Dialog {
delete_event.connect(on_delete);
response.connect(on_close);
- bg_color_adjustment.set_value(bg_color_adjustment.get_upper() -
- (Config.Facade.get_instance().get_bg_color().red * 65535.0));
- bg_color_adjustment.value_changed.connect(on_value_changed);
-
- bg_color_slider.button_press_event.connect(on_bg_color_reset);
-
transparent_checker_radio.toggled.connect(on_radio_changed);
transparent_solid_radio.toggled.connect(on_radio_changed);
transparent_none_radio.toggled.connect(on_radio_changed);
@@ -148,6 +141,8 @@ public class PreferencesDialog : Gtk.Dialog {
default_raw_developer_combo.append_text(RawDeveloper.SHOTWELL.get_label());
set_raw_developer_combo(Config.Facade.get_instance().get_default_raw_developer());
default_raw_developer_combo.changed.connect(on_default_raw_developer_changed);
+ switch_dark.active = Gtk.Settings.get_default().gtk_application_prefer_dark_theme;
+ switch_dark.notify["active"].connect(on_theme_variant_changed);
}
public void populate_preference_options() {
@@ -162,6 +157,13 @@ public class PreferencesDialog : Gtk.Dialog {
lowercase.set_active(Config.Facade.get_instance().get_use_lowercase_filenames());
}
+ private void on_theme_variant_changed(GLib.Object o, GLib.ParamSpec ps) {
+ var config = Config.Facade.get_instance();
+ config.set_gtk_theme_variant(switch_dark.active);
+
+ Gtk.Settings.get_default().gtk_application_prefer_dark_theme = switch_dark.active;
+ }
+
private void on_radio_changed() {
var config = Config.Facade.get_instance();
@@ -183,7 +185,7 @@ public class PreferencesDialog : Gtk.Dialog {
// the help viewer and specify the full path to the subsection we want...
private bool on_local_pattern_help(string ignore) {
try {
- Resources.launch_help(AppWindow.get_instance().get_screen(), "other-files.page");
+ Resources.launch_help(AppWindow.get_instance(), "other-files.page");
} catch (Error e) {
message("Unable to launch help: %s", e.message);
}
@@ -294,7 +296,6 @@ public class PreferencesDialog : Gtk.Dialog {
// For items that should only be committed when the dialog is closed, not as soon as the change
// is made.
private void commit_on_close() {
- Config.Facade.get_instance().commit_bg_color();
Config.Facade.get_instance().set_auto_import_from_library(autoimport.active);
Config.Facade.get_instance().set_commit_metadata_to_masters(write_metadata.active);
@@ -326,25 +327,6 @@ public class PreferencesDialog : Gtk.Dialog {
commit_on_close();
}
- private void on_value_changed() {
- set_background_color((double)(bg_color_adjustment.get_upper() -
- bg_color_adjustment.get_value()) / 65535.0);
- }
-
- private bool on_bg_color_reset(Gdk.EventButton event) {
- if (event.button == 1 && event.type == Gdk.EventType.BUTTON_PRESS
- && has_only_key_modifier(event.state, Gdk.ModifierType.CONTROL_MASK)) {
- // Left Mouse Button and CTRL pressed
- bg_color_slider.set_value(bg_color_adjustment.get_upper() -
- (parse_color(Config.Facade.DEFAULT_BG_COLOR).red * 65536.0f));
- on_value_changed();
-
- return true;
- }
-
- return false;
- }
-
private void on_dir_pattern_combo_changed() {
PathFormat pf = path_formats.get(dir_pattern_combo.get_active());
if (null == pf.pattern) {
@@ -387,21 +369,6 @@ public class PreferencesDialog : Gtk.Dialog {
return allow_closing;
}
- private void set_background_color(double bg_color_value) {
- Config.Facade.get_instance().set_bg_color(to_grayscale(bg_color_value));
- }
-
- private Gdk.RGBA to_grayscale(double color_value) {
- Gdk.RGBA color = Gdk.RGBA();
-
- color.red = color_value;
- color.green = color_value;
- color.blue = color_value;
- color.alpha = 1.0;
-
- return color;
- }
-
private void on_photo_editor_changed() {
int photo_app_choice_index = (photo_editor_combo.get_active() < external_photo_apps.size) ?
photo_editor_combo.get_active() : external_photo_apps.size;