[gimp/tito: 12/15] app: do not fuzzy-search actions in the history.



commit 71e13fbbea8518d7a1a8cc62d44db42e3b5aff5b
Author: Jehan <jehan girinstud io>
Date:   Sat Nov 30 17:32:25 2013 +1300

    app: do not fuzzy-search actions in the history.
    
    Fuzzy search is powerful when you know what you are looking for. But
    it can also insert very irrelevant results, and we don't want these as
    first answers.

 app/dialogs/action-search-dialog.c |   10 ++++++----
 app/widgets/gimpaction-history.c   |    2 +-
 app/widgets/gimpaction-history.h   |    3 ++-
 3 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/app/dialogs/action-search-dialog.c b/app/dialogs/action-search-dialog.c
index eee5fe2..ca5e6bd 100644
--- a/app/dialogs/action-search-dialog.c
+++ b/app/dialogs/action-search-dialog.c
@@ -75,7 +75,8 @@ static gboolean     action_fuzzy_match                     (gchar             *s
                                                             gchar             *key);
 static gboolean     action_search_match_keyword            (GtkAction         *action,
                                                             const gchar*       keyword,
-                                                            gint              *section);
+                                                            gint              *section,
+                                                            gboolean           match_fuzzy);
 static void         action_search_update_position          (SearchDialog      *private);
 
 static void         action_search_finalizer                (SearchDialog      *private);
@@ -547,7 +548,7 @@ action_search_history_and_actions (const gchar  *keyword,
           if (! gtk_action_get_sensitive (action) && ! private->config->search_show_unavailable)
             continue;
 
-          if (action_search_match_keyword (action, keyword, &section))
+          if (action_search_match_keyword (action, keyword, &section, TRUE))
             {
               GList *list3;
 
@@ -596,7 +597,8 @@ action_fuzzy_match (gchar *string,
 static gboolean
 action_search_match_keyword (GtkAction   *action,
                              const gchar *keyword,
-                             gint        *section)
+                             gint        *section,
+                             gboolean     match_fuzzy)
 {
   gboolean  matched = FALSE;
   gchar    *key;
@@ -681,7 +683,7 @@ action_search_match_keyword (GtkAction   *action,
               g_free (tooltip);
             }
         }
-      if (! matched && action_fuzzy_match (label, key))
+      if (! matched && match_fuzzy && action_fuzzy_match (label, key))
         {
           matched = TRUE;
           if (section)
diff --git a/app/widgets/gimpaction-history.c b/app/widgets/gimpaction-history.c
index 04a8c70..bd20f52 100644
--- a/app/widgets/gimpaction-history.c
+++ b/app/widgets/gimpaction-history.c
@@ -199,7 +199,7 @@ gimp_action_history_search (const gchar         *keyword,
       if (! gtk_action_get_sensitive (action) && ! config->search_show_unavailable)
         continue;
 
-      if (match_func (action, keyword, NULL))
+      if (match_func (action, keyword, NULL, FALSE))
         search_result = g_list_prepend (search_result, g_object_ref (action));
     }
 
diff --git a/app/widgets/gimpaction-history.h b/app/widgets/gimpaction-history.h
index ed921fd..7300f49 100644
--- a/app/widgets/gimpaction-history.h
+++ b/app/widgets/gimpaction-history.h
@@ -22,7 +22,8 @@
 
 typedef gboolean   (* GimpActionMatchFunc)       (GtkAction           *action,
                                                   const gchar         *keyword,
-                                                  gint                *section);
+                                                  gint                *section,
+                                                  gboolean             match_fuzzy);
 
 void       gimp_action_history_init              (GimpGuiConfig       *config);
 void       gimp_action_history_exit              (GimpGuiConfig       *config);


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