summaryrefslogtreecommitdiff
path: root/src/preferences-dialog.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2022-03-19 18:05:26 +0100
committerJörg Frings-Fürst <debian@jff.email>2022-03-19 18:05:26 +0100
commit4e466fc263ef18533b1368ac7514bdf01973227b (patch)
treeed6425480e22209291077ee018858e2a7c9e26f9 /src/preferences-dialog.vala
parent14afa21f4a428f9a6a5788dc1fb8a3507a42d02f (diff)
parente2af6e905a98b8b90b0504bc8f245733196dd808 (diff)
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'src/preferences-dialog.vala')
-rw-r--r--src/preferences-dialog.vala35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/preferences-dialog.vala b/src/preferences-dialog.vala
index 8d992ab..02bbaf8 100644
--- a/src/preferences-dialog.vala
+++ b/src/preferences-dialog.vala
@@ -51,6 +51,14 @@ private class PreferencesDialog : Hdy.PreferencesWindow
private unowned Gtk.Adjustment brightness_adjustment;
[GtkChild]
private unowned Gtk.Adjustment contrast_adjustment;
+ [GtkChild]
+ private unowned Gtk.Switch postproc_enable_switch;
+ [GtkChild]
+ private unowned Gtk.Entry postproc_script_entry;
+ [GtkChild]
+ private unowned Gtk.Entry postproc_args_entry;
+ [GtkChild]
+ private unowned Gtk.Switch postproc_keep_original_switch;
public PreferencesDialog (Settings settings)
{
@@ -133,6 +141,33 @@ private class PreferencesDialog : Hdy.PreferencesWindow
page_delay_6s_button.toggled.connect ((button) => { if (button.active) settings.set_int ("page-delay", 6000); });
page_delay_10s_button.toggled.connect ((button) => { if (button.active) settings.set_int ("page-delay", 10000); });
page_delay_15s_button.toggled.connect ((button) => { if (button.active) settings.set_int ("page-delay", 15000); });
+
+ // Postprocessing settings
+ var postproc_enabled = settings.get_boolean ("postproc-enabled");
+ postproc_enable_switch.set_state(postproc_enabled);
+ toggle_postproc_visibility (postproc_enabled);
+ postproc_enable_switch.state_set.connect ((is_active) => { toggle_postproc_visibility (is_active);
+ settings.set_boolean("postproc-enabled", is_active);
+ return true; });
+
+ var postproc_script = settings.get_string("postproc-script");
+ postproc_script_entry.set_text(postproc_script);
+ postproc_script_entry.changed.connect (() => { settings.set_string("postproc-script", postproc_script_entry.get_text()); });
+
+ var postproc_arguments = settings.get_string("postproc-arguments");
+ postproc_args_entry.set_text(postproc_arguments);
+ postproc_args_entry.changed.connect (() => { settings.set_string("postproc-arguments", postproc_args_entry.get_text()); });
+
+ var postproc_keep_original = settings.get_boolean ("postproc-keep-original");
+ postproc_keep_original_switch.set_state(postproc_keep_original);
+ postproc_keep_original_switch.state_set.connect ((is_active) => { settings.set_boolean("postproc-keep-original", is_active);
+ return true; });
+ }
+
+ private void toggle_postproc_visibility(bool enabled) {
+ postproc_script_entry.get_parent ().get_parent ().get_parent ().get_parent ().set_visible(enabled);
+ postproc_args_entry.get_parent ().get_parent ().get_parent ().get_parent ().set_visible(enabled);
+ postproc_keep_original_switch.get_parent ().get_parent ().get_parent ().get_parent ().set_visible(enabled);
}
private void set_page_side (ScanSide page_side)