Mercurial > pidgin.yaz
comparison src/dialogs.c @ 4785:1e28e7d802a1
[gaim-migrate @ 5105]
fix a few things, get rid of a few stale functions, and get rid of the
compatibility functions. wee!
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sat, 15 Mar 2003 03:23:30 +0000 |
parents | 66be56dc86cb |
children | 5939d3d13ab3 |
comparison
equal
deleted
inserted
replaced
4784:b1365291f002 | 4785:1e28e7d802a1 |
---|---|
933 static GList *groups_tree(struct gaim_connection *gc) | 933 static GList *groups_tree(struct gaim_connection *gc) |
934 { | 934 { |
935 GList *tmp = NULL; | 935 GList *tmp = NULL; |
936 char *tmp2; | 936 char *tmp2; |
937 struct group *g; | 937 struct group *g; |
938 GSList *grp = gaim_blist_groups(); | 938 |
939 GSList *grp1 = grp; | 939 GaimBlistNode *gnode = gaim_get_blist()->root; |
940 | 940 |
941 if (!grp) { | 941 if (!gnode) { |
942 tmp2 = g_strdup(_("Buddies")); | 942 tmp2 = g_strdup(_("Buddies")); |
943 tmp = g_list_append(tmp, tmp2); | 943 tmp = g_list_append(tmp, tmp2); |
944 } else { | 944 } else { |
945 while (grp1) { | 945 while (gnode) { |
946 g = (struct group *)grp1->data; | 946 if(GAIM_BLIST_NODE_IS_GROUP(gnode)) { |
947 tmp2 = g->name; | 947 g = (struct group *)gnode; |
948 tmp = g_list_append(tmp, tmp2); | 948 tmp2 = g->name; |
949 grp1 = g_slist_next(grp1); | 949 tmp = g_list_append(tmp, tmp2); |
950 } | |
951 gnode = gnode->next; | |
950 } | 952 } |
951 g_slist_free(grp); | |
952 } | 953 } |
953 return tmp; | 954 return tmp; |
954 } | 955 } |
955 | 956 |
956 static void free_dialog(GtkWidget *w, struct addbuddy *a) | 957 static void free_dialog(GtkWidget *w, struct addbuddy *a) |
3995 | 3996 |
3996 static void do_rename_buddy(GObject *obj, GtkWidget *entry) | 3997 static void do_rename_buddy(GObject *obj, GtkWidget *entry) |
3997 { | 3998 { |
3998 const char *new_name; | 3999 const char *new_name; |
3999 struct buddy *b; | 4000 struct buddy *b; |
4000 GSList *gr, *gr1; | |
4001 | 4001 |
4002 new_name = gtk_entry_get_text(GTK_ENTRY(entry)); | 4002 new_name = gtk_entry_get_text(GTK_ENTRY(entry)); |
4003 b = g_object_get_data(obj, "buddy"); | 4003 b = g_object_get_data(obj, "buddy"); |
4004 | 4004 |
4005 if (!g_slist_find(connections, b->account->gc)) { | 4005 if (!g_slist_find(connections, b->account->gc)) { |
4006 destroy_dialog(rename_bud_dialog, rename_bud_dialog); | 4006 destroy_dialog(rename_bud_dialog, rename_bud_dialog); |
4007 return; | 4007 return; |
4008 } | 4008 } |
4009 | 4009 |
4010 gr = gaim_blist_groups(); | |
4011 gr1 = gr; | |
4012 while (gr1) { | |
4013 GSList *mem = gaim_blist_members((struct group*)gr->data); | |
4014 if (g_slist_find(mem, b)) | |
4015 break; | |
4016 gr1 = gr1->next; | |
4017 g_slist_free(mem); | |
4018 } | |
4019 g_slist_free(gr); | |
4020 if (!gr) { | |
4021 destroy_dialog(rename_bud_dialog, rename_bud_dialog); | |
4022 return; | |
4023 } | |
4024 | |
4025 if (new_name && (strlen(new_name) != 0) && strcmp(new_name, b->name)) { | 4010 if (new_name && (strlen(new_name) != 0) && strcmp(new_name, b->name)) { |
4026 struct group *g = gaim_find_buddys_group(b); | 4011 struct group *g = gaim_find_buddys_group(b); |
4027 char *prevname = g_strdup(b->name); | 4012 char *prevname = b->name; |
4028 if (g) | 4013 if (g) |
4029 serv_remove_buddy(b->account->gc, b->name, g->name); | 4014 serv_remove_buddy(b->account->gc, b->name, g->name); |
4030 g_snprintf(b->name, sizeof(b->name), "%s", new_name); | 4015 b->name = g_strdup(new_name); |
4031 serv_add_buddy(b->account->gc, b->name); | 4016 serv_add_buddy(b->account->gc, b->name); |
4032 gaim_blist_rename_buddy(b, prevname); | 4017 gaim_blist_rename_buddy(b, prevname); |
4033 gaim_blist_save(); | 4018 gaim_blist_save(); |
4034 g_free(prevname); | 4019 g_free(prevname); |
4035 } | 4020 } |