From b4396809918dd358e39b2fd6d356fb7655cd19b2 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Sun, 29 Oct 2006 22:03:59 +0000 Subject: [PATCH] use GimpPlugInActions instead of GimpEnumActions so the menu items show 2006-10-29 Michael Natterer * 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(). --- ChangeLog | 12 ++++++++ app/actions/plug-in-actions.c | 51 +++++++++++++++++++--------------- app/actions/plug-in-commands.c | 23 +++++++++++++++ app/actions/plug-in-commands.h | 3 ++ 4 files changed, 66 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6cfe668e78..9cf6cff2ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2006-10-29 Michael Natterer + + * 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 * modules/colorsel_cmyk_lcms.c: added hackish flag to prevent it diff --git a/app/actions/plug-in-actions.c b/app/actions/plug-in-actions.c index 82efa89c4e..ee0d266686 100644 --- a/app/actions/plug-in-actions.c +++ b/app/actions/plug-in-actions.c @@ -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); } diff --git a/app/actions/plug-in-commands.c b/app/actions/plug-in-commands.c index 7dabb96401..63d858b7da 100644 --- a/app/actions/plug-in-commands.c +++ b/app/actions/plug-in-commands.c @@ -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) diff --git a/app/actions/plug-in-commands.h b/app/actions/plug-in-commands.h index a411f674f4..4810338f61 100644 --- a/app/actions/plug-in-commands.h +++ b/app/actions/plug-in-commands.h @@ -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);