comparison console/libgnt/gnttree.c @ 13979:a71678d2da16

[gaim-migrate @ 16540] Complete the notify-ui. I have been unable to test the searchresult-ui. But "looks like" it will work. The accounts-ui is also mostly . I am yet to add the proxy-options. And you cannot still delete an account. That will happen after the request-ui is complete. The account-edit dialog needs some work, but it's usable. Added GntCheckBox, and add some features to some other gnt-widgets. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 23 Jul 2006 01:10:06 +0000
parents df8183b7fa2c
children 7573bd40a190
comparison
equal deleted inserted replaced
13978:ea00953490a8 13979:a71678d2da16
276 { 276 {
277 mvwprintw(widget->window, pos, x + i, tree->columns[i].title); 277 mvwprintw(widget->window, pos, x + i, tree->columns[i].title);
278 x += tree->columns[i].width; 278 x += tree->columns[i].width;
279 } 279 }
280 if (pos) 280 if (pos)
281 {
281 tree_mark_columns(tree, pos, 0, ACS_TTEE | COLOR_PAIR(GNT_COLOR_NORMAL)); 282 tree_mark_columns(tree, pos, 0, ACS_TTEE | COLOR_PAIR(GNT_COLOR_NORMAL));
283 tree_mark_columns(tree, pos, widget->priv.height - pos,
284 ACS_BTEE | COLOR_PAIR(GNT_COLOR_NORMAL));
285 }
282 tree_mark_columns(tree, pos, pos + 1, ACS_PLUS | COLOR_PAIR(GNT_COLOR_NORMAL)); 286 tree_mark_columns(tree, pos, pos + 1, ACS_PLUS | COLOR_PAIR(GNT_COLOR_NORMAL));
283 tree_mark_columns(tree, pos, pos, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL)); 287 tree_mark_columns(tree, pos, pos, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL));
284 start = 2; 288 start = 2;
285 } 289 }
286 290
689 } 693 }
690 694
691 char *gnt_tree_get_selection_text(GntTree *tree) 695 char *gnt_tree_get_selection_text(GntTree *tree)
692 { 696 {
693 if (tree->current) 697 if (tree->current)
694 update_row_text(tree, tree->current); 698 return update_row_text(tree, tree->current);
695 return NULL; 699 return NULL;
700 }
701
702 GList *gnt_tree_get_selection_text_list(GntTree *tree)
703 {
704 GList *list = NULL, *iter;
705 int i;
706
707 if (!tree->current)
708 return NULL;
709
710 for (i = 0, iter = tree->current->columns; i < tree->ncol && iter;
711 i++, iter = iter->next)
712 {
713 GntTreeCol *col = iter->data;
714 list = g_list_append(list, g_strdup(col->text));
715 }
716
717 return list;
696 } 718 }
697 719
698 /* XXX: Should this also remove all the children of the row being removed? */ 720 /* XXX: Should this also remove all the children of the row being removed? */
699 void gnt_tree_remove(GntTree *tree, gpointer key) 721 void gnt_tree_remove(GntTree *tree, gpointer key)
700 { 722 {
857 gnt_widget_set_take_focus(widget, TRUE); 879 gnt_widget_set_take_focus(widget, TRUE);
858 880
859 return widget; 881 return widget;
860 } 882 }
861 883
884 GntTreeRow *gnt_tree_create_row_from_list(GntTree *tree, GList *list)
885 {
886 GList *iter;
887 int i;
888 GntTreeRow *row = g_new0(GntTreeRow, 1);
889
890 for (i = 0, iter = list; i < tree->ncol && iter; iter = iter->next, i++)
891 {
892 GntTreeCol *col = g_new0(GntTreeCol, 1);
893 col->span = 1;
894 col->text = g_strdup(iter->data);
895
896 row->columns = g_list_append(row->columns, col);
897 }
898
899 return row;
900 }
901
862 GntTreeRow *gnt_tree_create_row(GntTree *tree, ...) 902 GntTreeRow *gnt_tree_create_row(GntTree *tree, ...)
863 { 903 {
864 GntTreeRow *row = g_new0(GntTreeRow, 1);
865 int i; 904 int i;
866 va_list args; 905 va_list args;
906 GList *list = NULL;
907 GntTreeRow *row;
867 908
868 va_start(args, tree); 909 va_start(args, tree);
869
870 for (i = 0; i < tree->ncol; i++) 910 for (i = 0; i < tree->ncol; i++)
871 { 911 {
872 GntTreeCol *col = g_new0(GntTreeCol, 1); 912 list = g_list_append(list, va_arg(args, const char *));
873 col->span = 1;
874 col->text = g_strdup(va_arg(args, const char *));
875
876 row->columns = g_list_append(row->columns, col);
877 } 913 }
878 va_end(args); 914 va_end(args);
915
916 row = gnt_tree_create_row_from_list(tree, list);
917 g_list_free(list);
879 918
880 return row; 919 return row;
881 } 920 }
882 921
883 void gnt_tree_set_col_width(GntTree *tree, int col, int width) 922 void gnt_tree_set_col_width(GntTree *tree, int col, int width)