void gimp_procedure_execute_async (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, GValueArray *args, GimpObject *display, GError **error) { g_return_if_fail (GIMP_IS_PROCEDURE (procedure)); g_return_if_fail (GIMP_IS_GIMP (gimp)); g_return_if_fail (GIMP_IS_CONTEXT (context)); g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress)); g_return_if_fail (args != NULL); g_return_if_fail (display == NULL || GIMP_IS_OBJECT (display)); g_return_if_fail (error == NULL || *error == NULL); if (gimp_procedure_validate_args (procedure, procedure->args, procedure->num_args, args, FALSE, error)) { if (GIMP_IS_PDB_CONTEXT (context)) context = g_object_ref (context); else context = gimp_pdb_context_new (gimp, context, TRUE); GIMP_PROCEDURE_GET_CLASS (procedure)->execute_async (procedure, gimp, context, progress, args, display); g_object_unref (context); } }
static void gimp_procedure_real_execute_async (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, GValueArray *args, GimpObject *display) { GValueArray *return_vals; GError *error = NULL; g_return_if_fail (args->n_values >= procedure->num_args); return_vals = GIMP_PROCEDURE_GET_CLASS (procedure)->execute (procedure, gimp, context, progress, args, &error); g_value_array_free (return_vals); if (error) { gimp_message_literal (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR, error->message); g_error_free (error); } }
const gchar * gimp_procedure_get_help_id (GimpProcedure *procedure) { g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), NULL); return GIMP_PROCEDURE_GET_CLASS (procedure)->get_help_id (procedure); }
gboolean gimp_procedure_get_sensitive (GimpProcedure *procedure, GimpObject *object) { g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), FALSE); g_return_val_if_fail (object == NULL || GIMP_IS_OBJECT (object), FALSE); return GIMP_PROCEDURE_GET_CLASS (procedure)->get_sensitive (procedure, object); }
GValueArray * gimp_procedure_execute (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, GValueArray *args, GError **error) { GValueArray *return_vals; GError *pdb_error = NULL; g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), NULL); g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL); g_return_val_if_fail (args != NULL, NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); if (! gimp_procedure_validate_args (procedure, procedure->args, procedure->num_args, args, FALSE, &pdb_error)) { return_vals = gimp_procedure_get_return_values (procedure, FALSE, pdb_error); g_propagate_error (error, pdb_error); return return_vals; } if (GIMP_IS_PDB_CONTEXT (context)) context = g_object_ref (context); else context = gimp_pdb_context_new (gimp, context, TRUE); /* call the procedure */ return_vals = GIMP_PROCEDURE_GET_CLASS (procedure)->execute (procedure, gimp, context, progress, args, error); g_object_unref (context); if (return_vals) { switch (g_value_get_enum (&return_vals->values[0])) { case GIMP_PDB_CALLING_ERROR: case GIMP_PDB_EXECUTION_ERROR: /* If the error has not already been set, construct one * from the error message that is optionally passed with * the return values. */ if (error && *error == NULL) { if (return_vals->n_values > 1 && G_VALUE_HOLDS_STRING (&return_vals->values[1])) { g_set_error_literal (error, GIMP_PDB_ERROR, GIMP_PDB_FAILED, g_value_get_string (&return_vals->values[1])); } } break; default: break; } } else { g_warning ("%s: no return values, shouldn't happen", G_STRFUNC); pdb_error = g_error_new (GIMP_PDB_ERROR, GIMP_PDB_INVALID_RETURN_VALUE, _("Procedure '%s' returned no return values"), gimp_object_get_name (procedure)); return_vals = gimp_procedure_get_return_values (procedure, FALSE, pdb_error); if (error && *error == NULL) g_propagate_error (error, pdb_error); else g_error_free (pdb_error); } return return_vals; }