| 373 } |
373 } |
| 374 |
374 |
| 375 static void |
375 static void |
| 376 reset_mail_dialog(GtkDialog *unused) |
376 reset_mail_dialog(GtkDialog *unused) |
| 377 { |
377 { |
| |
378 g_return_if_fail(mail_dialog != NULL); |
| |
379 |
| 378 if (mail_dialog->in_use) |
380 if (mail_dialog->in_use) |
| 379 return; |
381 return; |
| 380 gtk_widget_destroy(mail_dialog->dialog); |
382 gtk_widget_destroy(mail_dialog->dialog); |
| 381 g_free(mail_dialog); |
383 g_free(mail_dialog); |
| 382 mail_dialog = NULL; |
384 mail_dialog = NULL; |
| |
385 purple_signal_emit(purple_notify_get_handle(), "displaying-emails-clear"); |
| |
386 } |
| |
387 |
| |
388 gboolean |
| |
389 pidgin_notify_emails_pending() |
| |
390 { |
| |
391 #if GTK_CHECK_VERSION(2,18,0) |
| |
392 return mail_dialog != NULL |
| |
393 && !gtk_widget_get_visible(mail_dialog->dialog); |
| |
394 #else |
| |
395 return mail_dialog != NULL |
| |
396 && !GTK_WIDGET_VISIBLE(mail_dialog->dialog); |
| |
397 #endif |
| |
398 } |
| |
399 |
| |
400 void pidgin_notify_emails_present(void *data) |
| |
401 { |
| |
402 if (pidgin_notify_emails_pending()) { |
| |
403 gtk_widget_show_all(mail_dialog->dialog); |
| |
404 mail_dialog->in_use = TRUE; |
| |
405 pidgin_blist_set_headline(NULL, NULL, NULL, NULL, NULL); |
| |
406 mail_dialog->in_use = FALSE; |
| |
407 } |
| |
408 purple_signal_emit(purple_notify_get_handle(), "displaying-emails-clear"); |
| 383 } |
409 } |
| 384 |
410 |
| 385 static void |
411 static void |
| 386 email_response_cb(GtkDialog *unused, gint id, PidginNotifyDialog *unused2) |
412 email_response_cb(GtkDialog *unused, gint id, PidginNotifyDialog *unused2) |
| 387 { |
413 { |
| 794 mail_dialog->total_count), mail_dialog->total_count); |
820 mail_dialog->total_count), mail_dialog->total_count); |
| 795 mail_dialog->in_use = TRUE; /* So that _set_headline doesn't accidentally |
821 mail_dialog->in_use = TRUE; /* So that _set_headline doesn't accidentally |
| 796 remove the notifications when replacing an |
822 remove the notifications when replacing an |
| 797 old notification. */ |
823 old notification. */ |
| 798 pidgin_blist_set_headline(label_text, |
824 pidgin_blist_set_headline(label_text, |
| 799 pixbuf, G_CALLBACK(gtk_widget_show_all), mail_dialog->dialog, |
825 pixbuf, G_CALLBACK(pidgin_notify_emails_present), mail_dialog->dialog, |
| 800 (GDestroyNotify)reset_mail_dialog); |
826 (GDestroyNotify)reset_mail_dialog); |
| 801 mail_dialog->in_use = FALSE; |
827 mail_dialog->in_use = FALSE; |
| 802 g_free(label_text); |
828 g_free(label_text); |
| 803 if (pixbuf) |
829 if (pixbuf) |
| 804 g_object_unref(pixbuf); |
830 g_object_unref(pixbuf); |