Add sidebar/toolbar toggles to GSettings

This commit is contained in:
Přemysl Eric Janouch 2022-07-25 23:18:59 +02:00
parent e18f729488
commit 78636fdc18
Signed by: p
GPG Key ID: A0420B94F92B9493
2 changed files with 16 additions and 2 deletions

10
fiv.c
View File

@ -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;
}

View File

@ -21,6 +21,14 @@
<default>false</default>
<summary>Use a dark theme variant on start-up</summary>
</key>
<key name='show-browser-sidebar' type='b'>
<default>true</default>
<summary>Show the browser's sidebar</summary>
</key>
<key name='show-view-toolbar' type='b'>
<default>true</default>
<summary>Show a toolbar in the image view</summary>
</key>
<key name='thumbnail-size' enum='name.janouch.fiv.thumbnail-size'>
<default>'Normal'</default>
<summary>Thumbnail size to assume on start-up</summary>