Add cell renderer on the theme combobox. Seems GtkBuilder don't set a default rendere...
authorXavier Claessens <xclaesse@gmail.com>
Thu, 16 Apr 2009 12:29:41 +0000 (12:29 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Thu, 16 Apr 2009 12:29:41 +0000 (12:29 +0000)
From: Xavier Claessens <xclaesse@gmail.com>

svn path=/trunk/; revision=2873

src/empathy-preferences.c

index 4d1fd71fd4a7db075a4dc6148f48e53a4b5c824a..dba87b4df771e03af22a31e8b3aa23ecdda3e75c 100644 (file)
@@ -602,28 +602,37 @@ static void
 preferences_themes_setup (EmpathyPreferences *preferences)
 {
        GtkComboBox   *combo;
-       GtkListStore  *model;
-       GtkTreeIter    iter;
+       GtkCellLayout *cell_layout;
+       GtkCellRenderer *renderer;
+       GtkListStore  *store;
        const gchar  **themes;
        gint           i;
 
        combo = GTK_COMBO_BOX (preferences->combobox_chat_theme);
+       cell_layout = GTK_CELL_LAYOUT (combo);
 
-       model = gtk_list_store_new (COL_COMBO_COUNT,
-                                   G_TYPE_STRING,
-                                   G_TYPE_STRING);
+       /* Create the model */
+       store = gtk_list_store_new (COL_COMBO_COUNT,
+                                   G_TYPE_STRING,  /* Display name */
+                                   G_TYPE_STRING); /* Theme name */
 
+       /* Fill the model */
        themes = empathy_theme_manager_get_themes ();
        for (i = 0; themes[i]; i += 2) {
-               gtk_list_store_append (model, &iter);
-               gtk_list_store_set (model, &iter,
-                                   COL_COMBO_VISIBLE_NAME, _(themes[i + 1]),
-                                   COL_COMBO_NAME, themes[i],
-                                   -1);
+               gtk_list_store_insert_with_values (store, NULL, -1,
+                       COL_COMBO_VISIBLE_NAME, _(themes[i + 1]),
+                       COL_COMBO_NAME, themes[i],
+                       -1);
        }
 
-       gtk_combo_box_set_model (combo, GTK_TREE_MODEL (model));
-       g_object_unref (model);
+       /* Add cell renderer */
+       renderer = gtk_cell_renderer_text_new ();
+       gtk_cell_layout_pack_start (cell_layout, renderer, TRUE);
+       gtk_cell_layout_set_attributes (cell_layout, renderer,
+               "text", COL_COMBO_VISIBLE_NAME, NULL);
+
+       gtk_combo_box_set_model (combo, GTK_TREE_MODEL (store));
+       g_object_unref (store);
 }
 
 static void