Mercurial > pidgin.yaz
diff pidgin/gtknotify.c @ 23113:8c3444f04709
propagate from branch 'im.pidgin.pidgin' (head d7144f5dbbde09137aff1ceadfd419e25303bf7d)
to branch 'im.pidgin.pidgin.next.minor' (head b6f1c6f279a87ac4b59426eea116c349eb31fe8c)
author | Evan Schoenberg <evan.s@dreskin.net> |
---|---|
date | Wed, 07 May 2008 12:14:28 +0000 |
parents | 66914f306712 |
children | 502bac8b2b4c |
line wrap: on
line diff
--- a/pidgin/gtknotify.c Mon May 05 06:55:00 2008 +0000 +++ b/pidgin/gtknotify.c Wed May 07 12:14:28 2008 +0000 @@ -52,6 +52,7 @@ GtkWidget *label; GtkTreeIter iter; int count; + gboolean purple_has_handle; } PidginNotifyMailData; typedef struct @@ -100,6 +101,8 @@ const char **froms, const char **tos, const char **urls); +static void pidgin_close_notify(PurpleNotifyType type, void *ui_handle); + static void message_response_cb(GtkDialog *dialog, gint id, GtkWidget *widget) { @@ -144,7 +147,10 @@ purple_notify_uri(NULL, data->url); gtk_tree_store_remove(dialog->treemodel, &iter); - purple_notify_close(PURPLE_NOTIFY_EMAILS, data); + if (data->purple_has_handle) + purple_notify_close(PURPLE_NOTIFY_EMAILS, data); + else + pidgin_close_notify(PURPLE_NOTIFY_EMAILS, data); } } gtk_widget_destroy(dialog->dialog); @@ -465,6 +471,7 @@ if (new_n) { data = g_new0(PidginNotifyMailData, 1); + data->purple_has_handle = TRUE; gtk_tree_store_append(treemodel, &iter, NULL); } @@ -479,6 +486,8 @@ data->iter = iter; /* XXX: Do we use this for something? */ data->account = account; data->count = count; + + /* Why is this necessary?*/ gtk_tree_model_get(GTK_TREE_MODEL(treemodel), &iter, PIDGIN_MAIL_DATA, &data, -1); if (icon) @@ -540,6 +549,9 @@ g_free(from_text); g_free(subject_text); + /* If we don't keep track of this, will leak "data" for each of the notifications except the last */ + if (data) + data->purple_has_handle = FALSE; data = pidgin_notify_add_mail(mail_dialog->treemodel, account, notification, urls ? *urls : NULL, 0, FALSE); g_free(notification); @@ -588,7 +600,7 @@ } else if (!GTK_WIDGET_HAS_FOCUS(dialog)) pidgin_set_urgent(GTK_WINDOW(dialog), TRUE); - return NULL; + return data; } static gboolean @@ -807,6 +819,7 @@ col_types[i] = G_TYPE_STRING; } model = gtk_list_store_newv(col_num, col_types); + g_free(col_types); /* Setup the scrolled window containing the treeview */ sw = gtk_scrolled_window_new(NULL, NULL);