Mercurial > pidgin.yaz
changeset 1137:5b5d03dfa48a
[gaim-migrate @ 1147]
Started setting up the new Buddy Pounce code.
The UI needs a little more work as it is a little cluttered right now.
The .gaimrc file is now in revision 4. It properly saves buddy pounces
between v3 and v4 and converts them.
Actual functionality will be commited soon. I remembered that I didnt commit
so I woke up to do so just incase :D
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Sun, 26 Nov 2000 10:45:49 +0000 |
parents | c8615d023aaf |
children | 68f2f021ad1b |
files | ChangeLog src/aim.c src/buddy.c src/dialogs.c src/gaim.h src/gaimrc.c |
diffstat | 6 files changed, 114 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Nov 26 07:35:57 2000 +0000 +++ b/ChangeLog Sun Nov 26 10:45:49 2000 +0000 @@ -13,6 +13,7 @@ * Perl got updates (reread plugins/PERL-HOWTO) * Spell checker now uses gtkspell * Auto-Away (thanks, yet again, to bmiller ;) + * More buddy pounce options version 0.10.3 (10/09/2000): * Segfault when viewing user info fixed
--- a/src/aim.c Sun Nov 26 07:35:57 2000 +0000 +++ b/src/aim.c Sun Nov 26 10:45:49 2000 +0000 @@ -621,6 +621,7 @@ account_editor (NULL, NULL); } else if (do_login_ret == -1) show_login(); + gtk_main(); #endif /* USE_APPLET */
--- a/src/buddy.c Sun Nov 26 07:35:57 2000 +0000 +++ b/src/buddy.c Sun Nov 26 10:45:49 2000 +0000 @@ -1377,7 +1377,6 @@ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), remmenu); gtk_widget_show(remmenu); - sep = gtk_hseparator_new(); menuitem = gtk_menu_item_new(); gtk_menu_append(GTK_MENU(bpmenu), menuitem); @@ -1398,8 +1397,6 @@ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), messmenu); gtk_widget_show(menuitem); - - mess = gtk_menu_item_new_with_label(b->message); gtk_menu_append(GTK_MENU(messmenu), mess); gtk_widget_show(mess);
--- a/src/dialogs.c Sun Nov 26 07:35:57 2000 +0000 +++ b/src/dialogs.c Sun Nov 26 10:45:49 2000 +0000 @@ -116,6 +116,10 @@ GtkWidget *messentry; GtkWidget *sendim; GtkWidget *openwindow; + GtkWidget *p_signon; + GtkWidget *p_unaway; + GtkWidget *p_unidle; + GtkWidget *menu; }; struct findbyemail { @@ -1040,16 +1044,71 @@ bp->sendim = 1; else bp->sendim = 0; + + if (GTK_TOGGLE_BUTTON(b->p_signon)->active) + bp->signon = 1; + else + bp->signon = 0; + + if (GTK_TOGGLE_BUTTON(b->p_unaway)->active) + bp->unaway = 1; + else + bp->unaway = 0; + + if (GTK_TOGGLE_BUTTON(b->p_unidle)->active) + bp->unidle = 1; + else + bp->unidle = 0; buddy_pounces = g_list_append(buddy_pounces, bp); do_bp_menu(); destroy_dialog(NULL, b->window); + save_prefs(); g_free(b); } +static void pounce_user_menu(struct addbp *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, 5); + gtk_widget_show(hbox); + + label = gtk_label_new(_("Pounce buddy as:")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); + gtk_widget_show(label); + + optmenu = gtk_option_menu_new(); + gtk_box_pack_start(GTK_BOX(hbox), optmenu, FALSE, FALSE, 5); + 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_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), 0); + + b->menu = optmenu; +} + void show_new_bp(char *name) { @@ -1082,16 +1141,35 @@ GTK_SIGNAL_FUNC(destroy_dialog), b->window); gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 5); + /* Pounce as menu */ + pounce_user_menu(b, vbox); + /* Put the buttons in the box */ label = gtk_label_new(_("Buddy To Pounce:")); gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), b->nameentry, FALSE, FALSE, 0); - b->openwindow = gtk_check_button_new_with_label(_("Open IM Window on Buddy Logon")); + /* Set up the different options */ + b->p_signon = gtk_check_button_new_with_label(_("Sign On")); + b->p_unaway = gtk_check_button_new_with_label(_("Return from away")); + b->p_unidle = gtk_check_button_new_with_label(_("Return from idle")); + + /* Show them */ + gtk_widget_show(b->p_signon); + gtk_widget_show(b->p_unaway); + gtk_widget_show(b->p_unidle); + + /* And pack'em */ + gtk_box_pack_start(GTK_BOX(vbox), b->p_signon, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), b->p_unaway, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), b->p_unidle, FALSE, FALSE, 0); + + /* And now the other stuff */ + b->openwindow = gtk_check_button_new_with_label(_("Open IM window on pounce")); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->openwindow), FALSE); - b->sendim = gtk_check_button_new_with_label(_("Send IM on Buddy Logon")); + b->sendim = gtk_check_button_new_with_label(_("Send IM on pounce")); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->sendim), TRUE); gtk_widget_show(b->openwindow);
--- a/src/gaim.h Sun Nov 26 07:35:57 2000 +0000 +++ b/src/gaim.h Sun Nov 26 10:45:49 2000 +0000 @@ -245,6 +245,10 @@ char message[2048]; int popup; int sendim; + + int signon; + int unaway; + int unidle; }; struct away_message {
--- a/src/gaimrc.c Sun Nov 26 07:35:57 2000 +0000 +++ b/src/gaimrc.c Sun Nov 26 10:45:49 2000 +0000 @@ -36,6 +36,7 @@ /* for people like myself, who are too lazy to add an away msg :) */ #define BORING_DEFAULT_AWAY_MSG "sorry, i ran out for a while. bbl" +#define MAX_VALUES 7 GList *aim_users = NULL; int general_options; @@ -51,7 +52,7 @@ struct parse { char option[256]; - char value[6][256]; + char value[MAX_VALUES][256]; }; static struct parse *parse_line(char *line) @@ -60,8 +61,13 @@ int inopt = 1, inval = 0, curval = -1; int optlen = 0, vallen = 0; static struct parse p; - + int x; + for (x = 0; x < MAX_VALUES; x++) { + p.value[x][0] = 0; + } + + while(*c) { if (*c == '\t') { c++; @@ -115,6 +121,7 @@ } c++; } + return &p; } @@ -277,7 +284,23 @@ b->popup = atoi(p->value[2]); b->sendim = atoi(p->value[3]); - + + /* Let's check our version and see what's going on here */ + if ((p->value[4]) && (strlen(p->value[4]) > 0)) + { + /* If we have data, lets use it */ + b->signon = atoi(p->value[4]); + b->unaway = atoi(p->value[5]); + b->unidle = atoi(p->value[6]); + } + else + { + /* Otherwise, we have old info. Let's adjust */ + b->signon = 1; + b->unaway = 0; + b->unidle = 0; + } + filter_break(b->message); buddy_pounces = g_list_append(buddy_pounces, b); } @@ -295,7 +318,6 @@ { while (pnc) { char *str1, *str2; - int popup, sendim; b = (struct buddy_pounce *)pnc->data; @@ -306,10 +328,8 @@ str2 = malloc(1); str2[0] = 0; } - popup = b->popup; - sendim = b->sendim; - fprintf(f, "\tentry { %s } { %s } { %d } { %d }\n", str1, str2, popup, sendim); + fprintf(f, "\tentry { %s } { %s } { %d } { %d } { %d } { %d } { %d }\n", str1, str2, b->popup, b->sendim, b->signon, b->unaway, b->unidle); /* escape_text2 uses malloc(), so we don't want to g_free these */ free(str1); @@ -841,7 +861,6 @@ if ( (ver == 2) || (buf[0] != '#')) { set_defaults(TRUE); } - } void save_prefs() @@ -852,7 +871,7 @@ if (getenv("HOME")) { g_snprintf(buf, sizeof(buf), "%s/.gaimrc", getenv("HOME")); if ((f = fopen(buf,"w"))) { - fprintf(f, "# .gaimrc v%d\n", 3); + fprintf(f, "# .gaimrc v%d\n", 4); gaimrc_write_users(f); gaimrc_write_options(f); gaimrc_write_sounds(f);