void edit_copy_visible_cmd_callback (GtkAction *action, gpointer data) { GimpImage *image; GError *error = NULL; return_if_no_image (image, data); if (gimp_edit_copy_visible (image, action_data_get_context (data), &error)) { GimpDisplay *display = action_data_get_display (data); if (display) gimp_message_literal (image->gimp, G_OBJECT (display), GIMP_MESSAGE_INFO, _("Copied pixels to the clipboard")); gimp_image_flush (image); } else { gimp_message_literal (image->gimp, G_OBJECT (action_data_get_display (data)), GIMP_MESSAGE_WARNING, error->message); g_clear_error (&error); } }
static GimpValueArray * edit_copy_visible_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpValueArray *return_vals; GimpImage *image; gboolean non_empty = FALSE; image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp); if (success) { GError *my_error = NULL; non_empty = gimp_edit_copy_visible (image, context, &my_error) != NULL; if (! non_empty) { gimp_message_literal (gimp, G_OBJECT (progress), GIMP_MESSAGE_WARNING, my_error->message); g_clear_error (&my_error); } } return_vals = gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) g_value_set_boolean (gimp_value_array_index (return_vals, 1), non_empty); return return_vals; }