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.
This commit is contained in:
Jehan 2016-11-23 07:09:08 +01:00
parent 877b0244b5
commit b795ae2296
2 changed files with 20 additions and 6 deletions

View File

@ -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));
}
}
}

View File

@ -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);