Mercurial > pidgin
changeset 1499:de0b946e86a4
[gaim-migrate @ 1509]
woohoo, i'm back.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 23 Feb 2001 23:58:35 +0000 |
parents | 0ef6603d986e |
children | a054c28735fb |
files | plugins/icq/gaim_icq.c plugins/irc.c plugins/jabber/jabber.c plugins/msn/msn.c plugins/napster.c plugins/yay/yay.c src/applet.h src/away.c src/buddy.c src/dialogs.c src/gaim.h src/multi.c src/oscar.c src/prpl.c src/prpl.h src/toc.c |
diffstat | 16 files changed, 315 insertions(+), 245 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/icq/gaim_icq.c Thu Feb 22 23:07:34 2001 +0000 +++ b/plugins/icq/gaim_icq.c Fri Feb 23 23:58:35 2001 +0000 @@ -382,7 +382,7 @@ serv_get_info(gtk_object_get_user_data(obj), who); } -static void icq_action_menu(GtkWidget *menu, struct gaim_connection *gc, char *who) { +static void icq_buddy_menu(GtkWidget *menu, struct gaim_connection *gc, char *who) { GtkWidget *button; button = gtk_menu_item_new_with_label(_("Get Info")); @@ -459,7 +459,7 @@ ret->name = icq_name; ret->list_icon = icq_list_icon; ret->away_states = icq_away_states; - ret->action_menu = icq_action_menu; + ret->buddy_menu = icq_buddy_menu; ret->user_opts = icq_user_opts; ret->login = icq_login; ret->close = icq_close;
--- a/plugins/irc.c Thu Feb 22 23:07:34 2001 +0000 +++ b/plugins/irc.c Fri Feb 23 23:58:35 2001 +0000 @@ -1098,7 +1098,7 @@ } -static void irc_action_menu(GtkWidget * menu, struct gaim_connection *gc, char *who) +static void irc_buddy_menu(GtkWidget * menu, struct gaim_connection *gc, char *who) { GtkWidget *button; @@ -1117,7 +1117,7 @@ ret->protocol = PROTO_IRC; ret->name = irc_name; ret->list_icon = irc_list_icon; - ret->action_menu = irc_action_menu; + ret->buddy_menu = irc_buddy_menu; ret->user_opts = irc_user_opts; ret->login = irc_login; ret->close = irc_close;
--- a/plugins/jabber/jabber.c Thu Feb 22 23:07:34 2001 +0000 +++ b/plugins/jabber/jabber.c Fri Feb 23 23:58:35 2001 +0000 @@ -1087,7 +1087,7 @@ ret->protocol = PROTO_JABBER; ret->name = jabber_name; ret->list_icon = jabber_list_icon; - ret->action_menu = NULL; + ret->buddy_menu = NULL; ret->user_opts = NULL; ret->draw_new_user = NULL; ret->do_new_user = NULL;
--- a/plugins/msn/msn.c Thu Feb 22 23:07:34 2001 +0000 +++ b/plugins/msn/msn.c Fri Feb 23 23:58:35 2001 +0000 @@ -848,7 +848,7 @@ ret->protocol = PROTO_MSN; ret->name = msn_name; ret->list_icon = msn_list_icon; - ret->action_menu = NULL; + ret->buddy_menu = NULL; ret->user_opts = NULL; ret->login = msn_login; ret->close = msn_close;
--- a/plugins/napster.c Thu Feb 22 23:07:34 2001 +0000 +++ b/plugins/napster.c Fri Feb 23 23:58:35 2001 +0000 @@ -1176,7 +1176,7 @@ gtk_widget_show(search_dialog->window); } -static void nap_action_menu(GtkWidget *menu, struct gaim_connection *gc, char *who) +static void nap_buddy_menu(GtkWidget *menu, struct gaim_connection *gc, char *who) { GtkWidget *button; @@ -1205,7 +1205,7 @@ ret->protocol = PROTO_NAPSTER; ret->name = nap_name; ret->list_icon = nap_list_icon; - ret->action_menu = nap_action_menu; + ret->buddy_menu = nap_buddy_menu; ret->user_opts = NULL; ret->login = nap_login; ret->close = nap_close;
--- a/plugins/yay/yay.c Thu Feb 22 23:07:34 2001 +0000 +++ b/plugins/yay/yay.c Fri Feb 23 23:58:35 2001 +0000 @@ -472,7 +472,7 @@ return status_away_xpm; } -static void yahoo_action_menu(GtkWidget *menu, struct gaim_connection *gc, char *who) { +static void yahoo_buddy_menu(GtkWidget *menu, struct gaim_connection *gc, char *who) { struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; GtkWidget *button; struct buddy *b = find_buddy(gc, who); /* this should never be null. if it is, @@ -519,7 +519,7 @@ ret->name = yahoo_name; ret->list_icon = yahoo_list_icon; ret->away_states = yahoo_away_states; - ret->action_menu = yahoo_action_menu; + ret->buddy_menu = yahoo_buddy_menu; ret->user_opts = NULL; ret->login = yahoo_login; ret->close = yahoo_close;
--- a/src/applet.h Thu Feb 22 23:07:34 2001 +0000 +++ b/src/applet.h Fri Feb 23 23:58:35 2001 +0000 @@ -51,7 +51,7 @@ #define _MSG_OFFLINE_ "Offline" #define _MSG_CONNECT_ "Connecting" #define _MSG_ONLINE_ "Online" -#define _MSG_FONT_ "-adobe-helvetica-medium-r-normal-*-*-80-*-*-p-*-iso8859-1" +#define _MSG_FONT_ "-*-helvetica-medium-r-*-*-*-80-*-*-*-*-*-*" #define GAIM_GNOME_DEVIL_OFFLINE "gaim/gnome/devil-offline.png" #define GAIM_GNOME_DEVIL_CONNECT "gaim/gnome/devil-connect.png"
--- a/src/away.c Thu Feb 22 23:07:34 2001 +0000 +++ b/src/away.c Fri Feb 23 23:58:35 2001 +0000 @@ -361,6 +361,8 @@ } msgs = g_list_next(msgs); } + + g_list_free(tmp); } else { while (con) { char buf[256];
--- a/src/buddy.c Thu Feb 22 23:07:34 2001 +0000 +++ b/src/buddy.c Fri Feb 23 23:58:35 2001 +0000 @@ -286,6 +286,7 @@ serv_close(gc); redo_buddy_list(); do_away_menu(); + do_proto_menu(); #ifdef USE_APPLET if (connections) set_user_state(online); @@ -454,7 +455,7 @@ if (g_slist_length(cn) > 1) { while (cn) { g = (struct gaim_connection *)cn->data; - if (g->prpl->action_menu) { + if (g->prpl->buddy_menu) { menuitem = gtk_menu_item_new_with_label(g->username); gtk_menu_append(GTK_MENU(menu), menuitem); gtk_widget_show(menuitem); @@ -463,14 +464,14 @@ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), conmenu); gtk_widget_show(conmenu); - (*g->prpl->action_menu)(conmenu, g, b->name); + (*g->prpl->buddy_menu)(conmenu, g, b->name); } cn = g_slist_next(cn); } } else { g = (struct gaim_connection *)cn->data; - if (g->prpl->action_menu) - (*g->prpl->action_menu)(menu, g, b->name); + if (g->prpl->buddy_menu) + (*g->prpl->buddy_menu)(menu, g, b->name); } gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, @@ -2069,7 +2070,7 @@ * *******************************************************************/ -void gaim_seperator(GtkWidget *menu) +void gaim_separator(GtkWidget *menu) { GtkWidget *sep, *menuitem; sep = gtk_hseparator_new(); @@ -2197,11 +2198,13 @@ GtkWidget *sw; GtkWidget *menu; - GtkWidget *findmenu; #ifdef USE_PERL GtkWidget *perlmenu; #endif +#ifdef NO_MULTI GtkWidget *setmenu; + GtkWidget *findmenu; +#endif GtkWidget *menubar; GtkWidget *vbox; GtkWidget *menuitem; @@ -2242,10 +2245,10 @@ gaim_new_item_with_pixmap(menu, _("Add A Buddy"), add_small_xpm, GTK_SIGNAL_FUNC(add_buddy_callback)); gaim_new_item_with_pixmap(menu, _("Join A Chat"), pounce_small_xpm, GTK_SIGNAL_FUNC(chat_callback)); gaim_new_item_with_pixmap(menu, _("New Instant Message"), send_small_xpm, GTK_SIGNAL_FUNC(show_im_dialog)); - gaim_seperator(menu); + gaim_separator(menu); gaim_new_item_with_pixmap(menu, _("Import Buddy List"), import_small_xpm, GTK_SIGNAL_FUNC(import_callback)); gaim_new_item_with_pixmap(menu, _("Export Buddy List"), export_small_xpm,GTK_SIGNAL_FUNC(export_callback)); - gaim_seperator(menu); + gaim_separator(menu); gaim_new_item_with_pixmap(menu, _("Signoff"), logout_icon_xpm, GTK_SIGNAL_FUNC(signoff_all)); #ifndef USE_APPLET @@ -2270,8 +2273,9 @@ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), bpmenu); do_bp_menu(); - gaim_seperator(menu); - + gaim_separator(menu); + +#ifdef NO_MULTI findmenu = gtk_menu_new(); gtk_widget_show(findmenu); menuitem = gaim_new_item_with_pixmap(menu, _("Search for Buddy"), search_small_xpm, NULL); @@ -2304,13 +2308,19 @@ gtk_menu_append(GTK_MENU(setmenu), menuitem); gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_change_passwd), NULL); gtk_widget_show(menuitem); -#ifndef NO_MULTI +#else gaim_new_item_with_pixmap(menu, _("Accounts"), add_small_xpm, GTK_SIGNAL_FUNC(account_editor)); + + protomenu = gtk_menu_new(); + menuitem = gaim_new_item_with_pixmap(menu, _("Protocol Actions"), prefs_small_xpm, NULL); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), protomenu); + do_proto_menu(); #endif - gaim_seperator(menu); gaim_new_item_with_pixmap(menu, _("Preferences"), prefs_small_xpm, GTK_SIGNAL_FUNC(show_prefs)); + gaim_separator(menu); + #ifdef GAIM_PLUGINS gaim_new_item_with_pixmap(menu, _("Plugins"), plugins_small_xpm, GTK_SIGNAL_FUNC(show_plugins)); #endif
--- a/src/dialogs.c Thu Feb 22 23:07:34 2001 +0000 +++ b/src/dialogs.c Fri Feb 23 23:58:35 2001 +0000 @@ -171,6 +171,7 @@ }; struct set_dir_dlg { + struct gaim_connection *gc; GtkWidget *window; GtkWidget *first; GtkWidget *middle; @@ -1286,16 +1287,13 @@ char *state = gtk_entry_get_text(GTK_ENTRY(b->state)); char *country = gtk_entry_get_text(GTK_ENTRY(b->country)); - - /* FIXME : set dir. not important */ - if (connections) - serv_set_dir(connections->data, first, middle, last, maiden, city, state, country, web); + serv_set_dir(b->gc, first, middle, last, maiden, city, state, country, web); destroy_dialog(NULL, b->window); g_free(b); } -void show_set_dir() +void show_set_dir(struct gaim_connection *gc) { GtkWidget *label; GtkWidget *bot; @@ -1303,35 +1301,41 @@ GtkWidget *hbox; GtkWidget *frame; GtkWidget *fbox; + char buf[256]; struct set_dir_dlg *b = g_new0(struct set_dir_dlg, 1); + if (!g_slist_find(connections, gc)) + gc = connections->data; + b->gc = gc; b->window = gtk_window_new(GTK_WINDOW_DIALOG); - //gtk_widget_set_usize(b->window, 300, 300); + dialogwindows = g_list_prepend(dialogwindows, b->window); gtk_window_set_wmclass(GTK_WINDOW(b->window), "set_dir", "Gaim"); gtk_window_set_policy(GTK_WINDOW(b->window), FALSE, TRUE, TRUE); - gtk_widget_show(b->window); - - dialogwindows = g_list_prepend(dialogwindows, b->window); + gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Set Dir Info")); + gtk_signal_connect(GTK_OBJECT(b->window), "destroy", + GTK_SIGNAL_FUNC(destroy_dialog), b->window); + gtk_widget_realize(b->window); + aol_icon(b->window->window); + + fbox = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(b->window), fbox); + gtk_widget_show(fbox); + + frame = gtk_frame_new(_("Directory Info")); + gtk_container_set_border_width(GTK_CONTAINER(fbox), 5); + gtk_box_pack_start(GTK_BOX(fbox), frame, FALSE, FALSE, 0); + gtk_widget_show(frame); vbox = gtk_vbox_new(FALSE, 5); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); - - frame = gtk_frame_new(_("Directory Info")); - fbox = gtk_vbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(fbox), 5); - - /* Build Save Button */ - - b->save = picture_button(b->window, _("Save"), save_xpm); - b->cancel = picture_button(b->window, _("Cancel"), cancel_xpm); - - bot = gtk_hbox_new(FALSE, 5); - - gtk_box_pack_end(GTK_BOX(bot), b->cancel, FALSE, FALSE, 0); - gtk_box_pack_end(GTK_BOX(bot), b->save, FALSE, FALSE, 0); - - gtk_widget_show(bot); + gtk_container_add(GTK_CONTAINER(frame), vbox); + gtk_widget_show(vbox); + + g_snprintf(buf, sizeof(buf), "Setting Dir Info for %s:", gc->username); + label = gtk_label_new(buf); + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); + gtk_widget_show(label); b->first = gtk_entry_new(); b->middle = gtk_entry_new(); @@ -1427,16 +1431,6 @@ gtk_widget_show(hbox); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - /* And add the buttons */ - gtk_container_add(GTK_CONTAINER(frame), vbox); - gtk_box_pack_start(GTK_BOX(fbox), frame, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(fbox), bot, FALSE, FALSE, 0); - - - gtk_widget_show(vbox); - gtk_widget_show(fbox); - - gtk_widget_show(frame); gtk_widget_show(b->first); gtk_widget_show(b->middle); gtk_widget_show(b->last); @@ -1446,18 +1440,22 @@ gtk_widget_show(b->country); gtk_widget_show(b->web); - gtk_signal_connect(GTK_OBJECT(b->window), "destroy", - GTK_SIGNAL_FUNC(destroy_dialog), b->window); + /* And add the buttons */ + + bot = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(fbox), bot, FALSE, FALSE, 0); + gtk_widget_show(bot); + + b->cancel = picture_button(b->window, _("Cancel"), cancel_xpm); + gtk_box_pack_end(GTK_BOX(bot), b->cancel, FALSE, FALSE, 0); gtk_signal_connect(GTK_OBJECT(b->cancel), "clicked", GTK_SIGNAL_FUNC(destroy_dialog), b->window); + + b->save = picture_button(b->window, _("Save"), save_xpm); + gtk_box_pack_end(GTK_BOX(bot), b->save, FALSE, FALSE, 0); gtk_signal_connect(GTK_OBJECT(b->save), "clicked", GTK_SIGNAL_FUNC(do_set_dir), b); - gtk_container_add(GTK_CONTAINER(b->window), fbox); - - gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Set Dir Info")); gtk_window_set_focus(GTK_WINDOW(b->window), b->first); - gtk_widget_realize(b->window); - aol_icon(b->window->window); gtk_widget_show(b->window); } @@ -1486,60 +1484,19 @@ g_free(b); } -static void pwd_choose(GtkObject *obj, struct passwddlg *pwd) -{ - pwd->gc = (struct gaim_connection *)gtk_object_get_user_data(obj); -} - -static void passwd_multi_menu(GtkWidget *box, struct passwddlg *pwd) -{ - GtkWidget *hbox; - GtkWidget *label; - GtkWidget *optmenu; - GtkWidget *menu; - GtkWidget *opt; - GSList *c = connections; - struct gaim_connection *g; - - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); - gtk_widget_show(hbox); - - label = gtk_label_new(_("Change password for:")); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - optmenu = gtk_option_menu_new(); - gtk_box_pack_end(GTK_BOX(hbox), optmenu, FALSE, FALSE, 0); - gtk_widget_show(optmenu); - - menu = gtk_menu_new(); - - while (c) { - g = (struct gaim_connection *)c->data; - opt = gtk_menu_item_new_with_label(g->username); - gtk_object_set_user_data(GTK_OBJECT(opt), g); - gtk_signal_connect(GTK_OBJECT(opt), "activate", GTK_SIGNAL_FUNC(pwd_choose), pwd); - gtk_menu_append(GTK_MENU(menu), opt); - gtk_widget_show(opt); - c = c->next; - } - - gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu); - gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), 0); - - pwd->gc = (struct gaim_connection *)connections->data; -} - -void show_change_passwd() +void show_change_passwd(struct gaim_connection *gc) { GtkWidget *hbox; GtkWidget *label; GtkWidget *vbox; GtkWidget *fbox; GtkWidget *frame; + char buf[256]; struct passwddlg *b = g_new0(struct passwddlg, 1); + if (!g_slist_find(connections, gc)) + gc = connections->data; + b->gc = gc; b->window = gtk_window_new(GTK_WINDOW_DIALOG); gtk_window_set_policy(GTK_WINDOW(b->window), FALSE, TRUE, TRUE); @@ -1565,11 +1522,10 @@ gtk_container_add(GTK_CONTAINER(frame), vbox); gtk_widget_show(vbox); -#ifndef NO_MULTI - passwd_multi_menu(vbox, b); -#else - b->gc = connections->data; -#endif + g_snprintf(buf, sizeof(buf), "Changing password for %s:", gc->username); + label = gtk_label_new(buf); + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); + gtk_widget_show(label); /* First Line */ hbox = gtk_hbox_new(FALSE, 5); @@ -1632,126 +1588,67 @@ gtk_widget_show(b->window); } -static void info_choose(GtkWidget *opt, struct set_info_dlg *b) -{ - int text_len = gtk_text_get_length(GTK_TEXT(b->text)); - struct aim_user *u = gtk_object_get_user_data(GTK_OBJECT(opt)); - gchar *buf = g_malloc(strlen(u->user_info)+1); - b->user = u; - - strncpy_nohtml(buf, u->user_info, strlen(u->user_info)+1); - - gtk_text_set_point(GTK_TEXT(b->text), 0); - gtk_text_forward_delete(GTK_TEXT(b->text), text_len); - gtk_text_insert(GTK_TEXT(b->text), NULL, NULL, NULL, buf, -1); - - g_free(buf); -} - -static void info_user_menu(struct set_info_dlg *b, GtkWidget *box) -{ - GtkWidget *hbox; - GtkWidget *label; - GtkWidget *optmenu; - GtkWidget *menu; - GtkWidget *opt; - GList *u = aim_users; - struct aim_user *a; - - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); - gtk_widget_show(hbox); - - label = gtk_label_new(_("Set info for:")); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - optmenu = gtk_option_menu_new(); - gtk_box_pack_start(GTK_BOX(hbox), optmenu, FALSE, FALSE, 0); - gtk_widget_show(optmenu); - - menu = gtk_menu_new(); - - while (u) { - a = (struct aim_user *)u->data; - opt = gtk_menu_item_new_with_label(a->username); - gtk_object_set_user_data(GTK_OBJECT(opt), a); - gtk_signal_connect(GTK_OBJECT(opt), "activate", GTK_SIGNAL_FUNC(info_choose), b); - gtk_menu_append(GTK_MENU(menu), opt); - gtk_widget_show(opt); - u = u->next; - } - - gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu); - gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), - g_list_index(aim_users, ((struct gaim_connection *)connections->data)->user)); - - b->menu = optmenu; -} - -void show_set_info() +void show_set_info(struct gaim_connection *gc) { GtkWidget *buttons; + GtkWidget *label; GtkWidget *vbox; gchar *buf; struct aim_user *tmp; struct set_info_dlg *b = g_new0(struct set_info_dlg, 1); + if (!g_slist_find(connections, gc)) + gc = connections->data; + tmp = gc->user; + b->user = tmp; b->window = gtk_window_new(GTK_WINDOW_DIALOG); gtk_window_set_wmclass(GTK_WINDOW(b->window), "set_info", "Gaim"); dialogwindows = g_list_prepend(dialogwindows, b->window); + gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Set User Info")); + gtk_signal_connect(GTK_OBJECT(b->window), "destroy", + GTK_SIGNAL_FUNC(destroy_dialog), b->window); gtk_widget_realize(b->window); - - buttons = gtk_hbox_new(FALSE, 5); + aol_icon(b->window->window); + vbox = gtk_vbox_new(FALSE, 5); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); - - /* Build OK Button */ - - b->save = picture_button(b->window, _("Save"), save_xpm); - b->cancel = picture_button(b->window, _("Cancel"), cancel_xpm); - - gtk_box_pack_end(GTK_BOX(buttons), b->cancel, FALSE, FALSE, 0); - gtk_box_pack_end(GTK_BOX(buttons), b->save, FALSE, FALSE, 0); - - gtk_signal_connect(GTK_OBJECT(b->window), "destroy", - GTK_SIGNAL_FUNC(destroy_dialog), b->window); - gtk_signal_connect(GTK_OBJECT(b->cancel), "clicked", - GTK_SIGNAL_FUNC(destroy_dialog), b->window); - gtk_signal_connect(GTK_OBJECT(b->save), "clicked", - GTK_SIGNAL_FUNC(do_save_info), b); - - info_user_menu(b, vbox); - - gtk_widget_show(buttons); - + gtk_container_add(GTK_CONTAINER(b->window), vbox); + gtk_widget_show(vbox); + + buf = g_malloc(256); + g_snprintf(buf, 256, "Changing info for %s:", tmp->username); + label = gtk_label_new(buf); + g_free(buf); + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); + gtk_widget_show(label); + b->text = gtk_text_new(NULL, NULL); gtk_text_set_word_wrap(GTK_TEXT(b->text), TRUE); gtk_text_set_editable(GTK_TEXT(b->text), TRUE); gtk_widget_set_usize(b->text, 300, 200); - if (aim_users) { - tmp = ((struct gaim_connection *)connections->data)->user; - buf = g_malloc(strlen(tmp->user_info)+1); - strncpy_nohtml(buf, tmp->user_info, strlen(tmp->user_info)+1); - gtk_text_insert(GTK_TEXT(b->text), NULL, NULL, NULL, buf, -1); - b->user = tmp; - g_free(buf); - } - + buf = g_malloc(strlen(tmp->user_info)+1); + strncpy_nohtml(buf, tmp->user_info, strlen(tmp->user_info)+1); + gtk_text_insert(GTK_TEXT(b->text), NULL, NULL, NULL, buf, -1); + g_free(buf); + gtk_box_pack_start(GTK_BOX(vbox), b->text, TRUE, TRUE, 0); gtk_widget_show(b->text); - - gtk_box_pack_start(GTK_BOX(vbox), b->text, TRUE, TRUE, 0); - gtk_widget_show(vbox); - + gtk_window_set_focus(GTK_WINDOW(b->window), b->text); + + buttons = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), buttons, FALSE, FALSE, 0); - - gtk_container_add(GTK_CONTAINER(b->window), vbox); - gtk_widget_realize(b->window); - aol_icon(b->window->window); - - gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Set User Info")); - gtk_window_set_focus(GTK_WINDOW(b->window), b->text); + gtk_widget_show(buttons); + + b->cancel = picture_button(b->window, _("Cancel"), cancel_xpm); + gtk_box_pack_end(GTK_BOX(buttons), b->cancel, FALSE, FALSE, 0); + gtk_signal_connect(GTK_OBJECT(b->cancel), "clicked", + GTK_SIGNAL_FUNC(destroy_dialog), b->window); + + b->save = picture_button(b->window, _("Save"), save_xpm); + gtk_box_pack_end(GTK_BOX(buttons), b->save, FALSE, FALSE, 0); + gtk_signal_connect(GTK_OBJECT(b->save), "clicked", + GTK_SIGNAL_FUNC(do_save_info), b); + gtk_widget_show(b->window); } @@ -2292,20 +2189,34 @@ gtk_window_set_policy(GTK_WINDOW(b->window), FALSE, TRUE, TRUE); gtk_window_set_wmclass(GTK_WINDOW(b->window), "find_email", "Gaim"); gtk_widget_realize(b->window); + aol_icon(b->window->window); dialogwindows = g_list_prepend(dialogwindows, b->window); + gtk_signal_connect(GTK_OBJECT(b->window), "destroy", + GTK_SIGNAL_FUNC(destroy_dialog), b->window); + gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Find Buddy By Email")); vbox = gtk_vbox_new(FALSE, 5); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); + gtk_container_add(GTK_CONTAINER(b->window), vbox); frame = gtk_frame_new(_("Search for Buddy")); + gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); + topbox = gtk_hbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(frame), topbox); gtk_container_set_border_width(GTK_CONTAINER(topbox), 5); + label = gtk_label_new(_("Email")); + gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 0); + + b->emailentry = gtk_entry_new(); + gtk_box_pack_start(GTK_BOX(topbox), b->emailentry, TRUE, TRUE, 0); + gtk_signal_connect(GTK_OBJECT(b->emailentry), "activate", + GTK_SIGNAL_FUNC(do_find_email), b); + gtk_window_set_focus(GTK_WINDOW(b->window), b->emailentry); + bbox = gtk_hbox_new(FALSE, 5); - - b->emailentry = gtk_entry_new(); - - /* Build OK Button */ + gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); button = picture_button(b->window, _("Cancel"), cancel_xpm); gtk_signal_connect(GTK_OBJECT(button), "clicked", @@ -2317,24 +2228,6 @@ GTK_SIGNAL_FUNC(do_find_email), b); gtk_box_pack_end(GTK_BOX(bbox), button, FALSE, FALSE, 0); - label = gtk_label_new(_("Email")); - gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(topbox), b->emailentry, TRUE, TRUE, 0); - - gtk_container_add(GTK_CONTAINER(frame), topbox); - gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); - - gtk_signal_connect(GTK_OBJECT(b->window), "destroy", - GTK_SIGNAL_FUNC(destroy_dialog), b->window); - gtk_signal_connect(GTK_OBJECT(b->emailentry), "activate", - GTK_SIGNAL_FUNC(do_find_email), b); - - gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Find Buddy By Email")); - gtk_window_set_focus(GTK_WINDOW(b->window), b->emailentry); - gtk_container_add(GTK_CONTAINER(b->window), vbox); - aol_icon(b->window->window); - gtk_widget_show_all(b->window); }
--- a/src/gaim.h Thu Feb 22 23:07:34 2001 +0000 +++ b/src/gaim.h Fri Feb 23 23:58:35 2001 +0000 @@ -411,6 +411,9 @@ extern int auto_away; extern GtkWidget *awaymenu; +/* Globals in prpl.c */ +extern GtkWidget *protomenu; + /* Globals in buddy.c */ extern GtkWidget *buddies; extern GtkWidget *bpmenu; @@ -763,7 +766,7 @@ extern void show_find_info(); extern void g_show_info (struct aim_user *, char *); extern void g_show_info_text (char *); -extern void show_set_info(); +extern void show_set_info(struct gaim_connection *); extern void show_set_dir(); extern void show_fgcolor_dialog(struct conversation *c, GtkWidget *color); extern void show_bgcolor_dialog(struct conversation *c, GtkWidget *color); @@ -772,7 +775,7 @@ extern void create_away_mess(GtkWidget *, void *); extern void show_ee_dialog(int); extern void show_add_link(GtkWidget *,struct conversation *); -extern void show_change_passwd(); +extern void show_change_passwd(struct gaim_connection *); extern void do_import(GtkWidget *, struct gaim_connection *); extern int bud_list_cache_exists(struct gaim_connection *); extern void show_smiley_dialog(struct conversation *, GtkWidget *);
--- a/src/multi.c Thu Feb 22 23:07:34 2001 +0000 +++ b/src/multi.c Fri Feb 23 23:58:35 2001 +0000 @@ -23,7 +23,9 @@ #include "prpl.h" #include "multi.h" #include "gaim.h" +#ifdef USE_APPLET #include "applet.h" +#endif #include "pixmaps/gnome_add.xpm" #include "pixmaps/gnome_preferences.xpm" @@ -707,6 +709,7 @@ update_connection_dependent_prefs(); do_away_menu(); + do_proto_menu(); redo_convo_menus(); gaim_setup(gc);
--- a/src/oscar.c Thu Feb 22 23:07:34 2001 +0000 +++ b/src/oscar.c Fri Feb 23 23:58:35 2001 +0000 @@ -2055,7 +2055,7 @@ do_ask_dialog(buf, data, oscar_direct_im, oscar_cancel_direct_im); } -static void oscar_action_menu(GtkWidget *menu, struct gaim_connection *gc, char *who) { +static void oscar_buddy_menu(GtkWidget *menu, struct gaim_connection *gc, char *who) { GtkWidget *button; char *n = g_strdup(normalize(gc->username)); @@ -2284,13 +2284,31 @@ return g_list_append(NULL, GAIM_AWAY_CUSTOM); } +static void oscar_do_action(struct gaim_connection *gc, char *act) +{ + if (!strcmp(act, "Set User Info")) { + show_set_info(gc); + } +} + +static GList *oscar_actions() +{ + GList *m = NULL; + + m = g_list_append(m, "Set User Info"); + + return m; +} + void oscar_init(struct prpl *ret) { ret->protocol = PROTO_OSCAR; ret->options = OPT_PROTO_HTML | OPT_PROTO_CORRECT_TIME; ret->name = oscar_name; ret->list_icon = oscar_list_icon; ret->away_states = oscar_away_states; - ret->action_menu = oscar_action_menu; + ret->actions = oscar_actions; + ret->do_action = oscar_do_action; + ret->buddy_menu = oscar_buddy_menu; ret->user_opts = oscar_user_opts; ret->draw_new_user = oscar_draw_new_user; ret->do_new_user = oscar_do_new_user;
--- a/src/prpl.c Thu Feb 22 23:07:34 2001 +0000 +++ b/src/prpl.c Fri Feb 23 23:58:35 2001 +0000 @@ -34,6 +34,8 @@ static GtkWidget *regbox = NULL; static struct prpl *regprpl = NULL; +GtkWidget *protomenu = NULL; + struct prpl *find_prpl(int prot) { GSList *e = protocols; @@ -284,3 +286,116 @@ gtk_widget_show(regdialog); } + +static void proto_act(GtkObject *obj, struct gaim_connection *gc) +{ + char *act = gtk_object_get_user_data(obj); + (*gc->prpl->do_action)(gc, act); +} + +void do_proto_menu() +{ + GtkWidget *menuitem; + GtkWidget *submenu; + GList *l; + GSList *c = connections; + struct gaim_connection *gc = NULL; + int count = 0; + char buf[256]; + + if (!protomenu) + return; + + l = gtk_container_children(GTK_CONTAINER(protomenu)); + while (l) { + gtk_widget_destroy(GTK_WIDGET(l->data)); + l = l->next; + } + + while (c) { + gc = c->data; + if (gc->prpl->actions && gc->prpl->do_action) + count++; + c = g_slist_next(c); + } + c = connections; + + if (!count) { + g_snprintf(buf, sizeof(buf), "No actions available"); + menuitem = gtk_menu_item_new_with_label(buf); + gtk_menu_append(GTK_MENU(protomenu), menuitem); + gtk_widget_show(menuitem); + return; + } + + if (count == 1) { + GList *tmp, *act; + while (c) { + gc = c->data; + if (gc->prpl->actions && gc->prpl->do_action) + break; + c = g_slist_next(c); + } + + tmp = act = (*gc->prpl->actions)(); + + while (act) { + if (act->data == NULL) { + gaim_separator(protomenu); + act = g_list_next(act); + continue; + } + + menuitem = gtk_menu_item_new_with_label(act->data); + gtk_object_set_user_data(GTK_OBJECT(menuitem), act->data); + gtk_menu_append(GTK_MENU(protomenu), menuitem); + gtk_signal_connect(GTK_OBJECT(menuitem), "activate", + GTK_SIGNAL_FUNC(proto_act), gc); + gtk_widget_show(menuitem); + + act = g_list_next(act); + } + + g_list_free(tmp); + } else { + while (c) { + GList *tmp, *act; + gc = c->data; + if (!gc->prpl->actions || !gc->prpl->do_action) { + c = g_slist_next(c); + continue; + } + + g_snprintf(buf, sizeof(buf), "%s (%s)", gc->username, (*gc->prpl->name)()); + menuitem = gtk_menu_item_new_with_label(buf); + gtk_menu_append(GTK_MENU(protomenu), menuitem); + gtk_widget_show(menuitem); + + submenu = gtk_menu_new(); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); + gtk_widget_show(submenu); + + tmp = act = (*gc->prpl->actions)(); + + while (act) { + if (act->data == NULL) { + gaim_separator(protomenu); + act = g_list_next(act); + continue; + } + + menuitem = gtk_menu_item_new_with_label(act->data); + gtk_object_set_user_data(GTK_OBJECT(menuitem), act->data); + gtk_menu_append(GTK_MENU(submenu), menuitem); + gtk_signal_connect(GTK_OBJECT(menuitem), "activate", + GTK_SIGNAL_FUNC(proto_act), gc); + gtk_widget_show(menuitem); + + act = g_list_next(act); + } + + g_list_free(tmp); + c = g_slist_next(c); + } + } +}
--- a/src/prpl.h Thu Feb 22 23:07:34 2001 +0000 +++ b/src/prpl.h Fri Feb 23 23:58:35 2001 +0000 @@ -54,10 +54,12 @@ /* returns the XPM associated with the given user class */ char **(* list_icon)(int); GList *(* away_states)(); + GList *(* actions)(); + void (* do_action)(struct gaim_connection *, char *); /* when UI plugins come, these will have to be reconciled by returning * structs indicating what kinds of information they want displayed. */ - void (* action_menu)(GtkWidget *, struct gaim_connection *, char *); + void (* buddy_menu)(GtkWidget *, struct gaim_connection *, char *); void (* user_opts)(GtkWidget *, struct aim_user *); void (* draw_new_user)(GtkWidget *); void (* do_new_user)();
--- a/src/toc.c Thu Feb 22 23:07:34 2001 +0000 +++ b/src/toc.c Fri Feb 23 23:58:35 2001 +0000 @@ -911,7 +911,7 @@ serv_get_dir(gc, who); } -static void toc_action_menu(GtkWidget *menu, struct gaim_connection *gc, char *who) +static void toc_buddy_menu(GtkWidget *menu, struct gaim_connection *gc, char *who) { GtkWidget *button; @@ -1206,6 +1206,28 @@ return g_list_append(NULL, GAIM_AWAY_CUSTOM); } +static void toc_do_action(struct gaim_connection *gc, char *act) +{ + if (!strcmp(act, "Set User Info")) { + show_set_info(gc); + } else if (!strcmp(act, "Set Dir Info")) { + show_set_dir(gc); + } else if (!strcmp(act, "Change Password")) { + show_change_passwd(gc); + } +} + +static GList *toc_actions() +{ + GList *m = NULL; + + m = g_list_append(m, "Set User Info"); + m = g_list_append(m, "Set Dir Info"); + m = g_list_append(m, "Change Password"); + + return m; +} + void toc_init(struct prpl *ret) { ret->protocol = PROTO_TOC; @@ -1213,7 +1235,9 @@ ret->name = toc_name; ret->list_icon = toc_list_icon; ret->away_states = toc_away_states; - ret->action_menu = toc_action_menu; + ret->actions = toc_actions; + ret->do_action = toc_do_action; + ret->buddy_menu = toc_buddy_menu; ret->user_opts = toc_user_opts; ret->draw_new_user = toc_draw_new_user; ret->do_new_user = toc_do_new_user;