pidgin: d9497370: More plumbing work.
datallah at pidgin.im
datallah at pidgin.im
Mon May 5 18:45:42 EDT 2008
-----------------------------------------------------------------
Revision: d94973707853b3f6b84dc446eac68f7fd4c9370d
Ancestor: 79640e5d8ef63294f565d44aa56de5f46611c506
Author: datallah at pidgin.im
Date: 2008-05-05T22:39:55
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/d94973707853b3f6b84dc446eac68f7fd4c9370d
Modified files:
pidgin/gtknotify.c
ChangeLog:
More plumbing work.
-------------- next part --------------
============================================================
--- pidgin/gtknotify.c 55046385edbfead330c3650539c8c50ad6fa9ca7
+++ pidgin/gtknotify.c 665b4e13639481b995444036462b5d4d80e5b893
@@ -52,6 +52,7 @@ typedef struct
GtkWidget *label;
GtkTreeIter iter;
int count;
+ gboolean purple_has_handle;
} PidginNotifyMailData;
typedef struct
@@ -100,6 +101,8 @@ static void *pidgin_notify_emails(Purple
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 @@ email_response_cb(GtkDialog *dlg, gint i
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 @@ pidgin_notify_add_mail(GtkTreeStore *tre
if (new_n) {
data = g_new0(PidginNotifyMailData, 1);
+ data->purple_has_handle = TRUE;
gtk_tree_store_append(treemodel, &iter, NULL);
}
@@ -479,6 +486,8 @@ pidgin_notify_add_mail(GtkTreeStore *tre
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 @@ pidgin_notify_emails(PurpleConnection *g
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 @@ pidgin_notify_emails(PurpleConnection *g
} else if (!GTK_WIDGET_HAS_FOCUS(dialog))
pidgin_set_urgent(GTK_WINDOW(dialog), TRUE);
- return NULL;
+ return data;
}
static gboolean
@@ -807,6 +819,7 @@ pidgin_notify_searchresults(PurpleConnec
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);
More information about the Commits
mailing list