use GimpPlugInActions instead of GimpEnumActions so the menu items show

2006-10-29  Michael Natterer  <mitch@gimp.org>

	* app/actions/plug-in-actions.c: use GimpPlugInActions instead of
	GimpEnumActions so the menu items show any kind of icons (not only
	stock-id icons). Now if any plug-in that shows up in the history
	registered non-stock-id icons, this change would be actually
	useful ;) Fixes bug #338525.

	* app/actions/plug-in-commands.[ch] (plug_in_history_cmd_callback):
	new callback for the history, much simpler than
	plug_in_repeat_cmd_callback().
This commit is contained in:
Michael Natterer 2006-10-29 22:03:59 +00:00 committed by Michael Natterer
parent 6b48b73300
commit b439680991
4 changed files with 66 additions and 23 deletions

View File

@ -1,3 +1,15 @@
2006-10-29 Michael Natterer <mitch@gimp.org>
* app/actions/plug-in-actions.c: use GimpPlugInActions instead of
GimpEnumActions so the menu items show any kind of icons (not only
stock-id icons). Now if any plug-in that shows up in the history
registered non-stock-id icons, this change would be actually
useful ;) Fixes bug #338525.
* app/actions/plug-in-commands.[ch] (plug_in_history_cmd_callback):
new callback for the history, much simpler than
plug_in_repeat_cmd_callback().
2006-10-29 Michael Natterer <mitch@gimp.org>
* modules/colorsel_cmyk_lcms.c: added hackish flag to prevent it

View File

@ -127,10 +127,10 @@ static const GimpEnumActionEntry plug_in_repeat_actions[] =
void
plug_in_actions_setup (GimpActionGroup *group)
{
GimpEnumActionEntry *entries;
GSList *list;
gint n_entries;
gint i;
GimpPlugInActionEntry *entries;
GSList *list;
gint n_entries;
gint i;
gimp_action_group_add_actions (group,
plug_in_actions,
@ -193,23 +193,21 @@ plug_in_actions_setup (GimpActionGroup *group)
n_entries = gimp_plug_in_manager_history_size (group->gimp->plug_in_manager);
entries = g_new0 (GimpEnumActionEntry, n_entries);
entries = g_new0 (GimpPlugInActionEntry, n_entries);
for (i = 0; i < n_entries; i++)
{
entries[i].name = g_strdup_printf ("plug-in-recent-%02d",
i + 1);
entries[i].stock_id = GIMP_STOCK_RESHOW_FILTER;
entries[i].label = "";
entries[i].tooltip = NULL;
entries[i].value = i;
entries[i].value_variable = FALSE;
entries[i].help_id = GIMP_HELP_FILTER_RESHOW;
entries[i].accelerator = "";
entries[i].name = g_strdup_printf ("plug-in-recent-%02d", i + 1);
entries[i].stock_id = NULL;
entries[i].label = "";
entries[i].accelerator = "";
entries[i].tooltip = NULL;
entries[i].procedure = NULL;
entries[i].help_id = GIMP_HELP_FILTER_RESHOW;
}
gimp_action_group_add_enum_actions (group, entries, n_entries,
G_CALLBACK (plug_in_repeat_cmd_callback));
gimp_action_group_add_plug_in_actions (group, entries, n_entries,
G_CALLBACK (plug_in_history_cmd_callback));
for (i = 0; i < n_entries; i++)
{
@ -545,9 +543,10 @@ plug_in_actions_history_changed (GimpPlugInManager *manager,
for (i = 0; i < gimp_plug_in_manager_history_length (manager); i++)
{
GtkAction *action;
gchar *name = g_strdup_printf ("plug-in-recent-%02d", i + 1);
gchar *label;
GtkAction *action;
gchar *name = g_strdup_printf ("plug-in-recent-%02d", i + 1);
gchar *label;
const gchar *tooltip = NULL;
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), name);
g_free (name);
@ -559,10 +558,15 @@ plug_in_actions_history_changed (GimpPlugInManager *manager,
label = gimp_plug_in_procedure_get_label (proc, domain);
if (GIMP_PROCEDURE (proc)->blurb)
tooltip = dgettext (domain, GIMP_PROCEDURE (proc)->blurb);
g_object_set (action,
"label", label,
"visible", TRUE,
"stock-id", gimp_plug_in_procedure_get_stock_id (proc),
"visible", TRUE,
"procedure", proc,
"label", label,
"stock-id", gimp_plug_in_procedure_get_stock_id (proc),
"tooltip", tooltip,
NULL);
g_free (label);
@ -577,7 +581,8 @@ plug_in_actions_history_changed (GimpPlugInManager *manager,
g_free (name);
g_object_set (action,
"visible", FALSE,
"visible", FALSE,
"procedure", NULL,
NULL);
}

View File

@ -220,6 +220,29 @@ plug_in_repeat_cmd_callback (GtkAction *action,
}
}
void
plug_in_history_cmd_callback (GtkAction *action,
GimpPlugInProcedure *procedure,
gpointer data)
{
Gimp *gimp;
GimpDisplay *display;
GValueArray *args;
gint n_args;
return_if_no_gimp (gimp, data);
return_if_no_display (display, data);
args = gimp_procedure_get_arguments (GIMP_PROCEDURE (procedure));
g_value_set_int (&args->values[0], GIMP_RUN_INTERACTIVE);
n_args = plug_in_collect_drawable_args (action, display->image, args, 1);
plug_in_procedure_execute (procedure, gimp, display, args, n_args);
g_value_array_free (args);
}
void
plug_in_reset_all_cmd_callback (GtkAction *action,
gpointer data)

View File

@ -26,6 +26,9 @@ void plug_in_run_cmd_callback (GtkAction *action,
void plug_in_repeat_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void plug_in_history_cmd_callback (GtkAction *action,
GimpPlugInProcedure *proc,
gpointer data);
void plug_in_reset_all_cmd_callback (GtkAction *action,
gpointer data);