GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
+
+ /* Get last opened path */
+ extern GSettings *state_settings;
+ gchar *path;
+ g_settings_get(state_settings, "last-open-path", "ms", &path);
+ if(path) {
+ gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), path);
+ g_free(path);
+ }
+
if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
GError *error = NULL;
gchar *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
g_free(path);
g_free(scratch);
+ path = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(dialog));
+ if(path) {
+ g_settings_set(state_settings, "last-open-path", "ms", path);
+ g_free(path);
+ }
if(!chimara_if_run_game(CHIMARA_IF(glk), filename, &error)) {
error_dialog(window, error, _("Could not open game file '%s': "), filename);
g_free(filename);
GtkWidget *aboutwindow = NULL;
GtkWidget *prefswindow = NULL;
GtkWidget *toolbar = NULL;
-GSettings *settings = NULL;
+GSettings *prefs_settings = NULL;
+GSettings *state_settings = NULL;
GObject *
load_object(const gchar *name)
/* Initialize settings file */
gchar *keyfile = g_build_filename(g_get_home_dir(), ".chimara", NULL);
- GSettingsBackend *backend = g_keyfile_settings_backend_new(keyfile, "/", "player");
- settings = g_settings_new_with_backend("org.chimara-if.chimara-player", backend);
+ GSettingsBackend *backend = g_keyfile_settings_backend_new(keyfile, "/org/chimara-if/player/", NULL);
+ prefs_settings = g_settings_new_with_backend("org.chimara-if.player.preferences", backend);
+ state_settings = g_settings_new_with_backend("org.chimara-if.player.state", backend);
create_window();
gtk_widget_show_all(window);
<schemalist>
- <schema id="org.chimara-if.chimara-player" path="/">
-
- <!-- Keys and key names are subject to change without notice, until we have
- a spec-->
- <!-- "b" = boolean; see documentation of GVariantType -->
-
+ <!-- Keys and key names are subject to change without notice, until we have
+ a spec-->
+ <!-- "b" = boolean; see documentation of GVariantType -->
+
+ <schema id="org.chimara-if.player" path="/org/chimara-if/player/">
+ <child name="preferences" schema="org.chimara-if.player.preferences"/>
+ <child name="state" schema="org.chimara-if.player.state"/>
+ </schema>
+
+ <schema id="org.chimara-if.player.preferences" path="/org/chimara-if/player/preferences/">
+
<key name="flep" type="b">
<default>false</default>
<summary>Flepping</summary>
Whether to flep or not while gronking a bloop.
</description>
</key>
-
+
+ </schema>
+
+ <schema id="org.chimara-if.player.state" path="/org/chimara-if/player/state/">
+
+ <key name="last-open-path" type="ms">
+ <default>nothing</default>
+ <summary>Last open path</summary>
+ <description>
+ The path in which a game was last opened. The next Open dialog will
+ start in this path.
+ </description>
+ </key>
+
</schema>
</schemalist>
\ No newline at end of file
g_signal_connect(selection, "changed", G_CALLBACK(style_tree_select_callback), glk);
/* Bind the preferences to the entries in the preferences file */
- extern GSettings *settings;
+ extern GSettings *prefs_settings;
GObject *flep = G_OBJECT( load_object("flep") );
- g_settings_bind(settings, "flep", flep, "active", G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind(prefs_settings, "flep", flep, "active", G_SETTINGS_BIND_DEFAULT);
}
static void