[devhelp] Sidebar: cancel search when Escape is pressed



commit 6ae70073a2e491c33c1d7ea712104fe2f7cf769c
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Jan 17 15:26:32 2018 +0100

    Sidebar: cancel search when Escape is pressed
    
    https://bugzilla.gnome.org/show_bug.cgi?id=696905

 src/dh-sidebar.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/dh-sidebar.c b/src/dh-sidebar.c
index b1fce84..c4f795d 100644
--- a/src/dh-sidebar.c
+++ b/src/dh-sidebar.c
@@ -384,6 +384,13 @@ entry_insert_text_cb (GtkEntry    *entry,
 }
 
 static void
+entry_stop_search_cb (GtkSearchEntry *entry,
+                      gpointer        user_data)
+{
+        gtk_entry_set_text (GTK_ENTRY (entry), "");
+}
+
+static void
 hitlist_cell_data_func (GtkTreeViewColumn *tree_column,
                         GtkCellRenderer   *cell,
                         GtkTreeModel      *hitlist_model,
@@ -484,6 +491,11 @@ dh_sidebar_init (DhSidebar *sidebar)
                           G_CALLBACK (entry_insert_text_cb),
                           sidebar);
 
+        g_signal_connect (priv->entry,
+                          "stop-search",
+                          G_CALLBACK (entry_stop_search_cb),
+                          NULL);
+
         /* Setup hitlist */
         priv->hitlist_model = dh_keyword_model_new ();
         priv->hitlist_view = GTK_TREE_VIEW (gtk_tree_view_new ());


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