diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2009-04-16 20:29:41 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2009-04-16 20:29:41 +0800 |
commit | 851356115b580adae99f326d0c62567f6b049d8a (patch) | |
tree | 6fc9629c5dd859375f969b18cc2ac1d07232a5ec /src | |
parent | 6696c5b43642dd1248575a59b6cc7ba23b83e701 (diff) | |
download | gsoc2013-empathy-851356115b580adae99f326d0c62567f6b049d8a.tar gsoc2013-empathy-851356115b580adae99f326d0c62567f6b049d8a.tar.gz gsoc2013-empathy-851356115b580adae99f326d0c62567f6b049d8a.tar.bz2 gsoc2013-empathy-851356115b580adae99f326d0c62567f6b049d8a.tar.lz gsoc2013-empathy-851356115b580adae99f326d0c62567f6b049d8a.tar.xz gsoc2013-empathy-851356115b580adae99f326d0c62567f6b049d8a.tar.zst gsoc2013-empathy-851356115b580adae99f326d0c62567f6b049d8a.zip |
Add cell renderer on the theme combobox. Seems GtkBuilder don't set a default renderer like glade.
From: Xavier Claessens <xclaesse@gmail.com>
svn path=/trunk/; revision=2873
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-preferences.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/empathy-preferences.c b/src/empathy-preferences.c index 4d1fd71fd..dba87b4df 100644 --- a/src/empathy-preferences.c +++ b/src/empathy-preferences.c @@ -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 |