Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
folder_survey.h File Reference
#include <glib.h>
+ Include dependency graph for folder_survey.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DT_FOLDER_SURVEY_STYLES_CONF_KEY   "studio_capture/styles"
 
#define DT_FOLDER_SURVEY_STYLES_SEPARATOR   "\x1f"
 

Functions

void dt_folder_survey_init ()
 Initialize the folder survey state from the persisted configuration.
 
int dt_folder_survey_start ()
 Validate the persisted configuration and start monitoring.
 
void dt_folder_survey_halt ()
 User-requested stop: end monitoring and clear the persisted session marker so the next application start does not propose to resume.
 
gboolean dt_folder_survey_is_active ()
 TRUE while the periodic folder scan is running.
 
gboolean dt_folder_survey_can_start (const char **message)
 Check, without any side effect, whether the persisted configuration has everything dt_folder_survey_start() requires to succeed.
 
gboolean dt_folder_survey_session_was_active ()
 TRUE when the previous application session quit while monitoring.
 
char * dt_folder_survey_destination_preview ()
 Build the expanded destination path of a sample file from the current configuration, for GUI preview purposes.
 
int dt_folder_survey_count_new_files ()
 Count files in the surveyed folder that are unknown to the persisted baseline, i.e. files that appeared while the application was closed.
 
void dt_folder_survey_absorb_new_files ()
 Record every file currently in the surveyed folder as already handled, so restarting the survey will not import them.
 
gboolean dt_folder_survey_propose_resume ()
 Propose to resume an interrupted studio session at application start.
 
void dt_folder_survey_stop ()
 Stop new scans before control workers begin shutting down.
 
void dt_folder_survey_cleanup ()
 Release folder survey state after control workers have stopped.
 

Macro Definition Documentation

◆ DT_FOLDER_SURVEY_STYLES_CONF_KEY

#define DT_FOLDER_SURVEY_STYLES_CONF_KEY   "studio_capture/styles"

Conf key holding the ordered list of style names auto-applied to studio captures, separated by DT_FOLDER_SURVEY_STYLES_SEPARATOR. Style names may contain any printable character, so the separator is a control character that cannot appear in a name and stays on one line in the conf file.

Definition at line 19 of file folder_survey.h.

◆ DT_FOLDER_SURVEY_STYLES_SEPARATOR

#define DT_FOLDER_SURVEY_STYLES_SEPARATOR   "\x1f"

Definition at line 20 of file folder_survey.h.

Function Documentation

◆ dt_folder_survey_absorb_new_files()

◆ dt_folder_survey_can_start()

gboolean dt_folder_survey_can_start ( const char **  message)

Check, without any side effect, whether the persisted configuration has everything dt_folder_survey_start() requires to succeed.

Parameters
messagereceives a translated, static explanation when the configuration is incomplete or invalid; left untouched otherwise. Safe to display directly in the GUI (e.g. as a status label or tooltip).
Returns
gboolean TRUE when dt_folder_survey_start() would succeed.

Definition at line 691 of file folder_survey.c.

References dt_conf_get_bool(), dt_conf_get_string_const(), dt_datetime_entry_to_exif(), DT_DATETIME_LENGTH, dt_folder_survey_destination_preview(), dt_free, dt_util_test_writable_dir(), FALSE, IS_NULL_PTR, and TRUE.

Referenced by _studio_import_update_state(), and dt_folder_survey_start().

◆ dt_folder_survey_cleanup()

◆ dt_folder_survey_count_new_files()

int dt_folder_survey_count_new_files ( )

◆ dt_folder_survey_destination_preview()

char * dt_folder_survey_destination_preview ( )

Build the expanded destination path of a sample file from the current configuration, for GUI preview purposes.

Returns
char* newly allocated preview path, or NULL when the configuration cannot produce a valid destination. Free with dt_free().

Definition at line 598 of file folder_survey.c.

References dt_build_filename_from_pattern(), dt_conf_get_bool(), dt_conf_get_string(), dt_control_import_data_free(), dt_datetime_entry_to_exif(), DT_DATETIME_LENGTH, dt_free, dt_image_init(), dt_string_to_datetime(), dt_util_test_writable_dir(), dt_control_import_t::imgs, IS_NULL_PTR, and TRUE.

Referenced by _studio_import_update_preview(), and dt_folder_survey_can_start().

◆ dt_folder_survey_halt()

void dt_folder_survey_halt ( )

User-requested stop: end monitoring and clear the persisted session marker so the next application start does not propose to resume.

Definition at line 923 of file folder_survey.c.

References _folder_survey, _folder_survey_deactivate(), dt_folder_survey_t::active, darktable, dt_control_log(), DT_DEBUG_CONTROL_SIGNAL_RAISE, dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), DT_SIGNAL_FOLDER_SURVEY_CHANGED, dt_folder_survey_t::initialized, dt_folder_survey_t::lock, and darktable_t::signals.

Referenced by _studio_import_toggle_callback().

◆ dt_folder_survey_init()

◆ dt_folder_survey_is_active()

gboolean dt_folder_survey_is_active ( )

◆ dt_folder_survey_propose_resume()

gboolean dt_folder_survey_propose_resume ( )

Propose to resume an interrupted studio session at application start.

When the previous session quit while monitoring, ask the user whether to resume; on acceptance, switch to the Studio Capture view, then ask whether files that appeared meanwhile should be imported now (with an optional delete-source-after-verified-copy). Call after the GUI and views are ready.

Returns
gboolean always G_SOURCE_REMOVE, so it can be scheduled with g_idle_add().

Definition at line 1038 of file folder_survey.c.

References _folder_survey, _folder_survey_save_locked(), darktable, dt_conf_get_string(), dt_folder_survey_session_was_active(), dt_folder_survey_start(), dt_free, dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_ui_main_window(), dt_view_manager_switch(), FALSE, darktable_t::gui, dt_folder_survey_t::lock, dt_gui_gtk_t::ui, darktable_t::view_manager, and dt_folder_survey_t::was_active_last_session.

Referenced by dt_init().

◆ dt_folder_survey_session_was_active()

gboolean dt_folder_survey_session_was_active ( )

TRUE when the previous application session quit while monitoring.

Definition at line 949 of file folder_survey.c.

References _folder_survey, dt_folder_survey_t::initialized, and dt_folder_survey_t::was_active_last_session.

Referenced by dt_folder_survey_propose_resume(), and dt_init().

◆ dt_folder_survey_start()

◆ dt_folder_survey_stop()

void dt_folder_survey_stop ( )

Stop new scans before control workers begin shutting down.

The persisted session marker keeps its current state so an active session can be proposed for resume on the next start.

Definition at line 1093 of file folder_survey.c.

References _folder_survey, _folder_survey_save_locked(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_folder_survey_t::immediate_scan, dt_folder_survey_t::initialized, dt_folder_survey_t::lock, dt_folder_survey_t::shutting_down, dt_folder_survey_t::timer, and TRUE.

Referenced by dt_cleanup(), and dt_folder_survey_cleanup().