From 78636fdc189d97b25f73f4a65ff7dec466b66bf2 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Mon, 25 Jul 2022 23:18:59 +0200
Subject: Add sidebar/toolbar toggles to GSettings
---
fiv.c | 10 ++++++++--
fiv.gschema.xml | 8 ++++++++
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/fiv.c b/fiv.c
index b7c0848..f58cc28 100644
--- a/fiv.c
+++ b/fiv.c
@@ -1231,6 +1231,7 @@ on_key_press_view(G_GNUC_UNUSED GtkWidget *widget, GdkEventKey *event,
switch (event->state & gtk_accelerator_get_default_mod_mask()) {
case 0:
switch (event->keyval) {
+ // XXX: The same shortcut focuses GtkPaned's handle.
case GDK_KEY_F8:
gtk_widget_set_visible(g.view_toolbar,
!gtk_widget_is_visible(g.view_toolbar));
@@ -1985,7 +1986,6 @@ main(int argc, char *argv[])
GTK_STACK(g.stack), GTK_STACK_TRANSITION_TYPE_NONE);
gtk_container_add(GTK_CONTAINER(g.stack), g.view_box);
gtk_container_add(GTK_CONTAINER(g.stack), g.browser_paned);
- gtk_widget_show_all(g.stack);
g.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(g.window, "destroy",
@@ -2006,6 +2006,12 @@ main(int argc, char *argv[])
g_object_set(g.browser, "thumbnail-size",
g_settings_get_enum(settings, "thumbnail-size"), NULL);
+ gtk_widget_show_all(menu_box);
+ gtk_widget_set_visible(g.browser_sidebar,
+ g_settings_get_boolean(settings, "show-browser-sidebar"));
+ gtk_widget_set_visible(g.view_toolbar,
+ g_settings_get_boolean(settings, "show-view-toolbar"));
+
// Try to get half of the screen vertically, in 4:3 aspect ratio.
//
// We need the GdkMonitor before the GtkWindow has a GdkWindow (i.e.,
@@ -2045,7 +2051,7 @@ main(int argc, char *argv[])
g_object_unref(file);
}
- gtk_widget_show_all(g.window);
+ gtk_widget_show(g.window);
gtk_main();
return 0;
}
diff --git a/fiv.gschema.xml b/fiv.gschema.xml
index 84a66ba..a0b9aab 100644
--- a/fiv.gschema.xml
+++ b/fiv.gschema.xml
@@ -21,6 +21,14 @@