Mercurial > pidgin.yaz
changeset 27342:8796eaaca38a
Fix the mail_dialog->total_count and use that to tell when the dialog is empty.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Fri, 03 Jul 2009 04:25:45 +0000 |
parents | 1643ace55ef8 |
children | d2d796aed2c7 |
files | pidgin/gtknotify.c |
diffstat | 1 files changed, 11 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtknotify.c Fri Jul 03 04:21:16 2009 +0000 +++ b/pidgin/gtknotify.c Fri Jul 03 04:25:45 2009 +0000 @@ -554,6 +554,8 @@ gtk_tree_store_remove(treemodel, &iter); advanced = (iter.stamp == 0) ? FALSE : TRUE; #endif + mail_dialog->total_count -= data->count; + if (data->purple_has_handle) purple_notify_close(PURPLE_NOTIFY_EMAILS, data); else @@ -593,7 +595,8 @@ PIDGIN_MAIL_DATA, data, -1); data->account = account; - data->count = count; + /* count == 0 indicates we're adding a single detailed e-mail */ + data->count = count > 0 ? count : 1; if (icon) g_object_unref(icon); @@ -626,7 +629,7 @@ mail_dialog->total_count += count; if (detailed) { - while (count--) { + for ( ; count; --count) { char *to_text = NULL; char *from_text = NULL; char *subject_text = NULL; @@ -687,14 +690,14 @@ } g_free(notification); } else { - GtkTreeIter iter; - /* Clear out all mails for the account */ pidgin_notify_add_mail(mail_dialog->treemodel, account, NULL, NULL, 0, TRUE, NULL); - if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(mail_dialog->treemodel), &iter)) { - /* There is no API to clear the headline specifically */ - /* This will trigger reset_mail_dialog() */ + if (mail_dialog->total_count == 0) { + /* + * There is no API to clear the headline specifically + * This will trigger reset_mail_dialog() + */ pidgin_blist_set_headline(NULL, NULL, NULL, NULL, NULL); return NULL; } @@ -1561,15 +1564,11 @@ static void signed_off_cb(PurpleConnection *gc, gpointer unused) { - GtkTreeIter iter; - /* Clear any pending emails for this account */ pidgin_notify_emails(gc, 0, FALSE, NULL, NULL, NULL, NULL); - if (mail_dialog != NULL && - !gtk_tree_model_get_iter_first(GTK_TREE_MODEL(mail_dialog->treemodel), &iter)) { + if (mail_dialog != NULL && mail_dialog->total_count == 0) reset_mail_dialog(NULL); - } } static void*