Fix Finch search results display (#17238) release-2.x.y

Fri, 06 Oct 2017 22:30:02 +0100

author
David Woodhouse <dwmw@amazon.co.uk>
date
Fri, 06 Oct 2017 22:30:02 +0100
branch
release-2.x.y
changeset 38732
d1e7cb57dcac
parent 38730
859b15b1c817
child 38733
8bd4946501fb

Fix Finch search results display (#17238)

ChangeLog file | annotate | diff | comparison | revisions
finch/gntnotify.c file | annotate | diff | comparison | revisions
--- a/ChangeLog	Thu Sep 28 20:41:27 2017 -0500
+++ b/ChangeLog	Fri Oct 06 22:30:02 2017 +0100
@@ -26,6 +26,9 @@
 	* Better support for dark themes. (#12572 Alyssa Rosenzweig and Gary Kramlich)
 	* Fixed IPv6 links by not escaping []'s. (#16391 cyisfor) (PR #270 Daniel Kamil Kozar)
 
+	Finch:
+	* Fix handling of search results (#17238 David Woodhouse)
+
 version 2.12.0 (03/09/2017):
 	libpurple:
 	* Fix an out of bounds memory write in purple_markup_unescape_entity.
--- a/finch/gntnotify.c	Thu Sep 28 20:41:27 2017 -0500
+++ b/finch/gntnotify.c	Fri Oct 06 22:30:02 2017 +0100
@@ -388,10 +388,11 @@
 finch_notify_sr_new_rows(PurpleConnection *gc,
 		PurpleNotifySearchResults *results, void *data)
 {
-	GntTree *tree = GNT_TREE(data);
+	GntWindow *window = GNT_WINDOW(data);
+	GntTree *tree = GNT_TREE(g_object_get_data(G_OBJECT(window), "tree-widget"));
 	GList *o;
 
-	/* XXX: Do I need to empty the tree here? */
+	gnt_tree_remove_all(GNT_TREE(tree));
 
 	for (o = results->rows; o; o = o->next)
 	{
@@ -483,12 +484,16 @@
 
 	gnt_box_add_widget(GNT_BOX(window), box);
 
-	finch_notify_sr_new_rows(gc, results, tree);
+	g_object_set_data(G_OBJECT(window), "tree-widget", tree);
+	finch_notify_sr_new_rows(gc, results, window);
+
+	g_signal_connect(G_OBJECT(window), "destroy",
+			G_CALLBACK(notify_msg_window_destroy_cb), GINT_TO_POINTER(PURPLE_NOTIFY_SEARCHRESULTS));
 
 	gnt_widget_show(window);
 	g_object_set_data(G_OBJECT(window), "notify-results", results);
 
-	return tree;
+	return window;
 }
 
 static void *

mercurial