forked from Mirrors/apostrophe
allow disabling overlay within preferences window
parent
3fd91923ee
commit
56e718be15
|
@ -40,9 +40,10 @@
|
||||||
<object class="GtkLabel" id="Dark_mode_label">
|
<object class="GtkLabel" id="Dark_mode_label">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="halign">start</property>
|
<property name="halign">end</property>
|
||||||
<property name="valign">start</property>
|
<property name="valign">start</property>
|
||||||
<property name="label" translatable="yes">Use dark mode</property>
|
<property name="label" translatable="yes">Use dark mode</property>
|
||||||
|
<property name="justify">right</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="left_attach">0</property>
|
||||||
|
@ -53,7 +54,9 @@
|
||||||
<object class="GtkLabel" id="Spellcheck_label">
|
<object class="GtkLabel" id="Spellcheck_label">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
<property name="label" translatable="yes">Autospellcheck</property>
|
<property name="label" translatable="yes">Autospellcheck</property>
|
||||||
|
<property name="justify">right</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="left_attach">0</property>
|
||||||
|
@ -83,6 +86,31 @@
|
||||||
<property name="top_attach">1</property>
|
<property name="top_attach">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="Gradient_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="label" translatable="yes">Draw scroll gradient</property>
|
||||||
|
<property name="justify">right</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSwitch" id="Gradient_switch">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="valign">start</property>
|
||||||
|
<property name="action_name">app.draw_gradient</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="tab_expand">True</property>
|
<property name="tab_expand">True</property>
|
||||||
|
|
|
@ -153,7 +153,7 @@ class UberwriterWindow(Gtk.ApplicationWindow):
|
||||||
# Let them disable it
|
# Let them disable it
|
||||||
|
|
||||||
if self.settings.get_value("gradient-overlay"):
|
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_starttime = 0
|
||||||
self.smooth_scroll_endtime = 0
|
self.smooth_scroll_endtime = 0
|
||||||
|
|
|
@ -98,6 +98,12 @@ class Application(Gtk.Application):
|
||||||
action.connect("change-state", self.on_spellcheck)
|
action.connect("change-state", self.on_spellcheck)
|
||||||
self.add_action(action)
|
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
|
# Menu Actions
|
||||||
|
|
||||||
action = Gio.SimpleAction.new("new", None)
|
action = Gio.SimpleAction.new("new", None)
|
||||||
|
@ -235,6 +241,16 @@ class Application(Gtk.Application):
|
||||||
action.set_state(value)
|
action.set_state(value)
|
||||||
self.window.toggle_spellcheck(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):
|
def on_new(self, _action, _value):
|
||||||
self.window.new_document()
|
self.window.new_document()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue