Mercurial > pidgin.yaz
changeset 2550:01dad6d8ba5b
[gaim-migrate @ 2563]
New buddy pounce action: popup notification window.
Thanks for the suggestion, Allan Third.
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Fri, 19 Oct 2001 18:44:52 +0000 |
parents | 7c64b3ad0c3d |
children | 4daddeb30354 |
files | ChangeLog src/buddy.c src/dialogs.c src/gaim.h |
diffstat | 4 files changed, 115 insertions(+), 88 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Oct 19 09:58:39 2001 +0000 +++ b/ChangeLog Fri Oct 19 18:44:52 2001 +0000 @@ -5,6 +5,7 @@ (thanks Arkadiusz Miskiewicz) * Better recoding in Gadu-Gadu (thanks Arkadiusz Miskiewicz) * Open Mail button for when you get new mail (Yahoo and MSN) + * New buddy pounce option: Popup Notification version 0.46 (10/18/2001): * New applet icons (courtesy David Raeman)
--- a/src/buddy.c Fri Oct 19 09:58:39 2001 +0000 +++ b/src/buddy.c Fri Oct 19 18:44:52 2001 +0000 @@ -1451,6 +1451,19 @@ set_convo_gc(c, u->gc); } + if (b->options & OPT_POUNCE_NOTIFY) { + char tmp[1024]; + + /* I know the line below is really ugly. I only did it this way + * because I thought it'd be funny :-) */ + + g_snprintf(tmp, sizeof(tmp), "%s has %s", name, + (b->options & OPT_POUNCE_SIGNON) ? "signed on" : + (b->options & OPT_POUNCE_UNIDLE) ? "returned from being idle" : + "returned from being away"); + + do_error_dialog(tmp, _("Buddy Pounce")); + } if (b->options & OPT_POUNCE_SEND_IM) { c = find_conversation(name); if (c == NULL) @@ -1458,8 +1471,10 @@ set_convo_gc(c, u->gc); - write_to_conv(c, b->message, WFLAG_SEND, NULL, time((time_t) NULL)); - serv_send_im(u->gc, name, b->message, 0); + if (strlen(b->message) > 0) { + write_to_conv(c, b->message, WFLAG_SEND, NULL, time((time_t) NULL)); + serv_send_im(u->gc, name, b->message, 0); + } } if (b->options & OPT_POUNCE_COMMAND) { int pid = fork();
--- a/src/dialogs.c Fri Oct 19 09:58:39 2001 +0000 +++ b/src/dialogs.c Fri Oct 19 18:44:52 2001 +0000 @@ -134,6 +134,7 @@ GtkWidget *command; GtkWidget *sendim; GtkWidget *openwindow; + GtkWidget *popupnotify; GtkWidget *p_signon; GtkWidget *p_unaway; GtkWidget *p_unidle; @@ -978,6 +979,9 @@ bp->options = 0; + if (GTK_TOGGLE_BUTTON(b->popupnotify)->active) + bp->options |= OPT_POUNCE_NOTIFY; + if (GTK_TOGGLE_BUTTON(b->openwindow)->active) bp->options |= OPT_POUNCE_POPUP; @@ -1018,27 +1022,15 @@ b->user = u; } -static void pounce_user_menu(struct addbp *b, GtkWidget *box) +static GtkWidget *pounce_user_menu(struct addbp *b) { - GtkWidget *hbox; - GtkWidget *label; GtkWidget *optmenu; GtkWidget *menu; GtkWidget *opt; GSList *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(_("Pounce buddy as:")); - 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(); @@ -1065,6 +1057,8 @@ b->user = ((struct gaim_connection *)connections->data)->user; b->menu = optmenu; + + return optmenu; } @@ -1076,6 +1070,9 @@ GtkWidget *hbox; GtkWidget *button; GtkWidget *sep; + GtkWidget *frame; + GtkWidget *table; + GtkWidget *optmenu; struct addbp *b = g_new0(struct addbp, 1); @@ -1093,85 +1090,111 @@ gtk_container_add(GTK_CONTAINER(b->window), vbox); gtk_widget_show(vbox); - pounce_user_menu(b, vbox); - - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); - gtk_widget_show(hbox); - - label = gtk_label_new(_("Buddy:")); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + /* <pounce type="who"> */ + frame = gtk_frame_new(_("Pounce Who")); + gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); + gtk_widget_show(GTK_WIDGET(frame)); + + table = gtk_table_new(2, 2, FALSE); + gtk_container_add(GTK_CONTAINER(frame), table); + gtk_container_set_border_width(GTK_CONTAINER(table), 5); + gtk_table_set_col_spacings(GTK_TABLE(table), 5); + gtk_table_set_row_spacings(GTK_TABLE(table), 5); + gtk_widget_show(table); + + label = gtk_label_new(_("Account")); + gtk_misc_set_alignment(GTK_MISC(label), 0, .5); + gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); + gtk_widget_show(label); + + optmenu = pounce_user_menu(b); + gtk_table_attach(GTK_TABLE(table), optmenu, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); + gtk_widget_show(optmenu); + + label = gtk_label_new(_("Buddy")); + gtk_misc_set_alignment(GTK_MISC(label), 0, .5); + gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); gtk_widget_show(label); b->nameentry = gtk_entry_new(); - gtk_box_pack_start(GTK_BOX(hbox), b->nameentry, TRUE, TRUE, 0); + gtk_table_attach(GTK_TABLE(table), b->nameentry, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0); if (name !=NULL) gtk_entry_set_text(GTK_ENTRY(b->nameentry), name); gtk_window_set_focus(GTK_WINDOW(b->window), b->nameentry); gtk_widget_show(b->nameentry); - - sep = gtk_hseparator_new(); - gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); - gtk_widget_show(sep); - + /* </pounce type="who"> */ + + + /* <pounce type="when"> */ + frame = gtk_frame_new(_("Pounce When")); + gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); + gtk_widget_show(GTK_WIDGET(frame)); + + table = gtk_table_new(2, 2, FALSE); + gtk_container_add(GTK_CONTAINER(frame), table); + gtk_container_set_border_width(GTK_CONTAINER(table), 5); + gtk_table_set_col_spacings(GTK_TABLE(table), 5); + gtk_widget_show(table); + b->p_signon = gtk_check_button_new_with_label(_("Pounce on sign on")); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->p_signon), TRUE); - gtk_box_pack_start(GTK_BOX(vbox), b->p_signon, FALSE, FALSE, 0); + gtk_table_attach(GTK_TABLE(table), b->p_signon, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); gtk_widget_show(b->p_signon); b->p_unaway = gtk_check_button_new_with_label(_("Pounce on return from away")); - gtk_box_pack_start(GTK_BOX(vbox), b->p_unaway, FALSE, FALSE, 0); + gtk_table_attach(GTK_TABLE(table), b->p_unaway, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); gtk_widget_show(b->p_unaway); b->p_unidle = gtk_check_button_new_with_label(_("Pounce on return from idle")); - gtk_box_pack_start(GTK_BOX(vbox), b->p_unidle, FALSE, FALSE, 0); + gtk_table_attach(GTK_TABLE(table), b->p_unidle, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); gtk_widget_show(b->p_unidle); - sep = gtk_hseparator_new(); - gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); - gtk_widget_show(sep); - - b->openwindow = gtk_check_button_new_with_label(_("Open IM window on pounce")); + label = gtk_label_new(NULL); + gtk_table_attach(GTK_TABLE(table), label, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0); + gtk_widget_show(label); + /* </pounce type="when"> */ + + /* <pounce type="action"> */ + frame = gtk_frame_new(_("Pounce Action")); + gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); + gtk_widget_show(GTK_WIDGET(frame)); + + table = gtk_table_new(4, 2, FALSE); + gtk_container_add(GTK_CONTAINER(frame), table); + gtk_container_set_border_width(GTK_CONTAINER(table), 5); + gtk_table_set_col_spacings(GTK_TABLE(table), 5); + gtk_table_set_row_spacings(GTK_TABLE(table), 5); + gtk_widget_show(table); + + b->openwindow = gtk_check_button_new_with_label(_("Open IM Window")); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->openwindow), FALSE); - gtk_box_pack_start(GTK_BOX(vbox), b->openwindow, FALSE, FALSE, 0); + gtk_table_attach(GTK_TABLE(table), b->openwindow, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); gtk_widget_show(b->openwindow); - b->sendim = gtk_check_button_new_with_label(_("Send IM on pounce")); + b->popupnotify = gtk_check_button_new_with_label(_("Popup Notification")); + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->popupnotify), FALSE); + gtk_table_attach(GTK_TABLE(table), b->popupnotify, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); + gtk_widget_show(b->popupnotify); + + b->sendim = gtk_check_button_new_with_label(_("Send Message")); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->sendim), TRUE); - gtk_box_pack_start(GTK_BOX(vbox), b->sendim, FALSE, FALSE, 0); + gtk_table_attach(GTK_TABLE(table), b->sendim, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); gtk_widget_show(b->sendim); - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); - gtk_widget_show(hbox); - - label = gtk_label_new(_("Message:")); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - b->messentry = gtk_entry_new(); - gtk_box_pack_start(GTK_BOX(hbox), b->messentry, TRUE, TRUE, 0); + gtk_table_attach(GTK_TABLE(table), b->messentry, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0); gtk_signal_connect(GTK_OBJECT(b->messentry), "activate", GTK_SIGNAL_FUNC(do_new_bp), b); gtk_widget_show(b->messentry); - gtk_signal_connect(GTK_OBJECT(b->sendim), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), - b->messentry); + gtk_signal_connect(GTK_OBJECT(b->sendim), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), + b->messentry); b->command = gtk_check_button_new_with_label(_("Execute command on pounce")); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->command), FALSE); - gtk_box_pack_start(GTK_BOX(vbox), b->command, FALSE, FALSE, 0); + gtk_table_attach(GTK_TABLE(table), b->command, 0, 1, 2, 3, GTK_FILL, 0, 0, 0); gtk_widget_show(b->command); - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); - gtk_widget_show(hbox); - - label = gtk_label_new(_("Command:")); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - b->commentry = gtk_entry_new(); - gtk_box_pack_start(GTK_BOX(hbox), b->commentry, TRUE, TRUE, 0); + gtk_table_attach(GTK_TABLE(table), b->commentry, 1, 2, 2, 3, GTK_FILL | GTK_EXPAND, 0, 0, 0); gtk_signal_connect(GTK_OBJECT(b->commentry), "activate", GTK_SIGNAL_FUNC(do_new_bp), b); gtk_widget_show(b->commentry); @@ -1181,39 +1204,25 @@ b->sound = gtk_check_button_new_with_label(_("Play sound on pounce")); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->sound), FALSE); - gtk_box_pack_start(GTK_BOX(vbox), b->sound, FALSE, FALSE, 0); + gtk_table_attach(GTK_TABLE(table), b->sound, 0, 1, 3, 4, GTK_FILL, 0, 0, 0); gtk_widget_show(b->sound); - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); - gtk_widget_show(hbox); - - label = gtk_label_new(_("Sound:")); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - b->soundentry = gtk_entry_new(); - gtk_box_pack_start(GTK_BOX(hbox), b->soundentry, TRUE, TRUE, 0); + gtk_table_attach(GTK_TABLE(table), b->soundentry, 1, 2, 3, 4, GTK_FILL | GTK_EXPAND, 0, 0, 0); gtk_signal_connect(GTK_OBJECT(b->soundentry), "activate", GTK_SIGNAL_FUNC(do_new_bp), b); gtk_widget_show(b->soundentry); gtk_widget_set_sensitive(b->soundentry, FALSE); gtk_signal_connect(GTK_OBJECT(b->sound), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), b->soundentry); - - sep = gtk_hseparator_new(); - gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); - gtk_widget_show(sep); + /* </pounce type="action"> */ b->save = gtk_check_button_new_with_label(_("Save this pounce after activation")); + gtk_container_set_border_width(GTK_CONTAINER(b->save), 7); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->save), FALSE); gtk_box_pack_start(GTK_BOX(vbox), b->save, FALSE, FALSE, 0); gtk_widget_show(b->save); - sep = gtk_hseparator_new(); - gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); - gtk_widget_show(sep); - bbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); gtk_widget_show(bbox);
--- a/src/gaim.h Fri Oct 19 09:58:39 2001 +0000 +++ b/src/gaim.h Fri Oct 19 18:44:52 2001 +0000 @@ -141,16 +141,18 @@ log_quit }; -#define OPT_POUNCE_POPUP 0x001 -#define OPT_POUNCE_SEND_IM 0x002 -#define OPT_POUNCE_COMMAND 0x004 -#define OPT_POUNCE_SOUND 0x008 +#define OPT_POUNCE_POPUP 0x001 +#define OPT_POUNCE_SEND_IM 0x002 +#define OPT_POUNCE_COMMAND 0x004 +#define OPT_POUNCE_SOUND 0x008 -#define OPT_POUNCE_SIGNON 0x010 -#define OPT_POUNCE_UNAWAY 0x020 -#define OPT_POUNCE_UNIDLE 0x040 +#define OPT_POUNCE_SIGNON 0x010 +#define OPT_POUNCE_UNAWAY 0x020 +#define OPT_POUNCE_UNIDLE 0x040 -#define OPT_POUNCE_SAVE 0x100 +#define OPT_POUNCE_SAVE 0x100 + +#define OPT_POUNCE_NOTIFY 0x200 struct buddy_pounce { char name[80];