# HG changeset patch # User Sean Egan # Date 1166046892 0 # Node ID b52cdf3cff4f3e401fc6dbdf6fd19b688711ae9c # Parent c9bb2131bdf3e8b2735e2e6114a96ad5439fdc58 [gaim-migrate @ 17989] - Fix a crash when 'detailed' is FALSE - Google Talk will return details for the first 30 e-mails, and give you the total count of new e-mails I made it so that if the total count is > 30, it doesn't show details, and takes you directly to the Inbox - I still need to integrate getting multiple non-detailed mail notifications committer: Tailor Script diff -r c9bb2131bdf3 -r b52cdf3cff4f gtk/gtknotify.c --- a/gtk/gtknotify.c Wed Dec 13 21:29:16 2006 +0000 +++ b/gtk/gtknotify.c Wed Dec 13 21:54:52 2006 +0000 @@ -306,6 +306,21 @@ (url == NULL ? NULL : &url)); } +struct inbox_info { + char *url; + void *handle; +}; + +static void +open_inbox_cb(struct inbox_info *inbox) +{ + if (inbox->url) + gaim_notify_uri(inbox->handle, inbox->url); + g_free(inbox->url); + g_free(inbox); +} + + static void * gaim_gtk_notify_emails(GaimConnection *gc, size_t count, gboolean detailed, const char **subjects, const char **froms, @@ -322,6 +337,22 @@ account = gaim_connection_get_account(gc); + if (!detailed) { + struct inbox_info *inbox = g_new0(struct inbox_info, 1); + GdkPixbuf *pixbuf = gtk_widget_render_icon(gaim_gtk_blist_get_default_gtk_blist()->headline_hbox, + GAIM_STOCK_ICON_ONLINE_MSG, GTK_ICON_SIZE_BUTTON, NULL); + char *label_text = g_strdup_printf(ngettext("You have %d new e-mail.", + "You have %d new e-mails.", + count),count); + + inbox->handle = gc; + inbox->url = urls ? g_strdup(urls[0]) : NULL; + gaim_gtk_blist_set_headline(label_text, + pixbuf, G_CALLBACK(open_inbox_cb), inbox); + g_object_unref(pixbuf); + return; + } + if (mail_dialog == NULL || !detailed) { GtkCellRenderer *rend; diff -r c9bb2131bdf3 -r b52cdf3cff4f libgaim/protocols/jabber/google.c --- a/libgaim/protocols/jabber/google.c Wed Dec 13 21:29:16 2006 +0000 +++ b/libgaim/protocols/jabber/google.c Wed Dec 13 21:54:52 2006 +0000 @@ -70,7 +70,7 @@ url = xmlnode_get_attrib(child, "url"); if (!url || !*url) url = "http://www.gmail.com"; - + message= xmlnode_get_child(child, "mail-thread-info"); for (i=0; message; message = xmlnode_get_next_twin(message), i++) { subject_node = xmlnode_get_child(message, "subject"); @@ -106,9 +106,10 @@ } } - if (i>0) - gaim_notify_emails(js->gc, returned_count, TRUE, subjects, froms, tos, - urls, NULL, js->gc->account); + if (i>0) + gaim_notify_emails(js->gc, count, count == returned_count, subjects, froms, tos, + urls, NULL, NULL); + g_free(to_name); g_free(tos); g_free(froms);