Mercurial > pidgin
changeset 7454:50f4386a8262
[gaim-migrate @ 8067]
I made the log viewer's close button worked, also fixing a memleak when
using the x to close the window.
I feel wheat.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 07 Nov 2003 03:27:45 +0000 |
parents | 6f5918e4f668 |
children | 3a5f89ba0da5 |
files | src/gtklog.c |
diffstat | 1 files changed, 17 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtklog.c Fri Nov 07 02:27:24 2003 +0000 +++ b/src/gtklog.c Fri Nov 07 03:27:45 2003 +0000 @@ -61,7 +61,19 @@ return ret; } -static void log_select(GtkTreeSelection *sel, GaimGtkLogViewer *viewer) { +static gboolean destroy_cb(GtkWidget *w, gint resp, struct log_viewer_hash_t *ht) { + GaimGtkLogViewer *lv = g_hash_table_lookup(log_viewers, ht); + + g_hash_table_remove(log_viewers, ht); + g_free(ht->screenname); + g_free(ht); + g_free(lv); + gtk_widget_destroy(w); + + return TRUE; +} + +static void log_select_cb(GtkTreeSelection *sel, GaimGtkLogViewer *viewer) { GtkTreeIter iter; GValue val = { 0, }; GtkTreeModel *model = GTK_TREE_MODEL(viewer->treestore); @@ -151,7 +163,9 @@ gtk_container_set_border_width (GTK_CONTAINER(lv->window), 6); gtk_dialog_set_has_separator(GTK_DIALOG(lv->window), FALSE); gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(lv->window)->vbox), 0); - + g_signal_connect(G_OBJECT(lv->window), "response", + G_CALLBACK(destroy_cb), ht); + hbox = gtk_hbox_new(FALSE, 6); gtk_container_set_border_width(GTK_CONTAINER(hbox), 6); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(lv->window)->vbox), hbox, FALSE, FALSE, 0); @@ -195,7 +209,7 @@ sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (lv->treeview)); g_signal_connect (G_OBJECT (sel), "changed", - G_CALLBACK (log_select), + G_CALLBACK (log_select_cb), lv); /* Viewer ************/