Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
film.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2009-2013 johannes hanika.
4 Copyright (C) 2010 Henrik Andersson.
5 Copyright (C) 2011, 2014, 2016 Tobias Ellinghaus.
6 Copyright (C) 2012 Richard Wonka.
7 Copyright (C) 2013 Jérémy Rosen.
8 Copyright (C) 2013 Simon Spannagel.
9 Copyright (C) 2016 Roman Lebedev.
10 Copyright (C) 2020 Pascal Obry.
11 Copyright (C) 2021 Philippe Weyland.
12 Copyright (C) 2022 HansBull.
13 Copyright (C) 2022 Martin Bařinka.
14 Copyright (C) 2025 Aurélien PIERRE.
15
16 darktable is free software: you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by
18 the Free Software Foundation, either version 3 of the License, or
19 (at your option) any later version.
20
21 darktable is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 GNU General Public License for more details.
25
26 You should have received a copy of the GNU General Public License
27 along with darktable. If not, see <http://www.gnu.org/licenses/>.
28*/
29
30#ifndef DT_COMMON_FILM_H
31#define DT_COMMON_FILM_H
32
33#include "system/dtpthread.h"
34
35#include <glib.h>
36#include <inttypes.h>
37
43typedef struct dt_film_t
44{
45 int32_t id;
46 char dirname[512];
47 dt_pthread_mutex_t images_mutex;
48 GDir *dir;
50 int32_t ref;
52
53void dt_film_init(dt_film_t *film);
54void dt_film_cleanup(dt_film_t *film);
56int dt_film_open(const int32_t id);
57
60int dt_film_import(const char *dirname);
62void dt_film_set_query(const int32_t id);
64int32_t dt_film_get_id(const char *folder);
66void dt_film_remove(const int id);
68gboolean dt_film_is_empty(const int id);
70int dt_film_new(dt_film_t *film, const char *directory);
74GList *dt_film_get_image_ids(const int filmid);
75// initialize film folder status
79void dt_film_relocate(const char *old_path, const char *new_path);
80
81/* Removing an empty film roll leaves an empty DIRECTORY on disk, and the "ask_before_rmdir"
82 * preference says the user must be asked before it goes. Asking is a dialog, which is not
83 * this layer's business -- so the backend hands the list to whoever can ask, and does the
84 * deleting itself once told to.
85 *
86 * With no handler registered (ansel-cli, ansel-generate-cache, any headless run) the list is
87 * simply freed and nothing is deleted. That is the safe default: "ask first" cannot be
88 * honoured when there is nobody to ask, so the directories stay. */
89
93typedef void (*dt_film_confirm_rmdir_handler_t)(GList *empty_dirs);
94
97
99void dt_film_remove_directories(const GList *dirs);
100
101
102/* Whoever is showing the film-roll list wants to know when that list changed -- a roll
103 * removed, or one brought back by an undo. Raising DT_SIGNAL_FILMROLLS_CHANGED here would
104 * be a call into control/ (layer 3) from layer 1, which is what the include-graph ratchet
105 * counts; the fact travels the other way instead, exactly as common/image_notify.h and
106 * common/thumbnail_notify.h already do for theirs. With no handler installed -- ansel-cli,
107 * a unit test -- it is dropped, which is correct for both. */
108
112
115
118
119#endif // DT_COMMON_FILM_H
120
121// clang-format off
122// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
123// vim: shiftwidth=2 expandtab tabstop=2 cindent
124// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
125// clang-format on
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
gchar * directory
documentation root given after –doc, or NULL
GtkWidget * folder
destination folder chooser
void dt_film_init(dt_film_t *film)
Definition film.c:74
void dt_film_relocate(const char *old_path, const char *new_path)
Definition film.c:380
void(* dt_film_rolls_changed_handler_t)(void)
The film-roll list changed. Raised on whichever thread changed it; a handler that touches widgets get...
Definition film.h:111
gboolean dt_film_is_empty(const int id)
Definition film.c:333
int dt_film_new(dt_film_t *film, const char *directory)
Definition film.c:129
void dt_film_set_rolls_changed_handler(dt_film_rolls_changed_handler_t handler)
Install the handler, or NULL to remove it.
Definition film.c:242
void dt_film_remove_empty()
Definition film.c:291
void dt_film_remove(const int id)
Definition film.c:340
void(* dt_film_confirm_rmdir_handler_t)(GList *empty_dirs)
Definition film.h:93
int32_t dt_film_get_id(const char *folder)
Definition film.c:108
void dt_film_set_query(const int32_t id)
Definition film.c:94
GList * dt_film_get_image_ids(const int filmid)
Definition film.c:398
void dt_film_remove_directories(const GList *dirs)
Definition film.c:253
int dt_film_open(const int32_t id)
Definition film.c:113
void dt_film_set_folder_status()
Definition film.c:409
void dt_film_set_confirm_rmdir_handler(dt_film_confirm_rmdir_handler_t handler)
Definition film.c:233
int dt_film_import(const char *dirname)
Definition film.c:187
void dt_film_cleanup(dt_film_t *film)
Definition film.c:84
void dt_film_notify_rolls_changed(void)
State that the film-roll list changed.
Definition film.c:247
int32_t num_images
Definition film.h:49
dt_pthread_mutex_t images_mutex
Definition film.h:47
int32_t id
Definition film.h:45
GDir * dir
Definition film.h:48
int32_t ref
Definition film.h:50
int32_t last_loaded
Definition film.h:49
char dirname[512]
Definition film.h:46