Mercurial > pidgin.yaz
diff gtk/gtknotify.c @ 15185:a505577b6f4b
[gaim-migrate @ 17973]
I realized doing Gmail notifications that mail notifications spawn dialogs that are non-user-initiated.
I no longer like this, so I came up with "headlines," non-critical alerts that appear at the top of the
buddy list until they're clicked or a new headline is set. Now, when you get a new mail notification,
a headline will appear saying "You have 60 new e-mails." When you click it, the old mail notification
will show up.
Also, it looks wicked awesome: http://gaim.sf.net/sean/images/headline.png
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Tue, 12 Dec 2006 08:53:35 +0000 |
parents | fe05223b5d04 |
children | b52cdf3cff4f |
line wrap: on
line diff
--- a/gtk/gtknotify.c Tue Dec 12 08:52:46 2006 +0000 +++ b/gtk/gtknotify.c Tue Dec 12 08:53:35 2006 +0000 @@ -83,6 +83,7 @@ GtkTreeStore *treemodel; GtkLabel *label; GtkWidget *open_button; + int total_count; }; static GaimMailDialog *mail_dialog = NULL; @@ -426,6 +427,7 @@ if (detailed) { dialog = mail_dialog->dialog; + mail_dialog->total_count += count; while (count--) { char *to_text = NULL; @@ -500,7 +502,16 @@ g_free(detail_text); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); } - gtk_widget_show_all(dialog); + if (!GTK_WIDGET_VISIBLE(dialog)) { + GdkPixbuf *pixbuf = gtk_widget_render_icon(dialog, GAIM_STOCK_ICON_ONLINE_MSG, + GTK_ICON_SIZE_BUTTON, NULL); + char *label_text = g_strdup_printf(ngettext("<b>You have %d new e-mail.</b>", + "<b>You have %d new e-mails.</b>", + mail_dialog->total_count), mail_dialog->total_count); + gaim_gtk_blist_set_headline(label_text, + pixbuf, G_CALLBACK(gtk_widget_show_all), dialog); + g_object_unref(pixbuf); + } return data; }