Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
folder_survey_gui.c
Go to the documentation of this file.
1/*
2 This file is part of Ansel,
3 Copyright (C) 2026 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
19
20/* The two studio-capture questions that need a user, split out of common/folder_survey.c.
21 *
22 * They were the only reason a folder-monitoring state machine included gui/gtk.h -- and,
23 * for the resume prompt, views/view.h as well, so a layer-1 module was driving a view
24 * switch. Both dependencies leave with them.
25 */
26
28
29#include "common/conf.h"
31#include "gui/application.h"
32#include "views/view.h"
33
34#include <glib/gi18n.h>
35#include "widgets/dialog.h"
37
38/* Asks about images sitting in the surveyed folder that the library does not have yet.
39 * Returns TRUE to import them. The "delete originals" checkbox is only meaningful when
40 * copy-on-import is on, and is persisted here because it is the checkbox's own state --
41 * the backend has no opinion about it. */
43{
47 ngettext("%d image in the surveyed folder is not in the library yet.\nImport it now?",
48 "%d images in the surveyed folder are not in the library yet.\nImport them now?",
49 new_files),
50 new_files);
51
53 = gtk_check_button_new_with_label(_("Delete the originals after verifying the complete copies"));
55 dt_conf_get_bool("studio_capture/delete_source"));
59 gtk_widget_show_all(dialog);
60
61 const int import_now = gtk_dialog_run(GTK_DIALOG(dialog));
62 if(import_now == GTK_RESPONSE_YES && dt_conf_get_bool("studio_capture/copy"))
63 dt_conf_set_bool("studio_capture/delete_source",
65 gtk_widget_destroy(dialog);
67
69}
70
75
77{
79
80 char *folder = dt_conf_get_string("studio_capture/folder");
82
85 _("A studio capture session was monitoring `%s` when Ansel was last closed.\n"
86 "Resume the session?"),
87 folder ? folder : "");
88 const int resume = gtk_dialog_run(GTK_DIALOG(dialog));
89 gtk_widget_destroy(dialog);
90
92 {
93 // Persist the cleared marker so the question is not asked again.
95 dt_free(folder);
96 return G_SOURCE_REMOVE;
97 }
98
100
101 // dt_folder_survey_start() itself offers to import any images already
102 // sitting in the folder, covering files that appeared while Ansel was
103 // closed the same way it covers a plain session start.
105 dt_free(folder);
106 return G_SOURCE_REMOVE;
107}
108
109
110// clang-format off
111// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
112// vim: shiftwidth=2 expandtab tabstop=2 cindent
113// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
114// clang-format on
GtkWidget * dt_gui_main_window(void)
#define FALSE
Definition ashift_lsd.c:158
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
Definition colorspaces.h:98
void dt_conf_set_bool(const char *name, int val)
int dt_conf_get_bool(const char *name)
gchar * dt_conf_get_string(const char *name)
struct dt_view_manager_t * dt_view_manager_get_global(void)
Definition darktable.c:606
void dt_gui_refocus_parent(GtkWindow *parent)
Definition dialog.c:64
int dt_folder_survey_start()
Validate the persisted configuration and start monitoring.
void dt_folder_survey_forget_session()
Persist the cleared session marker, so resume is not proposed again.
gboolean dt_folder_survey_take_session_marker()
Consume the "a session was monitoring when we last closed" marker.
void dt_folder_survey_set_confirm_import_handler(dt_folder_survey_confirm_import_handler_t handler)
void dt_folder_survey_gui_register_handlers()
static gboolean _confirm_pending_import(int new_files)
gboolean dt_folder_survey_propose_resume()
Propose to resume an interrupted studio session at application start.
#define dt_free(ptr)
Definition mem_alloc.h:97
int dt_view_manager_switch(dt_view_manager_t *vm, const char *view_name)
Definition view.c:234
#define DT_GUI_BOX_SPACING