# HG changeset patch # User Paul Aurich # Date 1246508121 0 # Node ID ecdc58da4cddc56598cce17a20068fc83a827b1d # Parent fd45bfd8987260270c01223560e0b90b4f422bb9 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! diff -r fd45bfd89872 -r ecdc58da4cdd pidgin/gtkmain.c --- 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(); diff -r fd45bfd89872 -r ecdc58da4cdd pidgin/gtknotify.c --- 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, diff -r fd45bfd89872 -r ecdc58da4cdd pidgin/gtknotify.h --- 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_ */