diff --git a/data/ui/Preferences.ui b/data/ui/Preferences.ui
index 9325450..43fe8da 100644
--- a/data/ui/Preferences.ui
+++ b/data/ui/Preferences.ui
@@ -40,9 +40,10 @@
0
@@ -53,7 +54,9 @@
0
@@ -83,6 +86,31 @@
1
+
+
+
+ 0
+ 2
+
+
+
+
+
+ 1
+ 2
+
+
True
diff --git a/uberwriter/UberwriterWindow.py b/uberwriter/UberwriterWindow.py
index 885400b..4ee77eb 100644
--- a/uberwriter/UberwriterWindow.py
+++ b/uberwriter/UberwriterWindow.py
@@ -153,7 +153,7 @@ class UberwriterWindow(Gtk.ApplicationWindow):
# Let them disable it
if self.settings.get_value("gradient-overlay"):
- self.scrolled_window.connect_after("draw", self.draw_gradient)
+ self.overlay = self.scrolled_window.connect_after("draw", self.draw_gradient)
self.smooth_scroll_starttime = 0
self.smooth_scroll_endtime = 0
diff --git a/uberwriter_lib/AppWindow.py b/uberwriter_lib/AppWindow.py
index b207aa2..83b7502 100644
--- a/uberwriter_lib/AppWindow.py
+++ b/uberwriter_lib/AppWindow.py
@@ -98,6 +98,12 @@ class Application(Gtk.Application):
action.connect("change-state", self.on_spellcheck)
self.add_action(action)
+ action = Gio.SimpleAction.new_stateful("draw_gradient",
+ None,
+ GLib.Variant.new_boolean(True))
+ action.connect("change-state", self.on_draw_gradient)
+ self.add_action(action)
+
# Menu Actions
action = Gio.SimpleAction.new("new", None)
@@ -235,6 +241,16 @@ class Application(Gtk.Application):
action.set_state(value)
self.window.toggle_spellcheck(value)
+ def on_draw_gradient(self, action, value):
+ action.set_state(value)
+ self.settings.set_value("gradient-overlay",
+ GLib.Variant("b", value))
+ if value:
+ self.window.overlay = self.window.scrolled_window.connect_after(
+ "draw", self.window.draw_gradient)
+ else:
+ self.window.scrolled_window.disconnect(self.window.overlay)
+
def on_new(self, _action, _value):
self.window.new_document()