Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
import_jobs.h
Go to the documentation of this file.
1/*
2 This file is part of the Ansel project.
3 Copyright (C) 2025 Aurélien PIERRE.
4
5 Ansel is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 Ansel is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with Ansel. If not, see <http://www.gnu.org/licenses/>.
17*/
18#pragma once
19
20#include "common/image.h"
21#include "control/control.h"
22#include "common/variables.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28
36{
37 DT_IMPORT_ONCONFLICT_SKIP = 0, // keep the existing destination file (legacy behaviour)
38 DT_IMPORT_ONCONFLICT_OVERWRITE = 1, // replace the existing destination with the source
39 DT_IMPORT_ONCONFLICT_UNIQUE = 2 // copy the source under a new, non-colliding name
41
42typedef struct dt_control_import_t
43{
44 GList *imgs;
45 GDateTime *datetime;
46 gboolean copy;
47 gboolean delete_source;
48 gboolean folder_survey;
49
50 // Behaviour when a copy destination path already exists.
52
53 // Optional list of style names (owned char*) applied, in order, to each
54 // successfully imported image. All styles are applied in APPEND mode.
55 GList *styles;
56
57 // String expanded as $(JOBCODE) in patterns
58 char *jobcode;
59
60 // Base folder of all import subfolders. Input.
62
63 // Pattern to build import subfolders for imports with copy,
64 // child of base_folder. Input
66
67 // Pattern to build file names for imports with copy. Input
69
70 // Computed base_folder/target_subfolder from expanding patterns and variables.
71 // Output.
73
74 // Number of elements to import
75 const int elements;
76
77 // List of pathes of files that couldn't be imported due to filesystem errors or overrides.
78 GList *discarded;
79
87 void (*file_imported)(const char *source, gboolean success, gpointer user_data);
88 gpointer callback_data;
89 GDestroyNotify callback_data_free;
90
92
93
94// free the internal strings of a dt_control_import_t structure. Doesn't free the structure itself.
96
97
107gchar *dt_build_filename_from_pattern(const char *const filename, const int index, dt_image_t *img, dt_control_import_t *data);
108
109
117
118
119#ifdef __cplusplus
120}
121#endif
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
dt_import_onconflict_t
Behaviour when a copy-on-import destination path already exists.
Definition import_jobs.h:36
@ DT_IMPORT_ONCONFLICT_UNIQUE
Definition import_jobs.h:39
@ DT_IMPORT_ONCONFLICT_SKIP
Definition import_jobs.h:37
@ DT_IMPORT_ONCONFLICT_OVERWRITE
Definition import_jobs.h:38
gchar * dt_build_filename_from_pattern(const char *const filename, const int index, dt_image_t *img, dt_control_import_t *data)
Build a full path for a given image file, given a pattern.
Definition import_jobs.c:76
int dt_control_import(dt_control_import_t data)
Process a list of images to import with or without copying the files on an arbitrary hard-drive.
void dt_control_import_data_free(dt_control_import_t *data)
dt_import_onconflict_t on_conflict
Definition import_jobs.h:51
GDateTime * datetime
Definition import_jobs.h:45
GDestroyNotify callback_data_free
Definition import_jobs.h:89
void(* file_imported)(const char *source, gboolean success, gpointer user_data)
Optional per-file completion method.
Definition import_jobs.h:87
char * target_subfolder_pattern
Definition import_jobs.h:65