Mercurial > pidgin
comparison src/dialogs.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 | e0afac5f85bd |
| children | 6fe8008d6560 |
comparison
equal
deleted
inserted
replaced
| 4769:e0afac5f85bd | 4770:c4c28874ecd3 |
|---|---|
| 931 static GList *groups_tree(struct gaim_connection *gc) | 931 static GList *groups_tree(struct gaim_connection *gc) |
| 932 { | 932 { |
| 933 GList *tmp = NULL; | 933 GList *tmp = NULL; |
| 934 char *tmp2; | 934 char *tmp2; |
| 935 struct group *g; | 935 struct group *g; |
| 936 GSList *grp = groups; | 936 GSList *grp = gaim_blist_groups(); |
| 937 GSList *grp1 = grp; | |
| 937 | 938 |
| 938 if (!grp) { | 939 if (!grp) { |
| 939 tmp2 = g_strdup(_("Buddies")); | 940 tmp2 = g_strdup(_("Buddies")); |
| 940 tmp = g_list_append(tmp, tmp2); | 941 tmp = g_list_append(tmp, tmp2); |
| 941 } else { | 942 } else { |
| 942 while (grp) { | 943 while (grp1) { |
| 943 g = (struct group *)grp->data; | 944 g = (struct group *)grp1->data; |
| 944 tmp2 = g->name; | 945 tmp2 = g->name; |
| 945 tmp = g_list_append(tmp, tmp2); | 946 tmp = g_list_append(tmp, tmp2); |
| 946 grp = g_slist_next(grp); | 947 grp1 = g_slist_next(grp); |
| 947 } | 948 } |
| 949 g_slist_free(grp); | |
| 948 } | 950 } |
| 949 return tmp; | 951 return tmp; |
| 950 } | 952 } |
| 951 | 953 |
| 952 static void free_dialog(GtkWidget *w, struct addbuddy *a) | 954 static void free_dialog(GtkWidget *w, struct addbuddy *a) |
| 3899 | 3901 |
| 3900 if (new_name && (strlen(new_name) != 0) && strcmp(new_name, g->name)) { | 3902 if (new_name && (strlen(new_name) != 0) && strcmp(new_name, g->name)) { |
| 3901 char *prevname; | 3903 char *prevname; |
| 3902 | 3904 |
| 3903 if ((orig = gaim_find_group(new_name)) != NULL && g_strcasecmp(new_name, g->name)) { | 3905 if ((orig = gaim_find_group(new_name)) != NULL && g_strcasecmp(new_name, g->name)) { |
| 3904 orig->members = g_slist_concat(orig->members, g->members); | |
| 3905 gaim_blist_rename_group(orig, g->name); | 3906 gaim_blist_rename_group(orig, g->name); |
| 3906 groups = g_slist_remove(groups, g); | |
| 3907 accts = gaim_group_get_accounts(g); | 3907 accts = gaim_group_get_accounts(g); |
| 3908 while(accts) { | 3908 while(accts) { |
| 3909 struct gaim_account *account = accts->data; | 3909 struct gaim_account *account = accts->data; |
| 3910 serv_rename_group(account->gc, g, new_name); | 3910 serv_rename_group(account->gc, g, new_name); |
| 3911 accts = g_slist_remove(accts, accts->data); | 3911 accts = g_slist_remove(accts, accts->data); |
| 3997 | 3997 |
| 3998 static void do_rename_buddy(GObject *obj, GtkWidget *entry) | 3998 static void do_rename_buddy(GObject *obj, GtkWidget *entry) |
| 3999 { | 3999 { |
| 4000 const char *new_name; | 4000 const char *new_name; |
| 4001 struct buddy *b; | 4001 struct buddy *b; |
| 4002 GSList *gr; | 4002 GSList *gr, *gr1; |
| 4003 | 4003 |
| 4004 new_name = gtk_entry_get_text(GTK_ENTRY(entry)); | 4004 new_name = gtk_entry_get_text(GTK_ENTRY(entry)); |
| 4005 b = g_object_get_data(obj, "buddy"); | 4005 b = g_object_get_data(obj, "buddy"); |
| 4006 | 4006 |
| 4007 if (!g_slist_find(connections, b->account->gc)) { | 4007 if (!g_slist_find(connections, b->account->gc)) { |
| 4008 destroy_dialog(rename_bud_dialog, rename_bud_dialog); | 4008 destroy_dialog(rename_bud_dialog, rename_bud_dialog); |
| 4009 return; | 4009 return; |
| 4010 } | 4010 } |
| 4011 | 4011 |
| 4012 gr = groups; | 4012 gr = gaim_blist_groups(); |
| 4013 while (gr) { | 4013 gr1 = gr; |
| 4014 if (g_slist_find(((struct group *)gr->data)->members, b)) | 4014 while (gr1) { |
| 4015 GSList *mem = gaim_blist_members((struct group*)gr->data); | |
| 4016 if (g_slist_find(mem, b)) | |
| 4015 break; | 4017 break; |
| 4016 gr = gr->next; | 4018 gr1 = gr1->next; |
| 4017 } | 4019 g_slist_free(mem); |
| 4020 } | |
| 4021 g_slist_free(gr); | |
| 4018 if (!gr) { | 4022 if (!gr) { |
| 4019 destroy_dialog(rename_bud_dialog, rename_bud_dialog); | 4023 destroy_dialog(rename_bud_dialog, rename_bud_dialog); |
| 4020 return; | 4024 return; |
| 4021 } | 4025 } |
| 4022 | 4026 |
