Mercurial > pidgin.yaz
changeset 2411:123aaa84109a
[gaim-migrate @ 2424]
Rob, you took too long to do it
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 02 Oct 2001 05:52:56 +0000 |
parents | 65928d810c22 |
children | eb9837ab2054 |
files | ChangeLog src/dialogs.c src/gaim.h src/multi.c src/protocols/oscar/oscar.c src/prpl.h |
diffstat | 6 files changed, 171 insertions(+), 177 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Oct 01 22:54:05 2001 +0000 +++ b/ChangeLog Tue Oct 02 05:52:56 2001 +0000 @@ -12,6 +12,7 @@ * Tab-completion for nicks in chat (thanks to Sean Egan) * Large internal reworkings * New Protocol: Gadu-Gadu, written by Arkadiusz Miskiewicz + * Can choose buddy icon to send (for Oscar) version 0.44 (09/20/2001): * More sane scaling of buddy icons (intelligently scale to
--- a/src/dialogs.c Mon Oct 01 22:54:05 2001 +0000 +++ b/src/dialogs.c Tue Oct 02 05:52:56 2001 +0000 @@ -1501,178 +1501,6 @@ gtk_widget_show(b->window); } -void do_user_icon(GtkWidget *w, gpointer data) -{ - struct set_icon_dlg *b = (struct set_icon_dlg *)data; - char *file; - - file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(icondlg)); - - if (file_is_dir(file, icondlg)) - return; - - if (b && b->entry) { - gtk_entry_set_text(GTK_ENTRY(b->entry), file); - } - - destroy_dialog(NULL, icondlg); - icondlg = NULL; - -} - -void show_icon_dialog(GtkWidget *w, gpointer data) -{ - struct set_icon_dlg *b = (struct set_icon_dlg *)data; - char *buf = g_malloc(BUF_LEN); - - if (!icondlg) { - icondlg = gtk_file_selection_new(_("Gaim - Load User Icon")); - - gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(icondlg)); - - g_snprintf(buf, BUF_LEN - 1, "%s/", getenv("HOME")); - - gtk_file_selection_set_filename(GTK_FILE_SELECTION(icondlg), buf); - gtk_signal_connect(GTK_OBJECT(icondlg), "destroy", - GTK_SIGNAL_FUNC(destroy_dialog), icondlg); - - gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(icondlg)->ok_button), - "clicked", GTK_SIGNAL_FUNC(do_user_icon), b); - gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(icondlg)->cancel_button), - "clicked", GTK_SIGNAL_FUNC(destroy_dialog), icondlg); - - - } - - g_free(buf); - gtk_widget_show(icondlg); - gdk_window_raise(icondlg->window); -} - -void do_save_icon(GtkWidget *w, struct set_icon_dlg *b) -{ - char *file = gtk_entry_get_text(GTK_ENTRY(b->entry)); - - if (file) - g_snprintf(b->user->iconfile, sizeof(b->user->iconfile), "%s", file); - else - b->user->iconfile[0] = 0; - - save_prefs(); - - destroy_dialog(NULL, b->window); -} - -void do_clear_icon(GtkWidget *w, struct set_icon_dlg *b) -{ - gtk_entry_set_text(GTK_ENTRY(b->entry), ""); -} - -void show_set_icon(struct gaim_connection *gc) -{ - GtkWidget *label; - GtkWidget *frame; - GtkWidget *buttons; - GtkWidget *button; - GtkWidget *vbox; - GtkWidget *hbox; - GtkWidget *hbox2; - GtkWidget *rbox; -/* GtkWidget *sep; */ - - struct aim_user *tmp; - struct set_icon_dlg *b = g_new0(struct set_icon_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_container_set_border_width(GTK_CONTAINER(b->window), 5); - gtk_window_set_wmclass(GTK_WINDOW(b->window), "set_icon", "Gaim"); - gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Set User Icon")); - 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); - dialogwindows = g_list_prepend(dialogwindows, b->window); - - /* the box that holds everything */ - vbox = gtk_vbox_new(FALSE, 5); - gtk_widget_show(vbox); - gtk_container_add(GTK_CONTAINER(b->window), vbox); - - /* and the frame that umm frames shit */ - frame = gtk_frame_new(_("User Icon")); - gtk_container_set_border_width(GTK_CONTAINER(frame), 5); - gtk_widget_show(frame); - gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 5); - - /* the inner boxie */ - hbox = gtk_hbox_new(FALSE, 0); - gtk_widget_show(hbox); - gtk_container_add(GTK_CONTAINER(frame), hbox); - - /* - sep = gtk_vseparator_new(); - gtk_widget_show(sep); - gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 5); - */ - - /* A boxy */ - rbox = gtk_vbox_new(FALSE, 5); - gtk_widget_show(rbox); - gtk_box_pack_start(GTK_BOX(hbox), rbox, FALSE, FALSE, 5); - - label = gtk_label_new(_("Please select an icon to be viewed when you chat with\nother users.")); - gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); - gtk_widget_show(label); - gtk_box_pack_start(GTK_BOX(rbox), label, FALSE, FALSE, 5); - - hbox2 = gtk_hbox_new(FALSE, 5); - gtk_widget_show(hbox2); - gtk_box_pack_start(GTK_BOX(rbox), hbox2, FALSE, FALSE, 5); - - b->entry = gtk_entry_new(); - - if (strlen(gc->user->iconfile)) { - gtk_entry_set_text(GTK_ENTRY(b->entry), gc->user->iconfile); - } - - gtk_widget_show(b->entry); - gtk_box_pack_start(GTK_BOX(hbox2), b->entry, TRUE, TRUE, 5); - - button = gtk_button_new_with_label(_("Browse")); - gtk_box_pack_start(GTK_BOX(hbox2), button, FALSE, FALSE, 5); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(show_icon_dialog), b); - gtk_widget_show(button); - - button = gtk_button_new_with_label(_("Clear")); - gtk_box_pack_start(GTK_BOX(hbox2), button, FALSE, FALSE, 5); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_clear_icon), b); - - gtk_widget_show(button); - - /* button buttons */ - buttons = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(vbox), buttons, FALSE, FALSE, 0); - 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->ok = picture_button(b->window, _("Ok"), ok_xpm); - gtk_box_pack_end(GTK_BOX(buttons), b->ok, FALSE, FALSE, 0); - - gtk_signal_connect(GTK_OBJECT(b->ok), "clicked", GTK_SIGNAL_FUNC(do_save_icon), b); - - /* Show it */ - gtk_widget_show(b->window); - -} - void show_set_info(struct gaim_connection *gc) { GtkWidget *buttons;
--- a/src/gaim.h Mon Oct 01 22:54:05 2001 +0000 +++ b/src/gaim.h Tue Oct 02 05:52:56 2001 +0000 @@ -127,6 +127,8 @@ char iconfile[256]; struct gaim_connection *gc; + + /* CUI: everything below here should be in struct mod_aim_user */ /* stuff for modify window */ GtkWidget *mod; @@ -143,6 +145,12 @@ GtkWidget *passprmt; GtkWidget *passentry; + /* stuff for icon selection */ + char tmp_iconfile[256]; + GtkWidget *iconsel; + GtkWidget *iconentry; + GtkWidget *icondlg; + /* stuff for mail check prompt */ GtkWidget *checkmail;
--- a/src/multi.c Mon Oct 01 22:54:05 2001 +0000 +++ b/src/multi.c Tue Oct 02 05:52:56 2001 +0000 @@ -47,8 +47,8 @@ static GtkWidget *newmod = NULL; /* the dialog for creating a new account */ static GtkWidget *newmain = NULL; /* the notebook that holds options */ static struct aim_user tmpusr = { "", "", "", OPT_USR_REM_PASS, DEFAULT_PROTO, - {"", "", "", "", "", "", ""}, "", NULL, NULL, NULL, NULL, NULL, - NULL, NULL, OPT_USR_REM_PASS, DEFAULT_PROTO, NULL, NULL, NULL + {"", "", "", "", "", "", ""}, "", NULL, NULL, NULL, NULL, NULL, NULL, NULL, + OPT_USR_REM_PASS, DEFAULT_PROTO, NULL, NULL, NULL, "", NULL, NULL, NULL, NULL, NULL }; static void generate_prpl_options(struct aim_user *, GtkWidget *); @@ -256,6 +256,11 @@ g_list_free(u->opt_entries); u->opt_entries = NULL; + g_snprintf(u->iconfile, sizeof(u->iconfile), "%s", u->tmp_iconfile); + if (u->icondlg) + gtk_widget_destroy(u->icondlg); + u->icondlg = NULL; + gtk_widget_destroy(u->mod); } else { txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.name)); @@ -276,6 +281,11 @@ g_list_free(tmpusr.opt_entries); tmpusr.opt_entries = NULL; + g_snprintf(u->iconfile, sizeof(u->iconfile), "%s", tmpusr.tmp_iconfile); + if (tmpusr.icondlg) + gtk_widget_destroy(tmpusr.icondlg); + tmpusr.icondlg = NULL; + gtk_widget_destroy(newmod); } save_prefs(); @@ -288,11 +298,17 @@ g_list_free(u->opt_entries); u->opt_entries = NULL; gtk_widget_destroy(u->mod); + if (u->icondlg) + gtk_widget_destroy(u->icondlg); + u->icondlg = NULL; } else { if (tmpusr.opt_entries) g_list_free(tmpusr.opt_entries); tmpusr.opt_entries = NULL; gtk_widget_destroy(newmod); + if (tmpusr.icondlg) + gtk_widget_destroy(tmpusr.icondlg); + tmpusr.icondlg = NULL; } } @@ -318,6 +334,11 @@ } else if ((p->options & OPT_PROTO_MAIL_CHECK) && !(q->options & OPT_PROTO_MAIL_CHECK)) { gtk_widget_hide(u->checkmail); } + if (!(p->options & OPT_PROTO_BUDDY_ICON) && (q->options & OPT_PROTO_BUDDY_ICON)) { + gtk_widget_show(u->iconsel); + } else if ((p->options & OPT_PROTO_BUDDY_ICON) && !(q->options & OPT_PROTO_BUDDY_ICON)) { + gtk_widget_hide(u->iconsel); + } u->tmp_protocol = proto; generate_prpl_options(u, u->main); } else if (!u && (tmpusr.tmp_protocol != proto)) { @@ -337,6 +358,11 @@ } else if ((p->options & OPT_PROTO_MAIL_CHECK) && !(q->options & OPT_PROTO_MAIL_CHECK)) { gtk_widget_hide(tmpusr.checkmail); } + if (!(p->options & OPT_PROTO_BUDDY_ICON) && (q->options & OPT_PROTO_BUDDY_ICON)) { + gtk_widget_show(tmpusr.iconsel); + } else if ((p->options & OPT_PROTO_BUDDY_ICON) && !(q->options & OPT_PROTO_BUDDY_ICON)) { + gtk_widget_hide(tmpusr.iconsel); + } tmpusr.tmp_protocol = tmpusr.protocol = proto; generate_prpl_options(NULL, newmain); } @@ -389,6 +415,121 @@ return optmenu; } +static void des_icon_sel(GtkWidget *w, struct aim_user *u) +{ + w = u->icondlg; + if (u->icondlg) + u->icondlg = NULL; + if (w) + gtk_widget_destroy(w); +} + +static void set_icon(GtkWidget *w, struct aim_user *u) +{ + GtkWidget *sel = u ? u->icondlg : tmpusr.icondlg; + char *file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(sel)); + + if (file_is_dir(file, sel)) + return; + + if (u) { + gtk_entry_set_text(GTK_ENTRY(u->iconentry), file); + g_snprintf(u->tmp_iconfile, sizeof(u->tmp_iconfile), "%s", file); + u->icondlg = NULL; + } else { + gtk_entry_set_text(GTK_ENTRY(tmpusr.iconentry), file); + g_snprintf(tmpusr.tmp_iconfile, sizeof(tmpusr.tmp_iconfile), "%s", file); + tmpusr.icondlg = NULL; + } + + gtk_widget_destroy(sel); +} + +static void sel_icon_dlg(GtkWidget *w, struct aim_user *u) +{ + GtkWidget *dlg; + char buf[256]; + + if ((u && u->icondlg) || (!u && tmpusr.icondlg)) { + if (u) + gtk_widget_show(u->icondlg); + else + gtk_widget_show(tmpusr.icondlg); + return; + } + + dlg = gtk_file_selection_new(_("Gaim - Load Buddy Icon")); + gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(dlg)); + g_snprintf(buf, sizeof(buf), "%s/", g_get_home_dir()); + gtk_file_selection_set_filename(GTK_FILE_SELECTION(dlg), buf); + + gtk_signal_connect(GTK_OBJECT(dlg), "destroy", GTK_SIGNAL_FUNC(des_icon_sel), u); + gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(dlg)->cancel_button), "clicked", + GTK_SIGNAL_FUNC(des_icon_sel), u); + gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(dlg)->ok_button), "clicked", + GTK_SIGNAL_FUNC(set_icon), u); + + if (u) + u->icondlg = dlg; + else + tmpusr.icondlg = dlg; + + gtk_widget_show(dlg); +} + +static void reset_icon(GtkWidget *w, struct aim_user *u) +{ + if (u) { + u->tmp_iconfile[0] = 0; + gtk_entry_set_text(GTK_ENTRY(u->iconentry), u->iconfile); + } else { + tmpusr.tmp_iconfile[0] = 0; + gtk_entry_set_text(GTK_ENTRY(tmpusr.iconentry), ""); + } +} + +static GtkWidget *build_icon_selection(struct aim_user *u, GtkWidget *box) +{ + GtkWidget *hbox; + GtkWidget *label; + GtkWidget *name; + GtkWidget *browse; + GtkWidget *reset; + + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5); + gtk_widget_show(hbox); + + label = gtk_label_new(_("Buddy Icon File:")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + gtk_widget_show(label); + + name = gtk_entry_new(); + if (u) + gtk_entry_set_text(GTK_ENTRY(name), u->iconfile); + else + gtk_entry_set_text(GTK_ENTRY(name), tmpusr.iconfile); + gtk_entry_set_editable(GTK_ENTRY(name), FALSE); + gtk_box_pack_start(GTK_BOX(hbox), name, TRUE, TRUE, 5); + gtk_widget_show(name); + if (u) + u->iconentry = name; + else + tmpusr.iconentry = name; + + browse = gtk_button_new_with_label(_("Browse")); + gtk_signal_connect(GTK_OBJECT(browse), "clicked", GTK_SIGNAL_FUNC(sel_icon_dlg), u); + gtk_box_pack_start(GTK_BOX(hbox), browse, FALSE, FALSE, 0); + gtk_widget_show(browse); + + reset = gtk_button_new_with_label(_("Reset")); + gtk_signal_connect(GTK_OBJECT(reset), "clicked", GTK_SIGNAL_FUNC(reset_icon), u); + gtk_box_pack_start(GTK_BOX(hbox), reset, FALSE, FALSE, 0); + gtk_widget_show(reset); + + return hbox; +} + static void generate_general_options(struct aim_user *u, GtkWidget *book) { GtkWidget *vbox; @@ -399,6 +540,7 @@ GtkWidget *pass; GtkWidget *rempass; GtkWidget *checkmail; + GtkWidget *iconsel; vbox = gtk_vbox_new(FALSE, 5); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); @@ -437,6 +579,8 @@ /*acct_button(_("Send KeepAlive packet (6 bytes/second)"), u, OPT_USR_KEEPALV, vbox); */ checkmail = acct_button(_("New Mail Notifications"), u, OPT_USR_MAIL_CHECK, vbox); + iconsel = build_icon_selection(u, vbox); + gtk_widget_show_all(vbox); if (u) { @@ -445,6 +589,7 @@ u->pass = pass; u->rempass = rempass; u->checkmail = checkmail; + u->iconsel = iconsel; gtk_entry_set_text(GTK_ENTRY(name), u->username); gtk_entry_set_text(GTK_ENTRY(pass), u->password); gtk_entry_set_editable(GTK_ENTRY(name), FALSE); @@ -454,6 +599,7 @@ tmpusr.pass = pass; tmpusr.rempass = rempass; tmpusr.checkmail = checkmail; + tmpusr.iconsel = iconsel; } } @@ -569,9 +715,11 @@ box = gtk_vbox_new(FALSE, 5); gtk_container_border_width(GTK_CONTAINER(mod), 5); gtk_container_add(GTK_CONTAINER(mod), box); + gtk_widget_show(box); book = gtk_notebook_new(); gtk_box_pack_start(GTK_BOX(box), book, FALSE, FALSE, 0); + gtk_widget_show(book); if (u) { if (find_prpl(u->protocol)) @@ -593,14 +741,17 @@ hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); + gtk_widget_show(hbox); button = picture_button(mod, _("Cancel"), cancel_xpm); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(cancel_mod), u); + gtk_widget_show(button); button = picture_button(mod, _("OK"), ok_xpm); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(ok_mod), u); + gtk_widget_show(button); if (u) { u->mod = mod; @@ -611,8 +762,6 @@ newmain = book; } - gtk_widget_show_all(mod); - if (u) { p = find_prpl(u->tmp_protocol); if (p && (p->options & OPT_PROTO_NO_PASSWORD)) { @@ -621,6 +770,8 @@ } if (p && (!(p->options & OPT_PROTO_MAIL_CHECK))) gtk_widget_hide(u->checkmail); + if (p && (!(p->options & OPT_PROTO_BUDDY_ICON))) + gtk_widget_hide(u->iconsel); } else { p = find_prpl(tmpusr.tmp_protocol); if (p && (p->options & OPT_PROTO_NO_PASSWORD)) { @@ -629,7 +780,11 @@ } if (p && (!(p->options & OPT_PROTO_MAIL_CHECK))) gtk_widget_hide(tmpusr.checkmail); + if (p && (!(p->options & OPT_PROTO_BUDDY_ICON))) + gtk_widget_hide(tmpusr.iconsel); } + + gtk_widget_show(mod); } static void add_acct(GtkWidget *w, gpointer d)
--- a/src/protocols/oscar/oscar.c Mon Oct 01 22:54:05 2001 +0000 +++ b/src/protocols/oscar/oscar.c Tue Oct 02 05:52:56 2001 +0000 @@ -2703,7 +2703,7 @@ void oscar_init(struct prpl *ret) { ret->protocol = PROTO_OSCAR; - ret->options = OPT_PROTO_HTML | OPT_PROTO_CORRECT_TIME; + ret->options = OPT_PROTO_HTML | OPT_PROTO_CORRECT_TIME | OPT_PROTO_BUDDY_ICON; ret->name = oscar_name; ret->list_icon = oscar_list_icon; ret->away_states = oscar_away_states;
--- a/src/prpl.h Mon Oct 01 22:54:05 2001 +0000 +++ b/src/prpl.h Tue Oct 02 05:52:56 2001 +0000 @@ -64,6 +64,8 @@ #define OPT_PROTO_NO_PASSWORD 0x00000010 /* MSN and Yahoo notify you when you have new mail */ #define OPT_PROTO_MAIL_CHECK 0x00000020 +/* Oscar and Jabber have buddy icons */ +#define OPT_PROTO_BUDDY_ICON 0x00000040 #define GAIM_AWAY_CUSTOM "Custom"