Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
image_jobs.c
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2010, 2014 Henrik Andersson.
4 Copyright (C) 2010-2011, 2014 johannes hanika.
5 Copyright (C) 2012 Richard Wonka.
6 Copyright (C) 2012, 2014, 2016 Tobias Ellinghaus.
7 Copyright (C) 2014-2016 Roman Lebedev.
8 Copyright (C) 2018-2021 Pascal Obry.
9 Copyright (C) 2019 Bill Ferguson.
10 Copyright (C) 2020-2021 Aldric Renaudin.
11 Copyright (C) 2020 Hubert Kowalski.
12 Copyright (C) 2022 Martin Bařinka.
13 Copyright (C) 2023, 2025 Aurélien PIERRE.
14
15 darktable is free software: you can redistribute it and/or modify
16 it under the terms of the GNU General Public License as published by
17 the Free Software Foundation, either version 3 of the License, or
18 (at your option) any later version.
19
20 darktable is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with darktable. If not, see <http://www.gnu.org/licenses/>.
27*/
28
30#include "common/darktable.h"
31#include "common/image_cache.h"
32
38
39
40typedef struct dt_image_import_t
41{
42 uint32_t film_id;
43 gchar *filename;
45
47{
48 char message[512] = { 0 };
50
51 snprintf(message, sizeof(message), _("importing image %s"), params->filename);
53
54 const int id = dt_image_import(params->film_id, params->filename, TRUE);
55 if(id)
58 return 0;
59}
60
62{
63 dt_image_import_t *params = p;
64
65 dt_free(params->filename);
66
67 dt_free(params);
68}
69
70dt_job_t *dt_image_import_job_create(uint32_t filmid, const char *filename)
71{
72 dt_image_import_t *params;
74 if(IS_NULL_PTR(job)) return NULL;
75 params = (dt_image_import_t *)calloc(1, sizeof(dt_image_import_t));
76 if(IS_NULL_PTR(params))
77 {
79 return NULL;
80 }
81 dt_control_job_add_progress(job, _("import image"), FALSE);
83 params->filename = g_strdup(filename);
84 params->film_id = filmid;
85 return job;
86}
87
88// clang-format off
89// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
90// vim: shiftwidth=2 expandtab tabstop=2 cindent
91// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
92// clang-format on
#define TRUE
Definition ashift_lsd.c:162
#define FALSE
Definition ashift_lsd.c:158
static const dt_aligned_pixel_simd_t const dt_adaptation_t const float p
int32_t dt_image_import(const int32_t film_id, const char *filename, gboolean raise_signals)
void dt_control_queue_redraw()
request redraw of the workspace. This redraws the whole workspace within a gdk critical section to pr...
Definition control.c:856
#define dt_free(ptr)
Definition darktable.h:456
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
Definition darktable.h:281
static void dt_image_import_job_cleanup(void *p)
Definition image_jobs.c:61
static int32_t dt_image_import_job_run(dt_job_t *job)
Definition image_jobs.c:46
dt_job_t * dt_image_import_job_create(uint32_t filmid, const char *filename)
Definition image_jobs.c:70
dt_job_t * dt_control_job_create(dt_job_execute_callback execute, const char *msg,...)
Definition jobs.c:135
void * dt_control_job_get_params(const _dt_job_t *job)
Definition jobs.c:129
void dt_control_job_set_progress(dt_job_t *job, double value)
Definition jobs.c:626
void dt_control_job_add_progress(dt_job_t *job, const char *message, gboolean cancellable)
Definition jobs.c:612
void dt_control_job_set_progress_message(dt_job_t *job, const char *message)
Definition jobs.c:620
void dt_control_job_set_params(_dt_job_t *job, void *params, dt_job_destroy_callback callback)
Definition jobs.c:112
void dt_control_job_dispose(_dt_job_t *job)
Definition jobs.c:153
dt_mipmap_size_t
dt_mipmap_size_t mip
Definition image_jobs.c:36