Mercurial > pidgin.yaz
changeset 27325:ecdc58da4cdd
Clear the notifications via a signal instead of pidgin_close_notify.
If you have the detailed new mail window open when you sign off all accounts
with mail notifications, the window won't be closed, which is kinda weird.
Let's first see if this is on the right track before I go overboard.
Refs #9345. Sulabh, please test this!
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Thu, 02 Jul 2009 04:15:21 +0000 |
parents | fd45bfd89872 |
children | 7a4f56967512 |
files | pidgin/gtkmain.c pidgin/gtknotify.c pidgin/gtknotify.h |
diffstat | 3 files changed, 41 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkmain.c Thu Jul 02 01:52:48 2009 +0000 +++ b/pidgin/gtkmain.c Thu Jul 02 04:15:21 2009 +0000 @@ -313,6 +313,7 @@ pidgin_smileys_init(); pidgin_utils_init(); pidgin_medias_init(); + pidgin_notify_init(); } static GHashTable *ui_info = NULL; @@ -327,6 +328,7 @@ /* Uninit */ pidgin_utils_uninit(); + pidgin_notify_uninit(); pidgin_smileys_uninit(); pidgin_conversations_uninit(); pidgin_status_uninit();
--- a/pidgin/gtknotify.c Thu Jul 02 01:52:48 2009 +0000 +++ b/pidgin/gtknotify.c Thu Jul 02 04:15:21 2009 +0000 @@ -301,6 +301,7 @@ if (id == GTK_RESPONSE_YES) { + /* A single row activated. Remove that row. */ GtkTreeSelection *selection; selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); @@ -325,6 +326,7 @@ } else { + /* Remove all the rows */ while (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(mail_dialog->treemodel), &iter)) { gtk_tree_model_get(GTK_TREE_MODEL(dialog->treemodel), &iter, @@ -1107,9 +1109,6 @@ { PidginNotifyMailData *data = (PidginNotifyMailData *)ui_handle; - /* Close the notification dialog */ - pidgin_notify_emails(purple_account_get_connection(data->account), - 0, FALSE, NULL, NULL, NULL, NULL); if (data) { g_free(data->url); g_free(data); @@ -1567,6 +1566,33 @@ return pidgin_get_dialog(type, model); } +static void +signed_off_cb(PurpleConnection *gc, gpointer unused) +{ + /* Clear any pending emails for this account */ + pidgin_notify_emails(gc, 0, FALSE, NULL, NULL, NULL, NULL); +} + +static void* +pidgin_notify_get_handle(void) +{ + static int handle; + return &handle; +} + +void pidgin_notify_init(void) +{ + void *handle = pidgin_notify_get_handle(); + + purple_signal_connect(purple_connections_get_handle(), "signed-off", + handle, PURPLE_CALLBACK(signed_off_cb), NULL); +} + +void pidgin_notify_uninit(void) +{ + purple_signals_disconnect_by_handle(pidgin_notify_get_handle()); +} + static PurpleNotifyUiOps ops = { pidgin_notify_message,
--- a/pidgin/gtknotify.h Thu Jul 02 01:52:48 2009 +0000 +++ b/pidgin/gtknotify.h Thu Jul 02 04:15:21 2009 +0000 @@ -49,4 +49,14 @@ */ PurpleNotifyUiOps *pidgin_notify_get_ui_ops(void); +/** + * Initializes the GTK+ notifications subsystem. + */ +void pidgin_notify_init(void); + +/** + * Uninitialized the GTK+ notifications subsystem. + */ +void pidgin_notify_uninit(void); + #endif /* _PIDGINNOTIFY_H_ */