Mercurial > pidgin
changeset 5538:f7dc3f656f03
[gaim-migrate @ 5938]
No more connection_has_mail()!
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Tue, 27 May 2003 08:09:10 +0000 |
parents | 3becf79500d2 |
children | de09863bd4b5 |
files | src/prpl.c src/prpl.h |
diffstat | 2 files changed, 0 insertions(+), 129 deletions(-) [+] |
line wrap: on
line diff
--- a/src/prpl.c Tue May 27 03:38:52 2003 +0000 +++ b/src/prpl.c Tue May 27 08:09:10 2003 +0000 @@ -205,118 +205,6 @@ } } -struct mail_notify { - struct gaim_connection *gc; - GtkWidget *email_win; - GtkWidget *email_label; - char *url; -}; -GSList *mailnots = NULL; - -static struct mail_notify *find_mail_notify(struct gaim_connection *gc) -{ - GSList *m = mailnots; - while (m) { - if (((struct mail_notify *)m->data)->gc == gc) - return m->data; - m = m->next; - } - return NULL; -} - -static void des_email_win(GtkWidget *w, struct mail_notify *mn) -{ - if (w != mn->email_win) { - gtk_widget_destroy(mn->email_win); - return; - } - - gaim_debug(GAIM_DEBUG_INFO, "prpl", "Removing mail notification.\n"); - - mailnots = g_slist_remove(mailnots, mn); - if (mn->url) - g_free(mn->url); - g_free(mn); -} - -void connection_has_mail(struct gaim_connection *gc, int count, const char *from, const char *subject, const char *url) -{ - GtkWidget *hbox; - GtkWidget *vbox; - GtkWidget *urlbut; - GtkWidget *close; - - struct mail_notify *mn; - char buf[2048]; - - if (!(gc->account->options & OPT_ACCT_MAIL_CHECK)) - return; - - if (!(mn = find_mail_notify(gc))) { - mn = g_new0(struct mail_notify, 1); - mn->gc = gc; - mailnots = g_slist_append(mailnots, mn); - } - - if (count < 0) { - if (from && subject) - g_snprintf(buf, sizeof buf, _("%s has mail from %s: %s"), gc->username, from, *subject ? subject : _("No Subject")); - else - g_snprintf(buf, sizeof buf, _("%s has new mail."), gc->username); - } else if (count > 0) { - g_snprintf(buf, sizeof buf, - ngettext("%s has %d new message.","%s has %d new messages.",count), gc->username, count); - } else if (mn->email_win) { - gtk_widget_destroy(mn->email_win); - return; - } else - return; - - if (mn->email_win) { - gtk_label_set_text(GTK_LABEL(mn->email_label), buf); - return; - } - - - GAIM_DIALOG(mn->email_win); - gtk_window_set_role(GTK_WINDOW(mn->email_win), "mail"); - gtk_window_set_resizable(GTK_WINDOW(mn->email_win), TRUE); - gtk_window_set_title(GTK_WINDOW(mn->email_win), _("Gaim - New Mail")); - g_signal_connect(G_OBJECT(mn->email_win), "destroy", - G_CALLBACK(des_email_win), mn); - gtk_widget_realize(mn->email_win); - - vbox = gtk_vbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); - gtk_container_add(GTK_CONTAINER(mn->email_win), vbox); - - mn->email_label = gtk_label_new(buf); - gtk_label_set_text(GTK_LABEL(mn->email_label), buf); - gtk_label_set_line_wrap(GTK_LABEL(mn->email_label), TRUE); - gtk_box_pack_start(GTK_BOX(vbox), mn->email_label, FALSE, TRUE, 5); - - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - - if (url) { - mn->url = g_strdup(url); - urlbut = gaim_pixbuf_button_from_stock(_("Open Mail"), GTK_STOCK_JUMP_TO, GAIM_BUTTON_HORIZONTAL); - gtk_box_pack_end(GTK_BOX(hbox), urlbut, 0, 0, 5); - g_signal_connect(G_OBJECT(urlbut), "clicked", - G_CALLBACK(open_url), mn->url); - g_signal_connect(G_OBJECT(urlbut), "clicked", - G_CALLBACK(des_email_win), mn); - } - - close = gaim_pixbuf_button_from_stock(_("Close"), GTK_STOCK_CLOSE, GAIM_BUTTON_HORIZONTAL); - gtk_window_set_focus(GTK_WINDOW(mn->email_win), close); - gtk_box_pack_end(GTK_BOX(hbox), close, 0, 0, 5); - g_signal_connect(G_OBJECT(close), "clicked", - G_CALLBACK(des_email_win), mn); - - gtk_widget_show_all(mn->email_win); -} - struct icon_data { struct gaim_connection *gc; char *who;
--- a/src/prpl.h Tue May 27 03:38:52 2003 +0000 +++ b/src/prpl.h Tue May 27 08:09:10 2003 +0000 @@ -346,23 +346,6 @@ const char *who, const char *alias, const char *msg); /** - * Called to notify the user that the account has new mail. - * - * If @a count is less than 0, the dialog will display the the sender - * and the subject, if available. If @a count is greater than 0, it will - * display how many messages the user has. - * - * @param gc The gaim connection. - * @param count The number of new e-mails. - * @param from The sender, or @c NULL. - * @param subject The subject, or @c NULL. - * @param url The URL to go to to read the new mail. - */ -void connection_has_mail(struct gaim_connection *gc, int count, - const char *from, const char *subject, - const char *url); - -/** * Retrieves and sets the new buddy icon for a user. * * @param gc The gaim connection.