Mercurial > pidgin.yaz
changeset 1748:2eec724fdbcd
[gaim-migrate @ 1758]
bugfixes for group rename.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 25 Apr 2001 08:17:38 +0000 |
parents | 0763e0d4addd |
children | 5bfc58c20e82 |
files | src/buddy.c src/dialogs.c |
diffstat | 2 files changed, 15 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/buddy.c Wed Apr 25 06:32:00 2001 +0000 +++ b/src/buddy.c Wed Apr 25 08:17:38 2001 +0000 @@ -185,6 +185,7 @@ } else { update_num_group(gs); } + update_num_group(new_gs); } else { /* two possible actions: if gs contains things that are only from g, * just rename gs and fix the label. otherwise, move everything in g
--- a/src/dialogs.c Wed Apr 25 06:32:00 2001 +0000 +++ b/src/dialogs.c Wed Apr 25 08:17:38 2001 +0000 @@ -3787,15 +3787,25 @@ { char *new_name; struct group *g; + struct group *orig; new_name = gtk_entry_get_text(GTK_ENTRY(entry)); g = gtk_object_get_user_data(obj); if (new_name && (strlen(new_name) != 0) && strcmp(new_name, g->name)) { - char *prevname = g_strdup(g->name); - g_snprintf(g->name, sizeof(g->name), "%s", new_name); - handle_group_rename(g, prevname); - g_free(prevname); + char *prevname; + if ((orig = find_group(g->gc, new_name)) != NULL) { + orig->members = g_slist_concat(orig->members, g->members); + handle_group_rename(orig, g->name); + g->gc->groups = g_slist_remove(g->gc->groups, g); + /* FIXME, i don't like calling this. it's sloppy. */ build_edit_tree(); + g_free(g); + } else { + prevname = g_strdup(g->name); + g_snprintf(g->name, sizeof(g->name), "%s", new_name); + handle_group_rename(g, prevname); + g_free(prevname); + } do_export(0, 0); }