# HG changeset patch # User Eric Warmenhoven # Date 979033021 0 # Node ID d2799e0672ee381065f7a92fe821ffe0bbc8ef27 # Parent df7c3cacac927330947b20d3c2408049ba4a18aa [gaim-migrate @ 1407] there. this should fix things committer: Tailor Script diff -r df7c3cacac92 -r d2799e0672ee src/buddy.c --- a/src/buddy.c Tue Jan 09 09:16:19 2001 +0000 +++ b/src/buddy.c Tue Jan 09 09:37:01 2001 +0000 @@ -380,9 +380,14 @@ } } -void pressed_alias(GtkWidget *widget, struct buddy_show *b) +void pressed_alias_bs(GtkWidget *widget, struct buddy_show *b) { - alias_dialog(b); + alias_dialog_bs(b); +} + +void pressed_alias_bud(GtkWidget *widget, struct buddy *b) +{ + alias_dialog_bud(b); } void handle_click_buddy(GtkWidget *widget, GdkEventButton *event, struct buddy_show *b) @@ -423,7 +428,7 @@ button = gtk_menu_item_new_with_label(_("Alias")); gtk_signal_connect(GTK_OBJECT(button), "activate", - GTK_SIGNAL_FUNC(pressed_alias), b); + GTK_SIGNAL_FUNC(pressed_alias_bs), b); gtk_menu_append(GTK_MENU(menu), button); gtk_widget_show(button); @@ -478,7 +483,7 @@ { struct group *g = find_group_by_buddy(b->gc, b->name); struct group_show *gs = find_group_show(g->name); - struct buddy_show *bs; + struct buddy_show *bs = NULL; GtkCTreeNode *node = gtk_ctree_find_by_row_data(GTK_CTREE(edittree), NULL, b); g_snprintf(b->show, sizeof(b->show), "%s", b->name); gtk_ctree_node_set_text(GTK_CTREE(edittree), node, 0, b->name); @@ -520,14 +525,11 @@ event->button, event->time); } else if (*type == EDIT_BUDDY) { struct buddy *b = (struct buddy *)type; - struct group *g = find_group_by_buddy(b->gc, b->name); - struct group_show *gs = find_group_show(g->name); - struct buddy_show *bs = find_buddy_show(gs, b->name); menu = gtk_menu_new(); button = gtk_menu_item_new_with_label(_("Alias")); gtk_signal_connect(GTK_OBJECT(button), "activate", - GTK_SIGNAL_FUNC(pressed_alias), bs); + GTK_SIGNAL_FUNC(pressed_alias_bud), b); gtk_menu_append(GTK_MENU(menu), button); gtk_widget_show(button); diff -r df7c3cacac92 -r d2799e0672ee src/dialogs.c --- a/src/dialogs.c Tue Jan 09 09:16:19 2001 +0000 +++ b/src/dialogs.c Tue Jan 09 09:37:01 2001 +0000 @@ -3413,7 +3413,7 @@ return; } -static void do_alias(GtkWidget *w, struct buddy_show *b) +static void do_alias_bs(GtkWidget *w, struct buddy_show *b) { GSList *c = b->connlist; struct gaim_connection *g; @@ -3432,7 +3432,7 @@ build_edit_tree(); } -void alias_dialog(struct buddy_show *b) +void alias_dialog_bs(struct buddy_show *b) { GtkWidget *frame; GtkWidget *vbox; @@ -3443,17 +3443,8 @@ GtkWidget *topbox; static int a, c; - if (aliasdlg) { - gtk_entry_set_text(GTK_ENTRY(aliasentry), b->name); - gtk_widget_show(aliasdlg); - gtk_signal_disconnect(GTK_OBJECT(add), a); - gtk_signal_disconnect(GTK_OBJECT(aliasname), c); - a = gtk_signal_connect(GTK_OBJECT(add), "clicked", - GTK_SIGNAL_FUNC(do_alias), b); - c = gtk_signal_connect(GTK_OBJECT(aliasname), "activate", - GTK_SIGNAL_FUNC(do_alias), b); - return; - } + if (aliasdlg) + gtk_widget_destroy(aliasdlg); aliasdlg = gtk_window_new(GTK_WINDOW_DIALOG); gtk_window_set_policy(GTK_WINDOW(aliasdlg), FALSE, FALSE, TRUE); @@ -3502,9 +3493,9 @@ gtk_signal_connect(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(destroy_dialog), aliasdlg); a = gtk_signal_connect(GTK_OBJECT(add), "clicked", - GTK_SIGNAL_FUNC(do_alias), b); + GTK_SIGNAL_FUNC(do_alias_bs), b); c = gtk_signal_connect(GTK_OBJECT(aliasname), "activate", - GTK_SIGNAL_FUNC(do_alias), b); + GTK_SIGNAL_FUNC(do_alias_bs), b); /* Finish up */ gtk_widget_show(add); gtk_widget_show(cancel); @@ -3524,3 +3515,95 @@ gtk_widget_show(aliasdlg); } + +static void do_alias_bud(GtkWidget *w, struct buddy *b) +{ + g_snprintf(b->show, sizeof(b->show), "%s", gtk_entry_get_text(GTK_ENTRY(aliasname))); + do_export(0, 0); + destroy_dialog(aliasdlg, aliasdlg); + build_edit_tree(); +} + +void alias_dialog_bud(struct buddy *b) +{ + GtkWidget *frame; + GtkWidget *vbox; + GtkWidget *bbox; + GtkWidget *cancel; + static GtkWidget *add = NULL; + GtkWidget *label; + GtkWidget *topbox; + static int a, c; + + if (aliasdlg) + gtk_widget_destroy(aliasdlg); + + aliasdlg = gtk_window_new(GTK_WINDOW_DIALOG); + gtk_window_set_policy(GTK_WINDOW(aliasdlg), FALSE, FALSE, TRUE); + gtk_window_set_wmclass(GTK_WINDOW(aliasdlg), "alias_dialog", "Gaim"); + gtk_widget_realize(aliasdlg); + dialogwindows = g_list_prepend(dialogwindows, aliasdlg); + + bbox = gtk_hbox_new(TRUE, 10); + topbox = gtk_hbox_new(FALSE, 5); + vbox = gtk_vbox_new(FALSE, 5); + + aliasentry = gtk_entry_new(); + aliasname = gtk_entry_new(); + /* Put the buttons in the box */ + + add = picture_button(aliasdlg, _("Alias"), add_xpm); + + cancel = picture_button(aliasdlg, _("Cancel"), cancel_xpm); + + gtk_box_pack_start(GTK_BOX(bbox), add, FALSE, FALSE, 5); + gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 5); + + frame = gtk_frame_new(NULL); + gtk_frame_set_label(GTK_FRAME(frame), _("Alias Buddy")); + + label = gtk_label_new(_("Buddy")); + gtk_widget_show(label); + gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5); + gtk_box_pack_start(GTK_BOX(topbox), aliasentry, FALSE, FALSE, 5); + gtk_entry_set_editable(GTK_ENTRY(aliasentry), FALSE); + label = gtk_label_new(_("Alias")); + gtk_widget_show(label); + gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5); + gtk_box_pack_start(GTK_BOX(topbox), aliasname, FALSE, FALSE, 5); + + gtk_entry_set_text(GTK_ENTRY(aliasentry), b->name); + gtk_entry_set_text(GTK_ENTRY(aliasname), b->show); + + /* And the boxes in the box */ + gtk_box_pack_start(GTK_BOX(vbox), topbox, TRUE, TRUE, 5); + gtk_box_pack_start(GTK_BOX(vbox), bbox, TRUE, TRUE, 5); + + /* Handle closes right */ + gtk_signal_connect(GTK_OBJECT(aliasdlg), "destroy", + GTK_SIGNAL_FUNC(destroy_dialog), aliasdlg); + gtk_signal_connect(GTK_OBJECT(cancel), "clicked", + GTK_SIGNAL_FUNC(destroy_dialog), aliasdlg); + a = gtk_signal_connect(GTK_OBJECT(add), "clicked", + GTK_SIGNAL_FUNC(do_alias_bud), b); + c = gtk_signal_connect(GTK_OBJECT(aliasname), "activate", + GTK_SIGNAL_FUNC(do_alias_bud), b); + /* Finish up */ + gtk_widget_show(add); + gtk_widget_show(cancel); + gtk_widget_show(aliasentry); + gtk_widget_show(aliasname); + gtk_widget_show(topbox); + gtk_widget_show(bbox); + gtk_widget_show(vbox); + gtk_widget_show(frame); + gtk_window_set_title(GTK_WINDOW(aliasdlg), _("Gaim - Alias Buddy")); + gtk_window_set_focus(GTK_WINDOW(aliasdlg), aliasentry); + gtk_container_add(GTK_CONTAINER(frame), vbox); + gtk_container_add(GTK_CONTAINER(aliasdlg), frame); + gtk_container_set_border_width(GTK_CONTAINER(aliasdlg), 5); + gtk_widget_realize(aliasdlg); + aol_icon(aliasdlg->window); + + gtk_widget_show(aliasdlg); +}