comparison pidgin/gtknotify.c @ 20102:e47e8d670bfa

merge of '936cdaa27fea9a9673ee31a184af0a30d9471abe' and 'b017e4ee0447b76795120d6997db9b26e1a0dfba'
author Mark Doliner <mark@kingant.net>
date Mon, 17 Sep 2007 06:43:16 +0000
parents a3f07fa68e90
children 73117d8bfdcd
comparison
equal deleted inserted replaced
20101:3a5f152e7ed0 20102:e47e8d670bfa
659 PidginNotifySearchResultsData *data = data_; 659 PidginNotifySearchResultsData *data = data_;
660 GtkListStore *model = data->model; 660 GtkListStore *model = data->model;
661 GtkTreeIter iter; 661 GtkTreeIter iter;
662 GdkPixbuf *pixbuf; 662 GdkPixbuf *pixbuf;
663 guint col_num; 663 guint col_num;
664 guint i; 664 GList *row, *column;
665 guint j; 665 guint n;
666 666
667 gtk_list_store_clear(data->model); 667 gtk_list_store_clear(data->model);
668 668
669 pixbuf = pidgin_create_prpl_icon(purple_connection_get_account(gc), 0.5); 669 pixbuf = pidgin_create_prpl_icon(purple_connection_get_account(gc), 0.5);
670 670
671 /* +1 is for the automagically created Status column. */ 671 /* +1 is for the automagically created Status column. */
672 col_num = purple_notify_searchresults_get_columns_count(results) + 1; 672 col_num = g_list_length(results->columns) + 1;
673 673
674 for (i = 0; i < purple_notify_searchresults_get_rows_count(results); i++) { 674 for (row = results->rows; row != NULL; row = row->next) {
675 GList *row = purple_notify_searchresults_row_get(results, i);
676 675
677 gtk_list_store_append(model, &iter); 676 gtk_list_store_append(model, &iter);
678 gtk_list_store_set(model, &iter, 0, pixbuf, -1); 677 gtk_list_store_set(model, &iter, 0, pixbuf, -1);
679 678
680 for (j = 1; j < col_num; j++) { 679 n = 1;
680 for (column = row->data; column != NULL; column = column->next) {
681 GValue v; 681 GValue v;
682 char *data = g_list_nth_data(row, j - 1);
683 682
684 v.g_type = 0; 683 v.g_type = 0;
685 g_value_init(&v, G_TYPE_STRING); 684 g_value_init(&v, G_TYPE_STRING);
686 g_value_set_string(&v, data); 685 g_value_set_string(&v, column->data);
687 gtk_list_store_set_value(model, &iter, j, &v); 686 gtk_list_store_set_value(model, &iter, n, &v);
687 n++;
688 } 688 }
689 } 689 }
690 690
691 if (pixbuf != NULL) 691 if (pixbuf != NULL)
692 g_object_unref(pixbuf); 692 g_object_unref(pixbuf);
702 GtkWidget *close_button; 702 GtkWidget *close_button;
703 GType *col_types; 703 GType *col_types;
704 GtkListStore *model; 704 GtkListStore *model;
705 GtkCellRenderer *renderer; 705 GtkCellRenderer *renderer;
706 guint col_num; 706 guint col_num;
707 GList *column;
707 guint i; 708 guint i;
708 709
709 GtkWidget *vbox; 710 GtkWidget *vbox;
710 GtkWidget *label; 711 GtkWidget *label;
711 GtkWidget *sw; 712 GtkWidget *sw;
749 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); 750 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
750 gtk_widget_show(label); 751 gtk_widget_show(label);
751 g_free(label_text); 752 g_free(label_text);
752 753
753 /* +1 is for the automagically created Status column. */ 754 /* +1 is for the automagically created Status column. */
754 col_num = purple_notify_searchresults_get_columns_count(results) + 1; 755 col_num = g_list_length(results->columns) + 1;
755 756
756 /* Setup the list model */ 757 /* Setup the list model */
757 col_types = g_new0(GType, col_num); 758 col_types = g_new0(GType, col_num);
758 759
759 /* There always is this first column. */ 760 /* There always is this first column. */
784 785
785 renderer = gtk_cell_renderer_pixbuf_new(); 786 renderer = gtk_cell_renderer_pixbuf_new();
786 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), 787 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview),
787 -1, "", renderer, "pixbuf", 0, NULL); 788 -1, "", renderer, "pixbuf", 0, NULL);
788 789
789 for (i = 1; i < col_num; i++) { 790 i = 1;
791 for (column = results->columns; column != NULL; column = column->next) {
790 renderer = gtk_cell_renderer_text_new(); 792 renderer = gtk_cell_renderer_text_new();
791 793
792 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), -1, 794 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), -1,
793 purple_notify_searchresults_column_get_title(results, i-1), 795 column->data, renderer, "text", i, NULL);
794 renderer, "text", i, NULL); 796 i++;
795 } 797 }
796 798
797 for (i = 0; i < g_list_length(results->buttons); i++) { 799 for (i = 0; i < g_list_length(results->buttons); i++) {
798 PurpleNotifySearchButton *b = g_list_nth_data(results->buttons, i); 800 PurpleNotifySearchButton *b = g_list_nth_data(results->buttons, i);
799 GtkWidget *button = NULL; 801 GtkWidget *button = NULL;