void plug_in_repeat_cmd_callback (GtkAction *action, gint value, gpointer data) { GimpPlugInProcedure *procedure; Gimp *gimp; GimpDisplay *display; GimpRunMode run_mode; return_if_no_gimp (gimp, data); return_if_no_display (display, data); run_mode = (GimpRunMode) value; procedure = gimp_plug_in_manager_history_nth (gimp->plug_in_manager, 0); if (procedure) { GimpValueArray *args; gint n_args; args = gimp_procedure_get_arguments (GIMP_PROCEDURE (procedure)); g_value_set_int (gimp_value_array_index (args, 0), run_mode); n_args = plug_in_collect_display_args (action, display, GIMP_PROCEDURE (procedure)->args, args, 1); plug_in_procedure_execute (procedure, gimp, display, args, n_args); gimp_value_array_unref (args); } }
static void plug_in_actions_history_changed (GimpPlugInManager *manager, GimpActionGroup *group) { GimpPlugInProcedure *proc; gint i; proc = gimp_plug_in_manager_history_nth (manager, 0); if (proc) { GtkAction *actual_action; const gchar *label; gchar *repeat; gchar *reshow; gboolean sensitive = FALSE; /* copy the sensitivity of the plug-in procedure's actual action * instead of calling plug_in_actions_update() because doing the * latter would set the sensitivity of this image's action on * all images' actions. See bug #517683. */ actual_action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), GIMP_OBJECT (proc)->name); if (actual_action) sensitive = gtk_action_get_sensitive (actual_action); label = gimp_plug_in_procedure_get_label (proc); repeat = g_strdup_printf (_("Re_peat \"%s\""), label); reshow = g_strdup_printf (_("R_e-Show \"%s\""), label); gimp_action_group_set_action_label (group, "plug-in-repeat", repeat); gimp_action_group_set_action_label (group, "plug-in-reshow", reshow); gimp_action_group_set_action_sensitive (group, "plug-in-repeat", sensitive); gimp_action_group_set_action_sensitive (group, "plug-in-reshow", sensitive); g_free (repeat); g_free (reshow); } else { gimp_action_group_set_action_label (group, "plug-in-repeat", _("Repeat Last")); gimp_action_group_set_action_label (group, "plug-in-reshow", _("Re-Show Last")); gimp_action_group_set_action_sensitive (group, "plug-in-repeat", FALSE); gimp_action_group_set_action_sensitive (group, "plug-in-reshow", FALSE); } for (i = 0; i < gimp_plug_in_manager_history_length (manager); i++) { GtkAction *action; GtkAction *actual_action; gchar *name = g_strdup_printf ("plug-in-recent-%02d", i + 1); gboolean sensitive = FALSE; action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), name); g_free (name); proc = gimp_plug_in_manager_history_nth (manager, i); /* see comment above */ actual_action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), GIMP_OBJECT (proc)->name); if (actual_action) sensitive = gtk_action_get_sensitive (actual_action); g_object_set (action, "visible", TRUE, "sensitive", sensitive, "procedure", proc, "label", gimp_plug_in_procedure_get_label (proc), "stock-id", gimp_plug_in_procedure_get_stock_id (proc), "tooltip", gimp_plug_in_procedure_get_blurb (proc), NULL); } for (; i < gimp_plug_in_manager_history_size (manager); i++) { GtkAction *action; gchar *name = g_strdup_printf ("plug-in-recent-%02d", i + 1); action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), name); g_free (name); g_object_set (action, "visible", FALSE, "procedure", NULL, NULL); } }