Load preferred interpreters from preferences
authorP. F. Chimento <philip.chimento@gmail.com>
Thu, 10 Mar 2011 05:59:01 +0000 (06:59 +0100)
committerP. F. Chimento <philip.chimento@gmail.com>
Thu, 10 Mar 2011 05:59:01 +0000 (06:59 +0100)
Not editable yet, but that's the next step.

player/chimara.ui
player/preferences.c

index 44fca73f1eb2ed1173309fa663311d166ff83a5d..b2123ab6b60dfa4ca499c75ba08846e30ef27d04 100644 (file)
@@ -244,9 +244,9 @@ Philip Chimento</property>
   <object class="GtkListStore" id="interpreters">
     <columns>
       <!-- column-name Format -->
-      <column type="guint"/>
+      <column type="gchararray"/>
       <!-- column-name Interpreter -->
-      <column type="guint"/>
+      <column type="gchararray"/>
     </columns>
   </object>
   <object class="GtkDialog" id="prefswindow">
@@ -796,6 +796,28 @@ Philip Chimento</property>
                                 <property name="headers_visible">False</property>
                                 <property name="headers_clickable">False</property>
                                 <property name="rules_hint">True</property>
+                                <child>
+                                  <object class="GtkTreeViewColumn" id="format_column">
+                                    <property name="title">Format</property>
+                                    <child>
+                                      <object class="GtkCellRendererText" id="format_renderer"/>
+                                      <attributes>
+                                        <attribute name="text">0</attribute>
+                                      </attributes>
+                                    </child>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkTreeViewColumn" id="interpreter_column">
+                                    <property name="title">Interpreter</property>
+                                    <child>
+                                      <object class="GtkCellRendererText" id="interpreter_renderer"/>
+                                      <attributes>
+                                        <attribute name="text">1</attribute>
+                                      </attributes>
+                                    </child>
+                                  </object>
+                                </child>
                               </object>
                             </child>
                           </object>
index f2cbaf085973c09c1e24bfed7b1a33bc8c10656f..ef8b67f262b037809bc0a52da19a165001adb86e 100644 (file)
@@ -98,6 +98,18 @@ preferences_create(ChimaraGlk *glk)
                gtk_file_chooser_set_filename(blorb_chooser, filename);
                g_free(filename);
        }
+
+       /* Initialize the list of preferred interpreters */
+       GtkListStore *interp_list = GTK_LIST_STORE( load_object("interpreters") );
+       GVariantIter *iter;
+       char *format, *plugin;
+       g_settings_get(prefs_settings, "preferred-interpreters", "a{ss}", &iter);
+       while(g_variant_iter_loop(iter, "{ss}", &format, &plugin)) {
+               GtkTreeIter tree_iter;
+               gtk_list_store_append(interp_list, &tree_iter);
+               gtk_list_store_set(interp_list, &tree_iter, 0, format, 1, plugin, -1);
+       }
+       g_variant_iter_free(iter);
 }
 
 static void