[gimp] app: do not show the actions from <Dockable> GimpUIManager.



commit b795ae2296ebb4711d7fc6881637506fc422f3ee
Author: Jehan <jehan girinstud io>
Date:   Wed Nov 23 07:09:08 2016 +0100

    app: do not show the actions from <Dockable> GimpUIManager.
    
    <Dockable> has this whole list of actions named similarly to dialogs-*
    actions, and we don't want these to take precedence, especially since
    they would always create a new dock instead of just showing the existing
    one if already present.
    Also fix the redundancy check on already added actions.

 app/dialogs/action-search-dialog.c |   24 ++++++++++++++++++------
 app/widgets/gimpaction-history.c   |    2 ++
 2 files changed, 20 insertions(+), 6 deletions(-)
---
diff --git a/app/dialogs/action-search-dialog.c b/app/dialogs/action-search-dialog.c
index 3b62787..44059fb 100644
--- a/app/dialogs/action-search-dialog.c
+++ b/app/dialogs/action-search-dialog.c
@@ -81,10 +81,10 @@ action_search_history_and_actions (GimpSearchPopup *popup,
                                    const gchar     *keyword,
                                    gpointer         data)
 {
-  GList         *menus;
-  GList         *list;
-  GList         *history_actions = NULL;
-  Gimp          *gimp;
+  GList *menus;
+  GList *list;
+  GList *history_actions = NULL;
+  Gimp  *gimp;
 
   g_return_if_fail (GIMP_IS_GIMP (data));
 
@@ -117,6 +117,13 @@ action_search_history_and_actions (GimpSearchPopup *popup,
         {
           GimpUIManager *manager = managers->data;
 
+          /* Ignore dockable actions which are similar to the Dialogs-*
+           * actions except they always add a dock (instead of just
+           * showing it when already present).
+           */
+          if (g_strcmp0 (manager->name, "<Dockable>") == 0)
+            continue;
+
           for (list = gtk_ui_manager_get_action_groups (GTK_UI_MANAGER (manager));
                list;
                list = g_list_next (list))
@@ -162,8 +169,11 @@ action_search_history_and_actions (GimpSearchPopup *popup,
                        */
                       for (list3 = history_actions; list3; list3 = g_list_next (list3))
                         {
-                          if (strcmp (gtk_action_get_name (GTK_ACTION (list3->data)),
-                                      name) == 0)
+                          const gchar *action_name;
+
+                          action_name = gtk_action_get_name (GTK_ACTION (list3->data));
+
+                          if (g_strcmp0 (action_name, name) == 0)
                             {
                               is_redundant = TRUE;
                               break;
@@ -173,6 +183,8 @@ action_search_history_and_actions (GimpSearchPopup *popup,
                       if (! is_redundant)
                         {
                           gimp_search_popup_add_result (popup, action, section);
+                          history_actions = g_list_prepend (history_actions,
+                                                            g_object_ref (action));
                         }
                     }
                 }
diff --git a/app/widgets/gimpaction-history.c b/app/widgets/gimpaction-history.c
index 2487635..5262115 100644
--- a/app/widgets/gimpaction-history.c
+++ b/app/widgets/gimpaction-history.c
@@ -284,6 +284,8 @@ gimp_action_history_search (Gimp                *gimp,
             {
               GimpUIManager *manager = managers->data;
 
+              if (g_strcmp0 (manager->name, "<Dockable>") == 0)
+                continue;
               action = gimp_ui_manager_find_action (manager, NULL,
                                                     item->action_name);
 


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