static void vectors_export_response (GtkWidget *widget, gint response_id, VectorsExportDialog *dialog) { if (response_id == GTK_RESPONSE_OK) { GimpVectors *vectors = NULL; gchar *filename; GError *error = NULL; vectors_export_active_only = dialog->active_only; filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget)); if (vectors_export_active_only) vectors = gimp_image_get_active_vectors (dialog->image); if (! gimp_vectors_export_file (dialog->image, vectors, filename, &error)) { gimp_message (dialog->image->gimp, G_OBJECT (widget), GIMP_MESSAGE_ERROR, "%s", error->message); g_error_free (error); return; } g_free (filename); } gtk_widget_destroy (widget); }
static void vectors_export_callback (GtkWidget *dialog, GimpImage *image, GFile *file, GFile *export_folder, gboolean active_only, gpointer user_data) { GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config); GimpVectors *vectors = NULL; gchar *path = NULL; GError *error = NULL; if (export_folder) path = gimp_file_get_config_path (export_folder, NULL); g_object_set (config, "path-export-path", path, "path-export-active-only", active_only, NULL); if (path) g_free (path); if (config->vectors_export_active_only) vectors = gimp_image_get_active_vectors (image); if (! gimp_vectors_export_file (image, vectors, file, &error)) { gimp_message (image->gimp, G_OBJECT (dialog), GIMP_MESSAGE_ERROR, "%s", error->message); g_clear_error (&error); return; } gtk_widget_destroy (dialog); }