[gedit] Restaure old searched text if there was one. Fixes bug #642859.



commit a4450213033a01ced2d8f5f16d156950cf577397
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Mon Feb 21 11:58:17 2011 +0100

    Restaure old searched text if there was one. Fixes bug #642859.

 gedit/gedit-view-frame.c |   26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/gedit/gedit-view-frame.c b/gedit/gedit-view-frame.c
index 03c7e04..d52bd3b 100644
--- a/gedit/gedit-view-frame.c
+++ b/gedit/gedit-view-frame.c
@@ -74,6 +74,7 @@ struct _GeditViewFramePrivate
 	guint        typeselect_flush_timeout;
 	glong        view_scroll_event_id;
 	glong        search_entry_focus_out_id;
+	glong        search_entry_changed_id;
 
 	guint        disable_popdown : 1;
 	guint        wrap_around : 1;
@@ -1087,9 +1088,10 @@ create_search_widget (GeditViewFrame *frame)
 	g_signal_connect (frame->priv->search_entry, "insert_text",
 	                  G_CALLBACK (search_entry_insert_text),
 	                  frame);
-	g_signal_connect (frame->priv->search_entry, "changed",
-	                  G_CALLBACK (search_init),
-	                  frame);
+	frame->priv->search_entry_changed_id =
+		g_signal_connect (frame->priv->search_entry, "changed",
+		                  G_CALLBACK (search_init),
+		                  frame);
 	frame->priv->search_entry_focus_out_id =
 		g_signal_connect (frame->priv->search_entry, "focus-out-event",
 		                  G_CALLBACK (search_entry_focus_out_event),
@@ -1225,6 +1227,19 @@ init_search_entry (GeditViewFrame *frame)
 		{
 			frame->priv->old_search_text = old_find_text;
 			add_search_completion_entry (old_find_text);
+			g_signal_handler_block (frame->priv->search_entry,
+			                        frame->priv->search_entry_changed_id);
+
+			gtk_entry_set_text (GTK_ENTRY (frame->priv->search_entry),
+			                    old_find_text);
+
+			g_signal_handler_unblock (frame->priv->search_entry,
+			                          frame->priv->search_entry_changed_id);
+		}
+		else
+		{
+			gtk_entry_set_text (GTK_ENTRY (frame->priv->search_entry),
+			                    "");
 		}
 
 		if (old_find_flags != 0)
@@ -1241,11 +1256,6 @@ init_search_entry (GeditViewFrame *frame)
 			gtk_entry_set_text (GTK_ENTRY (frame->priv->search_entry),
 			                    find_text);
 		}
-		else
-		{
-			gtk_entry_set_text (GTK_ENTRY (frame->priv->search_entry),
-			                    "");
-		}
 
 		g_free (find_text);
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]