comparison src/buddy.c @ 4770:c4c28874ecd3

[gaim-migrate @ 5088] I want to go to sleep. This is drag-n-drop moving of buddies in the list. I think it works, but I didn't actually test it... I really should have though; I can't imagine it working fine as-is. ;) I'm holding off on the rest of my Edit Buddy List stuff for tomorrow... I love last minute things, don't I? Note: I created gaim_blist_members and gaim_blist_groups to reproduce the effects of the old groups GSList and the members GSList of the group struct that I removed. This is really sub-optimal and should be replaced to iterate the Buddy List directly. If someone wants to do that, please do. Even if you don't want to do that, just review the changes I made and make sure I didn't do anything stupid. It is past 6am and I'm a bit tired and prone to mistake making. Thanks. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Fri, 14 Mar 2003 11:38:21 +0000
parents f6d83e81d45a
children 75f0c2799664
comparison
equal deleted inserted replaced
4769:e0afac5f85bd 4770:c4c28874ecd3
343 GtkTreePath *path = NULL; 343 GtkTreePath *path = NULL;
344 GtkTreeViewDropPosition position; 344 GtkTreeViewDropPosition position;
345 memcpy(&b, sd->data, sizeof(b)); 345 memcpy(&b, sd->data, sizeof(b));
346 if(gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), x, y, &path, &position)) { 346 if(gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), x, y, &path, &position)) {
347 /* if we're here, I think it means the drop is ok */ 347 /* if we're here, I think it means the drop is ok */
348 GtkTreeIter iter;
349 GaimBlistNode *node;
350 GValue val = {0};
351 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
352 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val);
353 node = g_value_get_pointer(&val);
354 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
355 if (position == GTK_TREE_VIEW_DROP_AFTER) {
356 gaim_blist_add_buddy(b, node->parent, node);
357 } else if (position == GTK_TREE_VIEW_DROP_BEFORE) {
358 gaim_blist_add_buddy(b, node->parent, node->prev);
359 }
360 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
361 gaim_blist_add_buddy(b, node, NULL);
362 }
348 gtk_tree_path_free(path); 363 gtk_tree_path_free(path);
349 } 364 }
350 } 365 }
351 } 366 }
352 367
1212 } 1227 }
1213 } 1228 }
1214 1229
1215 static void gaim_gtk_blist_destroy(struct gaim_buddy_list *list) 1230 static void gaim_gtk_blist_destroy(struct gaim_buddy_list *list)
1216 { 1231 {
1232 if (!gtkblist)
1233 return;
1217 gtk_widget_destroy(gtkblist->window); 1234 gtk_widget_destroy(gtkblist->window);
1218 1235
1219 gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL; 1236 gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL;
1220 gtkblist->treemodel = NULL; 1237 gtkblist->treemodel = NULL;
1221 gtkblist->idle_column = NULL; 1238 gtkblist->idle_column = NULL;