[gimp] Bug 774890 - "Keyboard shortcuts" dialog does not show all actions
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 774890 - "Keyboard shortcuts" dialog does not show all actions
- Date: Thu, 24 Nov 2016 20:12:55 +0000 (UTC)
commit 6131b00b54d03268ce094dadb69990a9130c6096
Author: Michael Natterer <mitch gimp org>
Date: Thu Nov 24 21:08:34 2016 +0100
Bug 774890 - "Keyboard shortcuts" dialog does not show all actions
Revert "app: action search should search accross all available actions."
This reverts commit 53b3673bd8ce96c67ce05de69fe43bc0b87d15a8.
Had to revert these two commits, quoting comment 6 of the bug:
Thinking again, that entire change is unfortunately wrong, the only
right UI manager is in fact
gimp_ui_managers_from_name ("<Image>")->data
because it's the global popup <Image> UI manager which is independent
of a display and it always in the right state for the currently
active image, all other UI managers are wrong.
app/dialogs/action-search-dialog.c | 124 +++++++++++++++--------------------
app/widgets/gimpaction-history.c | 40 +++---------
2 files changed, 62 insertions(+), 102 deletions(-)
---
diff --git a/app/dialogs/action-search-dialog.c b/app/dialogs/action-search-dialog.c
index 3b62787..8ee4918 100644
--- a/app/dialogs/action-search-dialog.c
+++ b/app/dialogs/action-search-dialog.c
@@ -35,13 +35,9 @@
#include "core/gimp.h"
-#include "menus/menus.h"
-
#include "widgets/gimpaction.h"
-#include "widgets/gimpactiongroup.h"
#include "widgets/gimpaction-history.h"
#include "widgets/gimpdialogfactory.h"
-#include "widgets/gimpmenufactory.h"
#include "widgets/gimpsearchpopup.h"
#include "widgets/gimpuimanager.h"
@@ -81,18 +77,19 @@ action_search_history_and_actions (GimpSearchPopup *popup,
const gchar *keyword,
gpointer data)
{
- GList *menus;
+ GimpUIManager *manager;
GList *list;
GList *history_actions = NULL;
Gimp *gimp;
g_return_if_fail (GIMP_IS_GIMP (data));
+ gimp = GIMP (data);
+ manager = gimp_ui_managers_from_name ("<Image>")->data;
+
if (g_strcmp0 (keyword, "") == 0)
return;
- gimp = GIMP (data);
-
history_actions = gimp_action_history_search (gimp,
action_search_match_keyword,
keyword);
@@ -104,83 +101,68 @@ action_search_history_and_actions (GimpSearchPopup *popup,
}
/* Now check other actions. */
- for (menus = gimp_menu_factory_get_registered_menus (global_menu_factory);
- menus;
- menus = g_list_next (menus))
+ for (list = gtk_ui_manager_get_action_groups (GTK_UI_MANAGER (manager));
+ list;
+ list = g_list_next (list))
{
- GimpMenuFactoryEntry *entry = menus->data;
- GList *managers;
+ GList *list2;
+ GimpActionGroup *group = list->data;
+ GList *actions = NULL;
- managers = gimp_ui_managers_from_name (entry->identifier);
+ actions = gtk_action_group_list_actions (GTK_ACTION_GROUP (group));
+ actions = g_list_sort (actions, (GCompareFunc) gimp_action_name_compare);
- for (; managers; managers = g_list_next (managers))
+ for (list2 = actions; list2; list2 = g_list_next (list2))
{
- GimpUIManager *manager = managers->data;
-
- for (list = gtk_ui_manager_get_action_groups (GTK_UI_MANAGER (manager));
- list;
- list = g_list_next (list))
+ const gchar *name;
+ GtkAction *action = list2->data;
+ gboolean is_redundant = FALSE;
+ gint section;
+
+ 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.
+ */
+ if (gimp_action_history_excluded_action (name) &&
+ g_strcmp0 (name, "filters-repeat") != 0 &&
+ g_strcmp0 (name, "filters-reshow") != 0)
+ continue;
+
+ if (! gtk_action_is_sensitive (action) &&
+ ! GIMP_GUI_CONFIG (gimp->config)->search_show_unavailable)
+ continue;
+
+ if (action_search_match_keyword (action, keyword, §ion, gimp))
{
- GList *list2;
- GimpActionGroup *group = list->data;
- GList *actions = NULL;
+ GList *list3;
- actions = gtk_action_group_list_actions (GTK_ACTION_GROUP (group));
- actions = g_list_sort (actions, (GCompareFunc) gimp_action_name_compare);
-
- for (list2 = actions; list2; list2 = g_list_next (list2))
+ /* A matching action. Check if we have not already added
+ * it as an history action.
+ */
+ for (list3 = history_actions; list3; list3 = g_list_next (list3))
{
- const gchar *name;
- GtkAction *action = list2->data;
- gboolean is_redundant = FALSE;
- gint section;
-
- 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.
- */
- if (gimp_action_history_excluded_action (name) &&
- g_strcmp0 (name, "filters-repeat") != 0 &&
- g_strcmp0 (name, "filters-reshow") != 0)
- continue;
-
- if (! gtk_action_is_sensitive (action) &&
- ! GIMP_GUI_CONFIG (gimp->config)->search_show_unavailable)
- continue;
-
- if (action_search_match_keyword (action, keyword, §ion, gimp))
+ if (strcmp (gtk_action_get_name (GTK_ACTION (list3->data)),
+ name) == 0)
{
- GList *list3;
-
- /* A matching action. Check if we have not already added
- * it as an history action.
- */
- for (list3 = history_actions; list3; list3 = g_list_next (list3))
- {
- if (strcmp (gtk_action_get_name (GTK_ACTION (list3->data)),
- name) == 0)
- {
- is_redundant = TRUE;
- break;
- }
- }
-
- if (! is_redundant)
- {
- gimp_search_popup_add_result (popup, action, section);
- }
+ is_redundant = TRUE;
+ break;
}
}
- g_list_free (actions);
+ if (! is_redundant)
+ {
+ gimp_search_popup_add_result (popup, action, section);
+ }
}
}
- }
+
+ g_list_free (actions);
+ }
g_list_free_full (history_actions, (GDestroyNotify) g_object_unref);
}
diff --git a/app/widgets/gimpaction-history.c b/app/widgets/gimpaction-history.c
index 2487635..745609e 100644
--- a/app/widgets/gimpaction-history.c
+++ b/app/widgets/gimpaction-history.c
@@ -33,12 +33,9 @@
#include "core/gimp.h"
-#include "menus/menus.h"
-
+#include "gimpuimanager.h"
#include "gimpaction.h"
#include "gimpaction-history.h"
-#include "gimpmenufactory.h"
-#include "gimpuimanager.h"
#define GIMP_ACTION_HISTORY_FILENAME "action-history"
@@ -254,6 +251,7 @@ gimp_action_history_search (Gimp *gimp,
const gchar *keyword)
{
GimpGuiConfig *config;
+ GimpUIManager *manager;
GList *actions;
GList *result = NULL;
gint i;
@@ -262,41 +260,21 @@ gimp_action_history_search (Gimp *gimp,
g_return_val_if_fail (match_func != NULL, NULL);
config = GIMP_GUI_CONFIG (gimp->config);
+ manager = gimp_ui_managers_from_name ("<Image>")->data;
for (actions = history.items, i = 0;
actions && i < config->action_history_size;
actions = g_list_next (actions), i++)
{
GimpActionHistoryItem *item = actions->data;
- GtkAction *action = NULL;
- GList *menus;
+ GtkAction *action;
- for (menus = gimp_menu_factory_get_registered_menus (global_menu_factory);
- menus;
- menus = g_list_next (menus))
- {
- GimpMenuFactoryEntry *entry = menus->data;
- GList *managers;
-
- managers = gimp_ui_managers_from_name (entry->identifier);
-
- for (; managers; managers = g_list_next (managers))
- {
- GimpUIManager *manager = managers->data;
-
- action = gimp_ui_manager_find_action (manager, NULL,
- item->action_name);
-
- if (action)
- break;
- }
- if (action)
- break;
- }
+ action = gimp_ui_manager_find_action (manager, NULL, item->action_name);
+ if (action == NULL)
+ continue;
- if (action == NULL ||
- (! gtk_action_is_sensitive (action) &&
- ! config->search_show_unavailable))
+ if (! gtk_action_is_sensitive (action) &&
+ ! config->search_show_unavailable)
continue;
if (match_func (action, keyword, NULL, gimp))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]