[gimp] app: add gimp_action_history_is_blacklisted_action()



commit 2816695edaf491825b31fdd98fbe154076b224d6
Author: Ell <ell_se yahoo com>
Date:   Sat Feb 17 04:27:24 2018 -0500

    app: add gimp_action_history_is_blacklisted_action()
    
    ... and rename gimp_action_history_excluded_action() to
    gimp_action_history_is_excluded_action().
    
    is_blacklisted_action() determines whether an action should be
    excluded from *both* the history and the search results, while
    is_excluded_action() determines if an action should be excluded
    only from the history.  This eliminates some redundancy across
    gimpaction-history and action-search-dialog.

 app/dialogs/action-search-dialog.c |   14 +++++---------
 app/widgets/gimpaction-history.c   |   31 ++++++++++++++++++++++++-------
 app/widgets/gimpaction-history.h   |   19 ++++++++++---------
 3 files changed, 39 insertions(+), 25 deletions(-)
---
diff --git a/app/dialogs/action-search-dialog.c b/app/dialogs/action-search-dialog.c
index 8ee4918..0e41a2b 100644
--- a/app/dialogs/action-search-dialog.c
+++ b/app/dialogs/action-search-dialog.c
@@ -121,16 +121,12 @@ action_search_history_and_actions (GimpSearchPopup *popup,
 
           name = gtk_action_get_name (action);
 
-          /* The action search dialog don't show any non-historized
-           * action, with the exception of "plug-in-repeat/reshow"
-           * actions.
-           * Logging them is meaningless (they may mean a different
-           * actual action each time), but they are still interesting
-           * as a search result.
+          /* The action search dialog doesn't show any non-historized
+           * actions, with a few exceptions.  See the difference between
+           * gimp_action_history_is_blacklisted_action() and
+           * gimp_action_history_is_excluded_action().
            */
-          if (gimp_action_history_excluded_action (name) &&
-              g_strcmp0 (name, "filters-repeat") != 0    &&
-              g_strcmp0 (name, "filters-reshow") != 0)
+          if (gimp_action_history_is_blacklisted_action (name))
             continue;
 
           if (! gtk_action_is_sensitive (action) &&
diff --git a/app/widgets/gimpaction-history.c b/app/widgets/gimpaction-history.c
index aa079c4..46c03c4 100644
--- a/app/widgets/gimpaction-history.c
+++ b/app/widgets/gimpaction-history.c
@@ -138,7 +138,7 @@ gimp_action_history_init (Gimp *gimp)
                   break;
                 }
 
-              if (! gimp_action_history_excluded_action (action_name))
+              if (! gimp_action_history_is_excluded_action (action_name))
                 {
                   history.items =
                     g_list_insert_sorted (history.items,
@@ -287,12 +287,13 @@ gimp_action_history_search (Gimp                *gimp,
   return g_list_reverse (result);
 }
 
-/* gimp_action_history_excluded_action:
+/* gimp_action_history_is_blacklisted_action:
  *
- * Returns whether an action should be excluded from history.
+ * Returns whether an action should be excluded from both
+ * history and search results.
  */
 gboolean
-gimp_action_history_excluded_action (const gchar *action_name)
+gimp_action_history_is_blacklisted_action (const gchar *action_name)
 {
   if (gimp_action_is_gui_blacklisted (action_name))
     return TRUE;
@@ -301,11 +302,27 @@ gimp_action_history_excluded_action (const gchar *action_name)
           g_str_has_suffix (action_name, "-accel")          ||
           g_str_has_prefix (action_name, "context-")        ||
           g_str_has_prefix (action_name, "filters-recent-") ||
-          g_strcmp0 (action_name, "filters-repeat") == 0    ||
-          g_strcmp0 (action_name, "filters-reshow") == 0    ||
           g_strcmp0 (action_name, "dialogs-action-search") == 0);
 }
 
+/* gimp_action_history_is_excluded_action:
+ *
+ * Returns whether an action should be excluded from history.
+ *
+ * Some actions should not be logged in the history, but should
+ * otherwise appear in the search results, since they correspond
+ * to different functions at different times.
+ */
+gboolean
+gimp_action_history_is_excluded_action (const gchar *action_name)
+{
+  if (gimp_action_history_is_blacklisted_action (action_name))
+    return TRUE;
+
+  return (g_strcmp0 (action_name, "filters-repeat") == 0 ||
+          g_strcmp0 (action_name, "filters-reshow") == 0);
+}
+
 /* Callback run on the `activate` signal of an action.
  * It allows us to log all used action.
  */
@@ -320,7 +337,7 @@ gimp_action_history_activate_callback (GtkAction *action,
   action_name = gtk_action_get_name (action);
 
   /* Some specific actions are of no log interest. */
-  if (gimp_action_history_excluded_action (action_name))
+  if (gimp_action_history_is_excluded_action (action_name))
     return;
 
   for (actions = history.items; actions; actions = g_list_next (actions))
diff --git a/app/widgets/gimpaction-history.h b/app/widgets/gimpaction-history.h
index 2ac4464..dc3cb1f 100644
--- a/app/widgets/gimpaction-history.h
+++ b/app/widgets/gimpaction-history.h
@@ -28,19 +28,20 @@ typedef gboolean (* GimpActionMatchFunc) (GtkAction   *action,
                                           Gimp        *gimp);
 
 
-void       gimp_action_history_init              (Gimp                *gimp);
-void       gimp_action_history_exit              (Gimp                *gimp);
+void       gimp_action_history_init                  (Gimp                *gimp);
+void       gimp_action_history_exit                  (Gimp                *gimp);
 
-void       gimp_action_history_clear             (Gimp                *gimp);
+void       gimp_action_history_clear                 (Gimp                *gimp);
 
-GList    * gimp_action_history_search            (Gimp                *gimp,
-                                                  GimpActionMatchFunc  match_func,
-                                                  const gchar         *keyword);
+GList    * gimp_action_history_search                (Gimp                *gimp,
+                                                      GimpActionMatchFunc  match_func,
+                                                      const gchar         *keyword);
 
-gboolean   gimp_action_history_excluded_action   (const gchar         *action_name);
+gboolean   gimp_action_history_is_blacklisted_action (const gchar         *action_name);
+gboolean   gimp_action_history_is_excluded_action    (const gchar         *action_name);
 
-void       gimp_action_history_activate_callback (GtkAction           *action,
-                                                  gpointer             user_data);
+void       gimp_action_history_activate_callback     (GtkAction           *action,
+                                                      gpointer             user_data);
 
 
 #endif  /* __GIMP_ACTION_HISTORY_H__ */


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