comparison console/libgnt/gnttree.c @ 14977:e601bc7880a6

[gaim-migrate @ 17756] Make it easy to move buddies around. Press 't' in the buddylist to tag/untag buddies/contacts (more than one if necessary). Then select the target contact or group and press 'a' to attach the tagged nodes. This should also fix LSchiere's earlier crash, if the bug I thought I was seeing. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 16 Nov 2006 00:27:30 +0000
parents 065e7ac30338
children 34e049e6ce10
comparison
equal deleted inserted replaced
14976:1c0772f7260b 14977:e601bc7880a6
1056 } 1056 }
1057 1057
1058 return list; 1058 return list;
1059 } 1059 }
1060 1060
1061 /* XXX: Should this also remove all the children of the row being removed? */
1062 void gnt_tree_remove(GntTree *tree, gpointer key) 1061 void gnt_tree_remove(GntTree *tree, gpointer key)
1063 { 1062 {
1064 GntTreeRow *row = g_hash_table_lookup(tree->hash, key); 1063 GntTreeRow *row = g_hash_table_lookup(tree->hash, key);
1065 if (row) 1064 if (row)
1066 { 1065 {
1067 gboolean redraw = FALSE; 1066 gboolean redraw = FALSE;
1067
1068 if (row->child) {
1069 GntTreeRow *ch = row->child;
1070 while (ch) {
1071 GntTreeRow *n = ch->next;
1072 tree->list = g_list_remove(tree->list, ch->key);
1073 g_hash_table_remove(tree->hash, ch->key);
1074 ch = n;
1075 }
1076 }
1068 1077
1069 if (get_distance(tree->top, row) >= 0 && get_distance(row, tree->bottom) >= 0) 1078 if (get_distance(tree->top, row) >= 0 && get_distance(row, tree->bottom) >= 0)
1070 redraw = TRUE; 1079 redraw = TRUE;
1071 1080
1072 /* Update root/top/current/bottom if necessary */ 1081 /* Update root/top/current/bottom if necessary */
1144 { 1153 {
1145 col = g_list_nth_data(row->columns, colno); 1154 col = g_list_nth_data(row->columns, colno);
1146 g_free(col->text); 1155 g_free(col->text);
1147 col->text = g_strdup(text); 1156 col->text = g_strdup(text);
1148 1157
1149 if (get_distance(tree->top, row) >= 0 && get_distance(row, tree->bottom) > 0) 1158 if (get_distance(tree->top, row) >= 0 && get_distance(row, tree->bottom) >= 0)
1150 redraw_tree(tree); 1159 redraw_tree(tree);
1151 } 1160 }
1152 } 1161 }
1153 1162
1154 GntTreeRow *gnt_tree_add_choice(GntTree *tree, void *key, GntTreeRow *row, void *parent, void *bigbro) 1163 GntTreeRow *gnt_tree_add_choice(GntTree *tree, void *key, GntTreeRow *row, void *parent, void *bigbro)