+
+void
+on_interpreter_cell_changed(GtkCellRendererCombo *combo, char *path_string, GtkTreeIter *new_iter, ChimaraGlk *glk)
+{
+ unsigned int format, interpreter;
+ format = (unsigned int)strtol(path_string, NULL, 10);
+ GtkTreeModel *combo_model;
+ g_object_get(combo, "model", &combo_model, NULL);
+ char *combo_string = gtk_tree_model_get_string_from_iter(combo_model, new_iter);
+ interpreter = (unsigned int)strtol(combo_string, NULL, 10);
+ g_free(combo_string);
+
+ chimara_if_set_preferred_interpreter(CHIMARA_IF(glk), format, interpreter);
+
+ /* Display the new setting in the list */
+ GtkTreeIter iter;
+ GtkTreePath *path = gtk_tree_path_new_from_string(path_string);
+ gtk_tree_model_get_iter(GTK_TREE_MODEL(preferred_list), &iter, path);
+ gtk_tree_path_free(path);
+ gtk_list_store_set(preferred_list, &iter,
+ 1, interpreter_to_display_string(interpreter),
+ -1);
+
+ /* Save the new settings in the preferences file */
+ extern GSettings *prefs_settings;
+ GVariantBuilder *builder = g_variant_builder_new( G_VARIANT_TYPE("a{ss}") );
+ unsigned int count;
+ for(count = 0; count < CHIMARA_IF_NUM_FORMATS; count++) {
+ g_variant_builder_add(builder, "{ss}",
+ format_to_string(count),
+ interpreter_to_string(chimara_if_get_preferred_interpreter(CHIMARA_IF(glk), count)));
+ }
+ g_settings_set(prefs_settings, "preferred-interpreters", "a{ss}", builder);
+ g_variant_builder_unref(builder);
+}