Mercurial > pidgin.yaz
diff pidgin/gtkrequest.c @ 29853:c3b735f8f490
propagate from branch 'im.pidgin.pidgin' (head 226a30da7a9fe3b828a1fe564797b3388e6159bc)
to branch 'im.pidgin.cpw.rekkanoryo.icqxstatus' (head b7c2ff532b70196eedf48de0343d06eb45e90f1f)
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Sun, 07 Feb 2010 19:40:49 +0000 |
parents | a538cb73f897 |
children | 185677f47825 |
line wrap: on
line diff
--- a/pidgin/gtkrequest.c Sun Feb 07 17:43:30 2010 +0000 +++ b/pidgin/gtkrequest.c Sun Feb 07 19:40:49 2010 +0000 @@ -1066,6 +1066,9 @@ GtkTreeViewColumn *column; GtkTreeIter iter; GList *l; + GList *icons = NULL; + + icons = purple_request_field_list_get_icons(field); /* Create the scrolled window */ sw = gtk_scrolled_window_new(NULL, NULL); @@ -1077,7 +1080,10 @@ gtk_widget_show(sw); /* Create the list store */ - store = gtk_list_store_new(2, G_TYPE_POINTER, G_TYPE_STRING); + if (icons) + store = gtk_list_store_new(3, G_TYPE_POINTER, G_TYPE_STRING, GDK_TYPE_PIXBUF); + else + store = gtk_list_store_new(2, G_TYPE_POINTER, G_TYPE_STRING); /* Create the tree view */ treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); @@ -1096,13 +1102,38 @@ gtk_tree_view_column_pack_start(column, renderer, TRUE); gtk_tree_view_column_add_attribute(column, renderer, "text", 1); + if (icons) + { + renderer = gtk_cell_renderer_pixbuf_new(); + gtk_tree_view_column_pack_start(column, renderer, TRUE); + gtk_tree_view_column_add_attribute(column, renderer, "pixbuf", 2); + + gtk_widget_set_size_request(treeview, 200, 400); + } + for (l = purple_request_field_list_get_items(field); l != NULL; l = l->next) { const char *text = (const char *)l->data; gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, + if (icons) + { + const char *icon_path = (const char *)icons->data; + GdkPixbuf* pixbuf = NULL; + + if (icon_path) + pixbuf = gdk_pixbuf_new_from_file(icon_path, NULL); + + gtk_list_store_set(store, &iter, + 0, purple_request_field_list_get_data(field, text), + 1, text, + 2, pixbuf, + -1); + icons = icons->next; + } + else + gtk_list_store_set(store, &iter, 0, purple_request_field_list_get_data(field, text), 1, text, -1);