comparison src/prpl.c @ 2153:0befa2d2e540

[gaim-migrate @ 2163] moving mail notifications to the core. this makes things much easier on the protocols. next steps: make buddy right-click menu stuff generated by the core (based on information provided by the protocols, similar to the away menu stuff); make entry-widget protocol-specific user options generated by the core based on what the protocols tell it (in a similar way). committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 22 Aug 2001 21:11:58 +0000
parents ecd5f3d29f47
children dca8e00d7de0
comparison
equal deleted inserted replaced
2152:f631cfc8e824 2153:0befa2d2e540
472 c = g_slist_next(c); 472 c = g_slist_next(c);
473 } 473 }
474 } 474 }
475 } 475 }
476 476
477 static void des_email_win(GtkWidget *w, struct gaim_connection *yd) {
478 gtk_widget_destroy(yd->email_win);
479 if (yd->email_win == w)
480 yd->email_win = NULL;
481 yd->email_label = NULL;
482 }
483
484 void connection_has_mail(struct gaim_connection *gc, int count, const char *from, const char *subject)
485 {
486 char buf[2048];
487
488 if (!(gc->user->options & OPT_USR_MAIL_CHECK))
489 return;
490
491 if (count < 0 && from && subject) {
492 g_snprintf(buf, sizeof buf, "%s has mail from %s: %s",
493 gc->username, from, subject);
494 if (!gc->email_win) {
495 GtkWidget *close;
496
497 gc->email_win = gtk_dialog_new();
498 gtk_window_set_policy(GTK_WINDOW(gc->email_win), 0, 0, 1);
499 gtk_container_set_border_width(GTK_CONTAINER(gc->email_win), 5);
500 gtk_window_set_title(GTK_WINDOW(gc->email_win), "New Mail");
501 gtk_signal_connect(GTK_OBJECT(gc->email_win), "destroy",
502 GTK_SIGNAL_FUNC(des_email_win), gc);
503 gtk_widget_realize(gc->email_win);
504 aol_icon(gc->email_win->window);
505
506 gc->email_label = gtk_label_new(buf);
507 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(gc->email_win)->vbox),
508 gc->email_label, 0, 0, 5);
509 gtk_widget_show(gc->email_label);
510
511 close = picture_button(gc->email_win, _("Close"), cancel_xpm);
512 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(gc->email_win)->action_area),
513 close, 0, 0, 5);
514 gtk_signal_connect(GTK_OBJECT(close), "clicked",
515 GTK_SIGNAL_FUNC(des_email_win), gc);
516
517 gtk_widget_show(gc->email_win);
518 }
519 gtk_label_set_text(GTK_LABEL(gc->email_label), buf);
520 } else if (count) {
521 g_snprintf(buf, sizeof buf, "%s has %d new message%s.",
522 gc->username, count, count == 1 ? "" : "s");
523 if (!gc->email_win) {
524 GtkWidget *close;
525
526 gc->email_win = gtk_dialog_new();
527 gtk_window_set_policy(GTK_WINDOW(gc->email_win), 0, 0, 1);
528 gtk_container_set_border_width(GTK_CONTAINER(gc->email_win), 5);
529 gtk_window_set_title(GTK_WINDOW(gc->email_win), "New Mail");
530 gtk_signal_connect(GTK_OBJECT(gc->email_win), "destroy",
531 GTK_SIGNAL_FUNC(des_email_win), gc);
532 gtk_widget_realize(gc->email_win);
533 aol_icon(gc->email_win->window);
534
535 gc->email_label = gtk_label_new(buf);
536 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(gc->email_win)->vbox),
537 gc->email_label, 0, 0, 5);
538 gtk_widget_show(gc->email_label);
539
540 close = picture_button(gc->email_win, _("Close"), cancel_xpm);
541 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(gc->email_win)->action_area),
542 close, 0, 0, 5);
543 gtk_signal_connect(GTK_OBJECT(close), "clicked",
544 GTK_SIGNAL_FUNC(des_email_win), gc);
545
546 gtk_widget_show(gc->email_win);
547 }
548 gtk_label_set_text(GTK_LABEL(gc->email_label), buf);
549 } else if (gc->email_win)
550 gtk_widget_destroy(gc->email_win);
551 }
552
553 /*
477 struct ft_req { 554 struct ft_req {
478 struct gaim_connection *gc; 555 struct gaim_connection *gc;
479 gboolean send; 556 gboolean send;
480 gboolean multiple; 557 gboolean multiple;
481 guint size; 558 guint size;
498 g_free(fr); 575 g_free(fr);
499 } 576 }
500 577
501 static void do_exist_dialog(const char *name, unsigned long size, struct ft_req *fr) 578 static void do_exist_dialog(const char *name, unsigned long size, struct ft_req *fr)
502 { 579 {
503 /* 580 \*
504 GtkWidget *window; 581 GtkWidget *window;
505 GtkWidget *vbox; 582 GtkWidget *vbox;
506 GtkWidget *label; 583 GtkWidget *label;
507 GtkWidget *hbox; 584 GtkWidget *hbox;
508 GtkWidget *button; 585 GtkWidget *button;
511 g_snprintf(buf, sizeof(buf), "It appears that %s already exists. Do you want to " 588 g_snprintf(buf, sizeof(buf), "It appears that %s already exists. Do you want to "
512 "overwrite the file%s or cancel the transfer?", name, 589 "overwrite the file%s or cancel the transfer?", name,
513 (size <= fr->size) ? ", resume the download," : ""); 590 (size <= fr->size) ? ", resume the download," : "");
514 591
515 window = gtk_window_new(GTK_WINDOW_DIALOG); 592 window = gtk_window_new(GTK_WINDOW_DIALOG);
516 */ 593 *\
517 } 594 }
518 595
519 static void ftgotfile(gpointer w, struct ft_req *fr) 596 static void ftgotfile(gpointer w, struct ft_req *fr)
520 { 597 {
521 const char *fname = gtk_file_selection_get_filename(GTK_FILE_SELECTION(fr->fd)); 598 const char *fname = gtk_file_selection_get_filename(GTK_FILE_SELECTION(fr->fd));
536 gtk_widget_destroy(fr->fd); 613 gtk_widget_destroy(fr->fd);
537 } 614 }
538 615
539 static void ftrrok(gpointer w, struct ft_req *ft) 616 static void ftrrok(gpointer w, struct ft_req *ft)
540 { 617 {
541 /* ft is going to be free'd as soon as we leave this function, so we'll copy it */ 618 \* ft is going to be free'd as soon as we leave this function, so we'll copy it *\
542 struct ft_req *fr = g_memdup(ft, sizeof(struct ft_req)); 619 struct ft_req *fr = g_memdup(ft, sizeof(struct ft_req));
543 char buf[256]; 620 char buf[256];
544 621
545 if (fr->send) 622 if (fr->send)
546 fr->fd = gtk_file_selection_new(_("Gaim - Select File")); 623 fr->fd = gtk_file_selection_new(_("Gaim - Select File"));
590 g_snprintf(buf, sizeof(buf), "%s has just asked %s to receive a file.", 667 g_snprintf(buf, sizeof(buf), "%s has just asked %s to receive a file.",
591 who, gc->username); 668 who, gc->username);
592 669
593 do_ask_dialog(buf, fr, ftrrok, ftrrno); 670 do_ask_dialog(buf, fr, ftrrok, ftrrno);
594 } 671 }
672 */