add autohide-headerbar toggle on settings

ui
Manuel Genovés 2019-12-09 02:14:52 +01:00
parent ff579b956f
commit 48e48d95de
3 changed files with 48 additions and 12 deletions

View File

@ -62,11 +62,11 @@
Input format to use when previewing and exporting using Pandoc.
</description>
</key>
<key name='poll-motion' type='b'>
<key name='autohide-headerbar' type='b'>
<default>true</default>
<summary>Allow Uberwriter to poll cursor motion</summary>
<summary>Autohide Headerbar</summary>
<description>
Hide the header and status bars if the cursor is not moving.
Hide the header and status bars when typing.
</description>
</key>
<key name='open-file-path' type='s'>

View File

@ -99,7 +99,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
@ -110,7 +110,7 @@
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">2</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
@ -123,7 +123,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
@ -134,7 +134,7 @@
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">3</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
@ -147,7 +147,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
@ -158,7 +158,7 @@
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">4</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
@ -171,7 +171,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
<property name="top_attach">6</property>
</packing>
</child>
<child>
@ -184,7 +184,7 @@
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">5</property>
<property name="top_attach">6</property>
</packing>
</child>
<child>
@ -196,9 +196,37 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
<property name="top_attach">6</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="autohide_headerbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Autohide header and statusbars while typing</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Autohide headerbar</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="autohide_headerbar_switch">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>

View File

@ -75,6 +75,10 @@ class PreferencesDialog:
self.dark_mode_switch.set_active(self.settings.get_value("dark-mode"))
self.dark_mode_switch.connect("state-set", self.on_dark_mode)
self.autohide_headerbar_switch = self.builder.get_object("autohide_headerbar_switch")
self.autohide_headerbar_switch.set_active(self.settings.get_value("autohide-headerbar"))
self.autohide_headerbar_switch.connect("state-set", self.on_autohide_headerbar)
self.spellcheck_switch = self.builder.get_object("spellcheck_switch")
self.spellcheck_switch.set_active(self.settings.get_value("spellcheck"))
self.spellcheck_switch.connect("state-set", self.on_spellcheck)
@ -123,6 +127,10 @@ class PreferencesDialog:
self.dark_mode_auto_switch.set_active(GLib.Variant.new_boolean(False))
return False
def on_autohide_headerbar(self, _, state):
self.settings.set_boolean("autohide-headerbar", state)
return False
def on_spellcheck(self, _, state):
self.settings.set_boolean("spellcheck", state)
return False