Mercurial > pidgin
diff pidgin/gtkrequest.c @ 29456:89b95d143116
Propagated im.pidgin.pidgin to im.pidgin.cpw.rekkanoryo.icqxstatus and
merged the smiley theme changes together.
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Mon, 01 Dec 2008 23:36:00 +0000 |
parents | f10aba5592c6 93cb9f54df45 |
children | 5391094529c6 |
line wrap: on
line diff
--- a/pidgin/gtkrequest.c Mon Dec 01 17:05:35 2008 +0000 +++ b/pidgin/gtkrequest.c Mon Dec 01 23:36:00 2008 +0000 @@ -995,6 +995,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); @@ -1006,7 +1009,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)); @@ -1025,13 +1031,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);