Dynamically generate list of interpreters
authorP. F. Chimento <philip.chimento@gmail.com>
Thu, 10 Mar 2011 21:26:53 +0000 (22:26 +0100)
committerP. F. Chimento <philip.chimento@gmail.com>
Thu, 10 Mar 2011 21:26:53 +0000 (22:26 +0100)
player/chimara.ui
player/preferences.c

index 1a1bf7363308b6bb3ef73527a1ee4b7048d50ca7..277a23c627ca932342e2d6208a5c79ea4feb28f0 100644 (file)
@@ -254,20 +254,6 @@ Philip Chimento</property>
       <!-- column-name Interpreter -->
       <column type="gchararray"/>
     </columns>
-    <data>
-      <row>
-        <col id="0" translatable="yes">Frotz</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Nitfol</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Glulxe</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Git</col>
-      </row>
-    </data>
   </object>
   <object class="GtkDialog" id="prefswindow">
     <property name="can_focus">False</property>
index 1c1527d30470ef048421319ceba728e74020ba4c..5ee62ed6be797156bc4a43e4777fd1ece155f15a 100644 (file)
@@ -165,8 +165,19 @@ preferences_create(ChimaraGlk *glk)
                g_free(filename);
        }
 
+       /* Populate the list of available interpreters */
+       GtkListStore *interp_list = GTK_LIST_STORE( load_object("available_interpreters") );
+       unsigned int interp;
+       GtkTreeIter tree_iter;
+       for(interp = 0; interp < CHIMARA_IF_NUM_INTERPRETERS; interp++) {
+               gtk_list_store_append(interp_list, &tree_iter);
+               gtk_list_store_set(interp_list, &tree_iter,
+                       0, interpreter_to_display_string(interp),
+                       -1);
+       }
+
        /* Initialize the list of preferred interpreters */
-       GtkListStore *interp_list = GTK_LIST_STORE( load_object("interpreters") );
+       GtkListStore *preferred_list = GTK_LIST_STORE( load_object("interpreters") );
        GVariantIter *iter;
        char *format, *plugin;
        g_settings_get(prefs_settings, "preferred-interpreters", "a{ss}", &iter);
@@ -177,9 +188,8 @@ preferences_create(ChimaraGlk *glk)
                ChimaraIFInterpreter interp_num = parse_interpreter(plugin);
                if(interp_num == CHIMARA_IF_INTERPRETER_NONE)
                        continue;
-               GtkTreeIter tree_iter;
-               gtk_list_store_append(interp_list, &tree_iter);
-               gtk_list_store_set(interp_list, &tree_iter,
+               gtk_list_store_append(preferred_list, &tree_iter);
+               gtk_list_store_set(preferred_list, &tree_iter,
                        0, format_to_display_string(format_num),
                        1, interpreter_to_display_string(interp_num),
                        -1);