move the sync prev toggle to the preview popover

ui
Manuel Genovés 2020-02-16 22:00:04 +01:00
parent 28fc4e0a72
commit 81d5aab9e4
3 changed files with 11 additions and 38 deletions

View File

@ -137,30 +137,6 @@
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="sync_scroll_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Synchronize editor/preview scrolling</property>
<property name="justify">right</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="sync_scroll_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">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="input_format_label">
<property name="visible">True</property>
@ -171,7 +147,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
@ -184,7 +160,7 @@
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">6</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
@ -196,7 +172,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">6</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
@ -239,9 +215,6 @@
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="tab_fill">False</property>

View File

@ -56,6 +56,10 @@ class BaseHeaderbar:
self.__populate_layout_switcher_menu()
self.update_preview_layout_icon()
self.sync_scroll_switch = self.builder.get_object("sync_scroll_switch")
self.sync_scroll_switch.set_active(self.settings.get_value("sync-scroll"))
self.sync_scroll_switch.connect("state-set", self.__on_sync_scroll)
self.menu_button = self.builder.get_object("menu_button")
self.recents_button = self.builder.get_object("recents_button")
@ -110,6 +114,10 @@ class BaseHeaderbar:
else:
raise ValueError("Unknown preview mode {}".format(mode))
def __on_sync_scroll(self, _, state):
self.settings.set_boolean("sync-scroll", state)
return False
class MainHeaderbar(BaseHeaderbar): # pylint: disable=too-few-public-methods
"""Sets up the main application headerbar

View File

@ -87,10 +87,6 @@ class PreferencesDialog:
self.gradient_overlay_switch.set_active(self.settings.get_value("gradient-overlay"))
self.gradient_overlay_switch.connect("state-set", self.on_gradient_overlay)
self.sync_scroll_switch = self.builder.get_object("sync_scroll_switch")
self.sync_scroll_switch.set_active(self.settings.get_value("sync-scroll"))
self.sync_scroll_switch.connect("state-set", self.on_sync_scroll)
input_format_store = Gtk.ListStore(int, str)
input_format = self.settings.get_string("input-format")
input_format_active = 0
@ -139,10 +135,6 @@ class PreferencesDialog:
self.settings.set_boolean("gradient-overlay", state)
return False
def on_sync_scroll(self, _, state):
self.settings.set_boolean("sync-scroll", state)
return False
def on_input_format(self, combobox):
fmt = self.formats[combobox.get_active()]
self.settings.set_string("input-format", fmt["format"])