app: add gimp_action_is_gui_blacklisted()

which filters out some implementation details but mainly all the
tool-specific options actions which only exist as redirect targets for
the generic tool opaticy, size, aspect and angle actions. Use the new
function from the shortcut editor and from action search so stuff is
consistently hidden.
This commit is contained in:
Michael Natterer 2014-04-20 15:57:57 +02:00
parent c9c29ad460
commit dcad833d1c
4 changed files with 57 additions and 14 deletions

View File

@ -161,10 +161,10 @@ gimp_action_history_exit (GimpGuiConfig *config)
gboolean
gimp_action_history_excluded_action (const gchar *action_name)
{
return (action_name[0] == '<' ||
g_str_has_suffix (action_name, "-menu") ||
g_str_has_suffix (action_name, "-popup") ||
g_str_has_suffix (action_name, "-set") ||
if (gimp_action_is_gui_blacklisted (action_name))
return TRUE;
return (g_str_has_suffix (action_name, "-set") ||
g_str_has_suffix (action_name, "-accel") ||
g_str_has_prefix (action_name, "context-") ||
g_str_has_prefix (action_name, "plug-in-recent-") ||

View File

@ -317,6 +317,49 @@ gimp_action_name_compare (GimpAction *action1,
gtk_action_get_name ((GtkAction *) action2));
}
gboolean
gimp_action_is_gui_blacklisted (const gchar *action_name)
{
static const gchar *suffixes[] =
{
"-menu",
"-popup"
};
static const gchar *prefixes[] =
{
"<",
"tools-color-average-radius-",
"tools-paint-brush-size-",
"tools-paint-brush-angle-",
"tools-paint-brush-aspect-ratio-",
"tools-ink-blob-size-",
"tools-ink-blob-aspect-",
"tools-ink-blob-angle-",
"tools-foreground-select-brush-size-",
"tools-transform-preview-opacity-"
};
gint i;
if (! (action_name && *action_name))
return TRUE;
for (i = 0; i < G_N_ELEMENTS (suffixes); i++)
{
if (g_str_has_suffix (action_name, suffixes[i]))
return TRUE;
}
for (i = 0; i < G_N_ELEMENTS (prefixes); i++)
{
if (g_str_has_prefix (action_name, prefixes[i]))
return TRUE;
}
return FALSE;
}
/* private functions */

View File

@ -50,15 +50,17 @@ struct _GimpActionClass
};
GType gimp_action_get_type (void) G_GNUC_CONST;
GType gimp_action_get_type (void) G_GNUC_CONST;
GimpAction * gimp_action_new (const gchar *name,
const gchar *label,
const gchar *tooltip,
const gchar *stock_id);
GimpAction * gimp_action_new (const gchar *name,
const gchar *label,
const gchar *tooltip,
const gchar *stock_id);
gint gimp_action_name_compare (GimpAction *action1,
GimpAction *action2);
gint gimp_action_name_compare (GimpAction *action1,
GimpAction *action2);
gboolean gimp_action_is_gui_blacklisted (const gchar *action_name);
#endif /* __GIMP_ACTION_H__ */

View File

@ -251,9 +251,7 @@ gimp_action_view_new (GimpUIManager *manager,
GClosure *accel_closure = NULL;
GtkTreeIter action_iter;
if (strstr (name, "-menu") ||
strstr (name, "-popup") ||
name[0] == '<')
if (gimp_action_is_gui_blacklisted (name))
continue;
label = gimp_strip_uline (gtk_action_get_label (action));