[gedit] ViewFrame: fix search occurrences blinking



commit f11ab8e958cce95a102088834ce064d14bc5a56b
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Tue Sep 24 23:34:29 2013 +0200

    ViewFrame: fix search occurrences blinking
    
    When searching something, close the search box, and pressing again
    Ctrl+F. A new SearchContext was always created.

 gedit/gedit-view-frame.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/gedit/gedit-view-frame.c b/gedit/gedit-view-frame.c
index f48be37..95261c5 100644
--- a/gedit/gedit-view-frame.c
+++ b/gedit/gedit-view-frame.c
@@ -1207,18 +1207,23 @@ init_search_entry (GeditViewFrame *frame)
                        frame->priv->old_search_text = g_strdup (frame->priv->search_text);
                }
 
-               search_context = gtk_source_search_context_new (GTK_SOURCE_BUFFER (buffer),
-                                                               frame->priv->search_settings);
+               search_context = get_search_context (frame);
 
-               _gedit_document_set_search_context (GEDIT_DOCUMENT (buffer),
-                                                   search_context);
+               if (search_context == NULL)
+               {
+                       search_context = gtk_source_search_context_new (GTK_SOURCE_BUFFER (buffer),
+                                                                       frame->priv->search_settings);
 
-               g_signal_connect_swapped (search_context,
-                                         "notify::occurrences-count",
-                                         G_CALLBACK (install_update_entry_tag_idle),
-                                         frame);
+                       _gedit_document_set_search_context (GEDIT_DOCUMENT (buffer),
+                                                           search_context);
 
-               g_object_unref (search_context);
+                       g_signal_connect_swapped (search_context,
+                                                 "notify::occurrences-count",
+                                                 G_CALLBACK (install_update_entry_tag_idle),
+                                                 frame);
+
+                       g_object_unref (search_context);
+               }
 
                selection_exists = get_selected_text (buffer,
                                                      &search_text,


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