</description>
</key>
+ <key name="css-file" type="ms">
+ <default>nothing</default>
+ <summary>CSS style file</summary>
+ <description>
+ The CSS file containing the current theme for the text in the games.
+ </description>
+ </key>
+
<key name="resource-path" type="ms">
<default>nothing</default>
<summary>Resource path</summary>
GObject *flep = G_OBJECT( load_object("flep") );
g_settings_bind(prefs_settings, "flep", flep, "active", G_SETTINGS_BIND_DEFAULT);
GtkFileChooser *blorb_chooser = GTK_FILE_CHOOSER( load_object("blorb_file_chooser") );
+ GtkFileChooser *css_chooser = GTK_FILE_CHOOSER( load_object("css-filechooser") );
char *filename;
g_settings_get(prefs_settings, "resource-path", "ms", &filename);
if(filename) {
gtk_file_chooser_set_filename(blorb_chooser, filename);
g_free(filename);
}
+ g_settings_get(prefs_settings, "css-file", "ms", &filename);
+ if(filename) {
+ if(!chimara_glk_set_css_from_file(glk, filename, NULL)) {
+ /* If the setting didn't point to a CSS file, fail silently and
+ null the setting */
+ g_settings_set(prefs_settings, "css-file", "ms", NULL);
+ } else {
+ gtk_file_chooser_set_filename(css_chooser, filename);
+ }
+ g_free(filename);
+ }
/* Populate the list of available interpreters */
GtkListStore *interp_list = GTK_LIST_STORE( load_object("available_interpreters") );
chimara_glk_update_style(glk);
}
+void
+on_css_filechooser_file_set(GtkFileChooserButton *button, ChimaraGlk *glk)
+{
+ GError *error = NULL;
+ extern GSettings *prefs_settings;
+ char *filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(button) );
+ if(!chimara_glk_set_css_from_file(glk, filename, &error)) {
+ error_dialog(NULL, error, "There was a problem reading the CSS file: ");
+ g_settings_set(prefs_settings, "css-file", "ms", NULL);
+ } else {
+ g_settings_set(prefs_settings, "css-file", "ms", filename);
+ }
+ g_free(filename);
+}
+
void
on_resource_file_set(GtkFileChooserButton *button, ChimaraGlk *glk)
{