Add thumbnail size to GSettings

This commit is contained in:
Přemysl Eric Janouch 2022-07-25 21:08:56 +02:00
parent 9f1041988d
commit e18f729488
Signed by: p
GPG Key ID: A0420B94F92B9493
2 changed files with 18 additions and 5 deletions

10
fiv.c
View File

@ -1912,10 +1912,6 @@ main(int argc, char *argv[])
gtk_icon_theme_add_resource_path( gtk_icon_theme_add_resource_path(
gtk_icon_theme_get_default(), "/org/gnome/design/IconLibrary/"); gtk_icon_theme_get_default(), "/org/gnome/design/IconLibrary/");
GSettings *settings = g_settings_new(PROJECT_NS PROJECT_NAME);
if (g_settings_get_boolean(settings, "dark-theme"))
toggle_sunlight();
GtkCssProvider *provider = gtk_css_provider_new(); GtkCssProvider *provider = gtk_css_provider_new();
gtk_css_provider_load_from_data( gtk_css_provider_load_from_data(
provider, stylesheet, sizeof stylesheet - 1, NULL); provider, stylesheet, sizeof stylesheet - 1, NULL);
@ -2004,6 +2000,12 @@ main(int argc, char *argv[])
gtk_container_add(GTK_CONTAINER(menu_box), g.stack); gtk_container_add(GTK_CONTAINER(menu_box), g.stack);
gtk_container_add(GTK_CONTAINER(g.window), menu_box); gtk_container_add(GTK_CONTAINER(g.window), menu_box);
GSettings *settings = g_settings_new(PROJECT_NS PROJECT_NAME);
if (g_settings_get_boolean(settings, "dark-theme"))
toggle_sunlight();
g_object_set(g.browser, "thumbnail-size",
g_settings_get_enum(settings, "thumbnail-size"), NULL);
// Try to get half of the screen vertically, in 4:3 aspect ratio. // 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., // We need the GdkMonitor before the GtkWindow has a GdkWindow (i.e.,

View File

@ -1,5 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<schemalist> <schemalist>
<enum id="name.janouch.fiv.thumbnail-size">
<value nick='Small' value='0'/>
<value nick='Normal' value='1'/>
<value nick='Large' value='2'/>
<value nick='Huge' value='3'/>
</enum>
<schema path="/name/janouch/fiv/" id="name.janouch.fiv"> <schema path="/name/janouch/fiv/" id="name.janouch.fiv">
<key name='native-view-window' type='b'> <key name='native-view-window' type='b'>
<default>true</default> <default>true</default>
@ -12,7 +19,11 @@
</key> </key>
<key name='dark-theme' type='b'> <key name='dark-theme' type='b'>
<default>false</default> <default>false</default>
<summary>Use a dark theme variant</summary> <summary>Use a dark theme variant on start-up</summary>
</key>
<key name='thumbnail-size' enum='name.janouch.fiv.thumbnail-size'>
<default>'Normal'</default>
<summary>Thumbnail size to assume on start-up</summary>
</key> </key>
</schema> </schema>
</schemalist> </schemalist>