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"
 

Typedefs

typedef gboolean(* dt_folder_survey_confirm_import_handler_t) (int new_files)
 

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.
 
void dt_folder_survey_set_confirm_import_handler (dt_folder_survey_confirm_import_handler_t handler)
 
gboolean dt_folder_survey_take_session_marker ()
 Consume the "a session was monitoring when we last closed" marker.
 
void dt_folder_survey_forget_session ()
 Persist the cleared session marker, so resume is not proposed again.
 
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 20 of file folder_survey.h.

◆ DT_FOLDER_SURVEY_STYLES_SEPARATOR

#define DT_FOLDER_SURVEY_STYLES_SEPARATOR   "\x1f"

Definition at line 21 of file folder_survey.h.

Typedef Documentation

◆ dt_folder_survey_confirm_import_handler_t

typedef gboolean(* dt_folder_survey_confirm_import_handler_t) (int new_files)

Ask whether the new_files images found in the surveyed folder should be imported now. Return TRUE to import them, FALSE to absorb them into the baseline.

With no handler registered the question is not asked AND nothing is absorbed: absorbing is the answer to a question nobody put, and would silently hide those files from every later scan. They stay pending instead.

Definition at line 103 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 694 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, folder, IS_NULL_PTR, preview, 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 601 of file folder_survey.c.

References dt_alloc_align(), 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_free_align, dt_image_init(), dt_string_to_datetime(), dt_util_test_writable_dir(), folder, 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_forget_session()

void dt_folder_survey_forget_session ( )

Persist the cleared session marker, so resume is not proposed again.

Definition at line 1034 of file folder_survey.c.

References _folder_survey, _folder_survey_save_locked(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), and dt_folder_survey_t::lock.

Referenced by dt_folder_survey_propose_resume().

◆ dt_folder_survey_halt()

void dt_folder_survey_halt ( )

◆ dt_folder_survey_init()

◆ dt_folder_survey_is_active()

gboolean dt_folder_survey_is_active ( )

◆ 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 936 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_take_session_marker(), and dt_init().

◆ dt_folder_survey_set_confirm_import_handler()

void dt_folder_survey_set_confirm_import_handler ( dt_folder_survey_confirm_import_handler_t  handler)

Install the handler that asks about pending imports. NULL removes it.

Definition at line 816 of file folder_survey.c.

References _confirm_import_handler.

Referenced by dt_folder_survey_gui_register_handlers().

◆ 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 1060 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().

◆ dt_folder_survey_take_session_marker()

gboolean dt_folder_survey_take_session_marker ( )

Consume the "a session was monitoring when we last closed" marker.

Returns TRUE when the previous run quit while monitoring, and clears the in-memory marker either way, so the resume question is asked at most once per start. Persist the cleared marker with dt_folder_survey_forget_session() if the user declines; accepting leads to dt_folder_survey_start(), which persists it itself.

Definition at line 1025 of file folder_survey.c.

References _folder_survey, dt_folder_survey_session_was_active(), FALSE, TRUE, and dt_folder_survey_t::was_active_last_session.

Referenced by dt_folder_survey_propose_resume().