pidgin/gtknotify.c

changeset 20747
c7494ef1530d
parent 20147
66f05a854eee
parent 20655
66f2dfd94949
child 20748
99e23c8bc2b1
equal deleted inserted replaced
20298:3e480c5ee53b 20747:c7494ef1530d
557 } 557 }
558 558
559 if (!GTK_WIDGET_VISIBLE(dialog)) { 559 if (!GTK_WIDGET_VISIBLE(dialog)) {
560 GdkPixbuf *pixbuf = gtk_widget_render_icon(dialog, PIDGIN_STOCK_DIALOG_MAIL, 560 GdkPixbuf *pixbuf = gtk_widget_render_icon(dialog, PIDGIN_STOCK_DIALOG_MAIL,
561 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL), NULL); 561 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL), NULL);
562 char *label_text = g_strdup_printf(ngettext("<b>You have %d new e-mail.</b>", 562 char *label_text = g_strdup_printf(ngettext("<b>%d new e-mail.</b>",
563 "<b>You have %d new e-mails.</b>", 563 "<b>%d new e-mails.</b>",
564 mail_dialog->total_count), mail_dialog->total_count); 564 mail_dialog->total_count), mail_dialog->total_count);
565 mail_dialog->in_use = TRUE; /* So that _set_headline doesn't accidentally 565 mail_dialog->in_use = TRUE; /* So that _set_headline doesn't accidentally
566 remove the notifications when replacing an 566 remove the notifications when replacing an
567 old notification. */ 567 old notification. */
568 pidgin_blist_set_headline(label_text, 568 pidgin_blist_set_headline(label_text,
688 PidginNotifySearchResultsData *data = data_; 688 PidginNotifySearchResultsData *data = data_;
689 GtkListStore *model = data->model; 689 GtkListStore *model = data->model;
690 GtkTreeIter iter; 690 GtkTreeIter iter;
691 GdkPixbuf *pixbuf; 691 GdkPixbuf *pixbuf;
692 guint col_num; 692 guint col_num;
693 guint i; 693 GList *row, *column;
694 guint j; 694 guint n;
695 695
696 gtk_list_store_clear(data->model); 696 gtk_list_store_clear(data->model);
697 697
698 pixbuf = pidgin_create_prpl_icon(purple_connection_get_account(gc), 0.5); 698 pixbuf = pidgin_create_prpl_icon(purple_connection_get_account(gc), 0.5);
699 699
700 /* +1 is for the automagically created Status column. */ 700 /* +1 is for the automagically created Status column. */
701 col_num = purple_notify_searchresults_get_columns_count(results) + 1; 701 col_num = g_list_length(results->columns) + 1;
702 702
703 for (i = 0; i < purple_notify_searchresults_get_rows_count(results); i++) { 703 for (row = results->rows; row != NULL; row = row->next) {
704 GList *row = purple_notify_searchresults_row_get(results, i);
705 704
706 gtk_list_store_append(model, &iter); 705 gtk_list_store_append(model, &iter);
707 gtk_list_store_set(model, &iter, 0, pixbuf, -1); 706 gtk_list_store_set(model, &iter, 0, pixbuf, -1);
708 707
709 for (j = 1; j < col_num; j++) { 708 n = 1;
709 for (column = row->data; column != NULL; column = column->next) {
710 GValue v; 710 GValue v;
711 char *data = g_list_nth_data(row, j - 1);
712 711
713 v.g_type = 0; 712 v.g_type = 0;
714 g_value_init(&v, G_TYPE_STRING); 713 g_value_init(&v, G_TYPE_STRING);
715 g_value_set_string(&v, data); 714 g_value_set_string(&v, column->data);
716 gtk_list_store_set_value(model, &iter, j, &v); 715 gtk_list_store_set_value(model, &iter, n, &v);
716 n++;
717 } 717 }
718 } 718 }
719 719
720 if (pixbuf != NULL) 720 if (pixbuf != NULL)
721 g_object_unref(pixbuf); 721 g_object_unref(pixbuf);
731 GtkWidget *close_button; 731 GtkWidget *close_button;
732 GType *col_types; 732 GType *col_types;
733 GtkListStore *model; 733 GtkListStore *model;
734 GtkCellRenderer *renderer; 734 GtkCellRenderer *renderer;
735 guint col_num; 735 guint col_num;
736 GList *column;
736 guint i; 737 guint i;
737 738
738 GtkWidget *vbox; 739 GtkWidget *vbox;
739 GtkWidget *label; 740 GtkWidget *label;
740 GtkWidget *sw; 741 GtkWidget *sw;
778 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); 779 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
779 gtk_widget_show(label); 780 gtk_widget_show(label);
780 g_free(label_text); 781 g_free(label_text);
781 782
782 /* +1 is for the automagically created Status column. */ 783 /* +1 is for the automagically created Status column. */
783 col_num = purple_notify_searchresults_get_columns_count(results) + 1; 784 col_num = g_list_length(results->columns) + 1;
784 785
785 /* Setup the list model */ 786 /* Setup the list model */
786 col_types = g_new0(GType, col_num); 787 col_types = g_new0(GType, col_num);
787 788
788 /* There always is this first column. */ 789 /* There always is this first column. */
813 814
814 renderer = gtk_cell_renderer_pixbuf_new(); 815 renderer = gtk_cell_renderer_pixbuf_new();
815 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), 816 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview),
816 -1, "", renderer, "pixbuf", 0, NULL); 817 -1, "", renderer, "pixbuf", 0, NULL);
817 818
818 for (i = 1; i < col_num; i++) { 819 i = 1;
820 for (column = results->columns; column != NULL; column = column->next) {
819 renderer = gtk_cell_renderer_text_new(); 821 renderer = gtk_cell_renderer_text_new();
820 822
821 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), -1, 823 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), -1,
822 purple_notify_searchresults_column_get_title(results, i-1), 824 column->data, renderer, "text", i, NULL);
823 renderer, "text", i, NULL); 825 i++;
824 } 826 }
825 827
826 for (i = 0; i < g_list_length(results->buttons); i++) { 828 for (i = 0; i < g_list_length(results->buttons); i++) {
827 PurpleNotifySearchButton *b = g_list_nth_data(results->buttons, i); 829 PurpleNotifySearchButton *b = g_list_nth_data(results->buttons, i);
828 GtkWidget *button = NULL; 830 GtkWidget *button = NULL;

mercurial