Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
collect.c File Reference
#include "libs/collect.h"
#include "bauhaus/bauhaus.h"
#include "common/collection.h"
#include "common/selection.h"
#include "common/darktable.h"
#include "common/debug.h"
#include "common/film.h"
#include "common/metadata.h"
#include "common/utility.h"
#include "common/image.h"
#include "common/map_locations.h"
#include "common/datetime.h"
#include "control/conf.h"
#include "control/control.h"
#include "control/jobs.h"
#include "dtgtk/button.h"
#include "gui/gtk.h"
#include "gui/preferences_dialogs.h"
#include "libs/lib.h"
#include "libs/lib_api.h"
#include "views/view.h"
#include <gio/gunixmounts.h>
+ Include dependency graph for collect.c:

Data Structures

struct  dt_lib_collect_rule_t
 
struct  dt_lib_collect_t
 
struct  dt_lib_collect_params_rule_t
 
struct  dt_lib_collect_params_t
 
struct  _range_t
 
struct  name_key_tuple_t
 

Macros

#define MAX_RULES   10
 
#define PARAM_STRING_SIZE   256
 
#define CLEAR_PARAMS(r)
 
#define ADD_COLLECT_ENTRY(value)
 

Typedefs

typedef struct dt_lib_collect_rule_t dt_lib_collect_rule_t
 
typedef struct dt_lib_collect_t dt_lib_collect_t
 
typedef struct dt_lib_collect_params_rule_t dt_lib_collect_params_rule_t
 
typedef struct dt_lib_collect_params_t dt_lib_collect_params_t
 
typedef enum dt_lib_collect_cols_t dt_lib_collect_cols_t
 
typedef struct _range_t _range_t
 
typedef struct name_key_tuple_t name_key_tuple_t
 

Enumerations

enum  dt_lib_collect_cols_t {
  DT_LIB_COLLECT_COL_TEXT = 0 ,
  DT_LIB_COLLECT_COL_ID ,
  DT_LIB_COLLECT_COL_TOOLTIP ,
  DT_LIB_COLLECT_COL_PATH ,
  DT_LIB_COLLECT_COL_VISIBLE ,
  DT_LIB_COLLECT_COL_UNREACHABLE ,
  DT_LIB_COLLECT_COL_COUNT ,
  DT_LIB_COLLECT_COL_INDEX ,
  DT_LIB_COLLECT_COL_FONT ,
  DT_LIB_COLLECT_NUM_COLS
}
 

Functions

static void _lib_collect_gui_update (dt_lib_module_t *self)
 
static void _lib_folders_update_collection (const gchar *filmroll)
 
static void entry_changed (GtkEntry *entry, dt_lib_collect_rule_t *dr)
 
static void collection_updated (gpointer instance, dt_collection_change_t query_change, dt_collection_properties_t changed_property, gpointer imgs, int next, gpointer self)
 
static void row_activated_with_event (GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *col, GdkEventButton *event, dt_lib_collect_t *d)
 
static int is_time_property (int property)
 
static void _populate_collect_combo (GtkWidget *w)
 
static gboolean item_is_folder_collection (dt_collection_properties_t item)
 
static gboolean item_is_numeric_collection (dt_collection_properties_t item)
 
const char * name (struct dt_lib_module_t *self)
 
voidlegacy_params (struct dt_lib_module_t *self, const void *const old_params, const size_t old_params_size, const int old_version, int *new_version, size_t *new_size)
 
void init_presets (dt_lib_module_t *self)
 
static void _lib_collect_update_params (dt_lib_collect_t *d)
 
voidget_params (dt_lib_module_t *self, int *size)
 
int set_params (dt_lib_module_t *self, const void *params, int size)
 
const char ** views (dt_lib_module_t *self)
 
uint32_t container (dt_lib_module_t *self)
 
static void view_popup_menu_onSearchFilmroll (GtkWidget *menuitem, gpointer userdata)
 
static void view_popup_menu_onRemove (GtkWidget *menuitem, gpointer userdata)
 
static void view_popup_menu (GtkWidget *treeview, GdkEventButton *event, dt_lib_collect_t *d)
 
static void _reset_tree_font (GtkTreeModel *model, GtkTreeIter *tree_iter)
 
static void _update_tree_view_nodes_font (GtkTreeSelection *selection)
 
static gboolean view_onButtonPressed (GtkWidget *treeview, GdkEventButton *event, dt_lib_collect_t *d)
 
static gboolean view_onPopupMenu (GtkWidget *treeview, dt_lib_collect_t *d)
 
static dt_lib_collect_tget_collect (dt_lib_collect_rule_t *r)
 
static dt_lib_collect_rule_tget_active_rule (dt_lib_collect_t *d)
 
static void get_number_of_rules (dt_lib_collect_t *d)
 
static gboolean list_select (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
 
static gboolean range_select (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
 
int _combo_get_active_collection (GtkWidget *combo)
 
gboolean _combo_set_active_collection (GtkWidget *combo, const int property)
 
static gboolean tree_expand (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
 
static gboolean list_match_string (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
 
static gboolean tree_match_string (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
 
static gboolean tree_reveal_func (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
 
static void tree_set_visibility (GtkTreeModel *model, gpointer data)
 
static void set_properties (dt_lib_collect_rule_t *dr)
 
static void get_properties (dt_lib_collect_rule_t *dr)
 
static GtkTreeModel * _create_filtered_model (GtkTreeModel *model, dt_lib_collect_rule_t *dr)
 
static int string_array_length (char **list)
 
static char ** split_path (const char *path)
 
static void free_tuple (gpointer data)
 
static gint sort_folder_tag (gconstpointer a, gconstpointer b)
 
static char * tag_collate_key (char *tag)
 
void tree_count_show (GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
 
static void tree_view (dt_lib_collect_rule_t *dr)
 
static void list_view (dt_lib_collect_rule_t *dr)
 
static void _clean_wildcards (dt_lib_collect_rule_t *dr)
 
static void update_view (dt_lib_collect_rule_t *dr)
 
static void _set_tooltip (dt_lib_collect_rule_t *d)
 
static void _set_rules_visibility (dt_lib_collect_rule_t *dr, gboolean last, gboolean active)
 
static gboolean _is_folder_collection (int i)
 
static gboolean _is_tag_collection (int i)
 
static void combo_changed (GtkWidget *combo, dt_lib_collect_rule_t *d)
 
static gboolean _clear_text_entry (dt_collection_properties_t next_property, dt_collection_properties_t prev_property, dt_lib_collect_rule_t *d)
 
static void _depopulate_combo (GtkWidget *combo)
 
static void _repopulate_combo (GtkWidget *combo)
 
static void _hide_all_rules (dt_lib_collect_t *d)
 
static void _refresh_rules_visibility (dt_lib_collect_t *d)
 
static void _update_collect_modes (dt_lib_collect_t *d, int variant)
 
static void _lib_collect_mode (GtkNotebook *notebook, GtkWidget *page, guint page_num, gpointer user_data)
 
void gui_reset (dt_lib_module_t *self)
 
static gboolean _is_folder_property (const int prop)
 
static gboolean _is_tag_property (const int prop)
 
static void entry_activated (GtkWidget *entry, dt_lib_collect_rule_t *d)
 
int position ()
 
static gboolean entry_focus_in_callback (GtkWidget *w, GdkEventFocus *event, dt_lib_collect_rule_t *d)
 
static void menuitem_mode (GtkMenuItem *menuitem, dt_lib_collect_rule_t *d)
 
static void menuitem_mode_change (GtkMenuItem *menuitem, dt_lib_collect_rule_t *d)
 
static void filmrolls_updated (gpointer instance, gpointer self)
 
static void filmrolls_imported (gpointer instance, int film_id, gpointer self)
 
static void preferences_changed (gpointer instance, gpointer self)
 
static void filmrolls_removed (gpointer instance, gpointer self)
 
static void tag_changed (gpointer instance, gpointer self)
 
static void geotag_changed (gpointer instance, GList *imgs, const int locid, gpointer self)
 
static void metadata_changed (gpointer instance, int type, gpointer self)
 
static void menuitem_clear (GtkMenuItem *menuitem, dt_lib_collect_rule_t *d)
 
static gboolean popup_button_callback (GtkWidget *widget, GdkEventButton *event, dt_lib_collect_rule_t *d)
 
void _menuitem_preferences (GtkMenuItem *menuitem, dt_lib_module_t *self)
 
void set_preferences (void *menu, dt_lib_module_t *self)
 
static gint _sort_model_func (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, dt_lib_module_t *self)
 
void _mount_changed (GUnixMountMonitor *monitor, dt_lib_module_t *self)
 
void gui_init (dt_lib_module_t *self)
 
void gui_cleanup (dt_lib_module_t *self)
 

Variables

static sqlite3_stmt * _collect_filmrolls_select_like_stmt = NULL
 
static sqlite3_stmt * _collect_filmrolls_update_stmt = NULL
 
static const char * UNCATEGORIZED_TAG = N_("uncategorized")
 

Macro Definition Documentation

◆ ADD_COLLECT_ENTRY

#define ADD_COLLECT_ENTRY (   value)
Value:
GUINT_TO_POINTER(value + 1), NULL, TRUE)
#define TRUE
Definition ashift_lsd.c:162
void dt_bauhaus_combobox_add_full(GtkWidget *widget, const char *text, dt_bauhaus_combobox_alignment_t align, gpointer data, void(free_func)(void *data), gboolean sensitive)
Definition bauhaus.c:1522
@ DT_BAUHAUS_COMBOBOX_ALIGN_RIGHT
Definition bauhaus.h:122
const char * dt_collection_name(dt_collection_properties_t prop)
Definition collection.c:656
static const dt_aligned_pixel_simd_t value
Definition darktable.h:501

◆ CLEAR_PARAMS

#define CLEAR_PARAMS (   r)
Value:
{ \
memset(&params, 0, sizeof(params)); \
params.rules = 1; \
params.rule[0].mode = 0; \
params.rule[0].item = r; \
}
const float r
Definition colorspaces_inline_conversions.h:1324

◆ MAX_RULES

#define MAX_RULES   10

◆ PARAM_STRING_SIZE

#define PARAM_STRING_SIZE   256

Typedef Documentation

◆ _range_t

typedef struct _range_t _range_t

◆ dt_lib_collect_cols_t

◆ dt_lib_collect_params_rule_t

◆ dt_lib_collect_params_t

◆ dt_lib_collect_rule_t

◆ dt_lib_collect_t

◆ name_key_tuple_t

Enumeration Type Documentation

◆ dt_lib_collect_cols_t

Enumerator
DT_LIB_COLLECT_COL_TEXT 
DT_LIB_COLLECT_COL_ID 
DT_LIB_COLLECT_COL_TOOLTIP 
DT_LIB_COLLECT_COL_PATH 
DT_LIB_COLLECT_COL_VISIBLE 
DT_LIB_COLLECT_COL_UNREACHABLE 
DT_LIB_COLLECT_COL_COUNT 
DT_LIB_COLLECT_COL_INDEX 
DT_LIB_COLLECT_COL_FONT 
DT_LIB_COLLECT_NUM_COLS 

Function Documentation

◆ _clean_wildcards()

◆ _clear_text_entry()

static gboolean _clear_text_entry ( dt_collection_properties_t  next_property,
dt_collection_properties_t  prev_property,
dt_lib_collect_rule_t d 
)
static

◆ _combo_get_active_collection()

◆ _combo_set_active_collection()

gboolean _combo_set_active_collection ( GtkWidget combo,
const int  property 
)

◆ _create_filtered_model()

◆ _depopulate_combo()

◆ _hide_all_rules()

static void _hide_all_rules ( dt_lib_collect_t d)
static

References d, FALSE, i, MAX_RULES, and TRUE.

Referenced by _lib_collect_gui_update(), and _lib_collect_mode().

◆ _is_folder_collection()

static gboolean _is_folder_collection ( int  i)
static

◆ _is_folder_property()

static gboolean _is_folder_property ( const int  prop)
static

◆ _is_tag_collection()

static gboolean _is_tag_collection ( int  i)
static

◆ _is_tag_property()

static gboolean _is_tag_property ( const int  prop)
static

References DT_COLLECTION_PROP_TAG.

Referenced by _clear_text_entry().

◆ _lib_collect_gui_update()

◆ _lib_collect_mode()

static void _lib_collect_mode ( GtkNotebook *  notebook,
GtkWidget page,
guint  page_num,
gpointer  user_data 
)
static

◆ _lib_collect_update_params()

static void _lib_collect_update_params ( dt_lib_collect_t d)
static

◆ _lib_folders_update_collection()

◆ _menuitem_preferences()

◆ _mount_changed()

◆ _populate_collect_combo()

◆ _refresh_rules_visibility()

static void _refresh_rules_visibility ( dt_lib_collect_t d)
static

◆ _repopulate_combo()

◆ _reset_tree_font()

static void _reset_tree_font ( GtkTreeModel *  model,
GtkTreeIter *  tree_iter 
)
static

Traverse down the tree from the node referred by the specified iterator in the given model in order to set to the default font the name of each child node. We walk down the tree by recursion. If the library is made up of millions collections, the recursion should be replaced by a stack-based iteration for better performance.

References _reset_tree_font(), DT_LIB_COLLECT_COL_FONT, and model.

Referenced by _reset_tree_font(), and _update_tree_view_nodes_font().

◆ _set_rules_visibility()

◆ _set_tooltip()

◆ _sort_model_func()

static gint _sort_model_func ( GtkTreeModel *  model,
GtkTreeIter *  a,
GtkTreeIter *  b,
dt_lib_module_t self 
)
static

References a, b, DT_LIB_COLLECT_COL_INDEX, and model.

Referenced by gui_init().

◆ _update_collect_modes()

◆ _update_tree_view_nodes_font()

static void _update_tree_view_nodes_font ( GtkTreeSelection *  selection)
static

Updates the font of the name of each node in the collection treeview according it is or not selected.

References _reset_tree_font(), DT_LIB_COLLECT_COL_FONT, and model.

Referenced by view_onButtonPressed().

◆ collection_updated()

◆ combo_changed()

◆ container()

uint32_t container ( dt_lib_module_t self)

◆ entry_activated()

◆ entry_changed()

◆ entry_focus_in_callback()

static gboolean entry_focus_in_callback ( GtkWidget w,
GdkEventFocus *  event,
dt_lib_collect_rule_t d 
)
static

References c, d, FALSE, get_active_rule(), get_collect(), and update_view().

Referenced by gui_init().

◆ filmrolls_imported()

static void filmrolls_imported ( gpointer  instance,
int  film_id,
gpointer  self 
)
static

◆ filmrolls_removed()

static void filmrolls_removed ( gpointer  instance,
gpointer  self 
)
static

◆ filmrolls_updated()

static void filmrolls_updated ( gpointer  instance,
gpointer  self 
)
static
Todo:
: We should update the count of images here

References _lib_collect_gui_update(), d, and dt_lib_module_t::data.

Referenced by gui_cleanup(), and gui_init().

◆ free_tuple()

static void free_tuple ( gpointer  data)
static

◆ geotag_changed()

◆ get_active_rule()

◆ get_collect()

◆ get_number_of_rules()

static void get_number_of_rules ( dt_lib_collect_t d)
static

◆ get_params()

void * get_params ( dt_lib_module_t self,
int *  size 
)

◆ get_properties()

◆ gui_cleanup()

◆ gui_init()

◆ gui_reset()

◆ init_presets()

◆ is_time_property()

◆ item_is_folder_collection()

static gboolean item_is_folder_collection ( dt_collection_properties_t  item)
static

◆ item_is_numeric_collection()

◆ legacy_params()

◆ list_match_string()

◆ list_select()

static gboolean list_select ( GtkTreeModel *  model,
GtkTreePath *  path,
GtkTreeIter *  iter,
gpointer  data 
)
static

◆ list_view()

static void list_view ( dt_lib_collect_rule_t dr)
static

References _combo_get_active_collection(), _create_filtered_model(), darktable_t::collection, dt_lib_collect_rule_t::combo, d, darktable, darktable_t::db, dt_collection_get_extended_where(), dt_collection_get_makermodel(), DT_COLLECTION_PROP_APERTURE, DT_COLLECTION_PROP_CAMERA, DT_COLLECTION_PROP_COLORLABEL, DT_COLLECTION_PROP_EXPOSURE, DT_COLLECTION_PROP_FILENAME, DT_COLLECTION_PROP_FILMROLL, DT_COLLECTION_PROP_FOCAL_LENGTH, DT_COLLECTION_PROP_GROUPING, DT_COLLECTION_PROP_HISTORY, DT_COLLECTION_PROP_ISO, DT_COLLECTION_PROP_LENS, DT_COLLECTION_PROP_LOCAL_COPY, DT_COLLECTION_PROP_METADATA, DT_COLLECTION_PROP_MODULE, DT_COLLECTION_PROP_ORDER, DT_COLLECTION_PROP_RATING, dt_conf_get_bool(), dt_conf_get_int(), dt_conf_get_string_const(), dt_database_get(), DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, dt_image_film_roll_name(), DT_IMAGE_LOCAL_COPY, DT_IOP_ORDER_LAST, dt_iop_order_string(), DT_LIB_COLLECT_COL_COUNT, DT_LIB_COLLECT_COL_FONT, DT_LIB_COLLECT_COL_ID, DT_LIB_COLLECT_COL_PATH, DT_LIB_COLLECT_COL_TEXT, DT_LIB_COLLECT_COL_TOOLTIP, DT_LIB_COLLECT_COL_UNREACHABLE, DT_LIB_COLLECT_COL_VISIBLE, DT_METADATA_FLAG_HIDDEN, dt_metadata_get_keyid_by_display_order(), dt_metadata_get_name(), DT_METADATA_NUMBER, dt_util_dstrcat(), FALSE, get_collect(), i, list_match_string(), list_select(), model, name, dt_lib_collect_rule_t::num, _range_t::path1, _range_t::path2, range_select(), dt_lib_collect_rule_t::searchstring, set_properties(), _range_t::start, _range_t::stop, dt_lib_collect_rule_t::text, TRUE, dt_lib_collect_rule_t::typing, and value.

Referenced by _mount_changed(), and update_view().

◆ menuitem_clear()

◆ menuitem_mode()

◆ menuitem_mode_change()

◆ metadata_changed()

◆ name()

const char * name ( struct dt_lib_module_t self)

◆ popup_button_callback()

static gboolean popup_button_callback ( GtkWidget widget,
GdkEventButton *  event,
dt_lib_collect_rule_t d 
)
static

◆ position()

int position ( )

◆ preferences_changed()

static void preferences_changed ( gpointer  instance,
gpointer  self 
)
static

◆ range_select()

static gboolean range_select ( GtkTreeModel *  model,
GtkTreePath *  path,
GtkTreeIter *  iter,
gpointer  data 
)
static

◆ row_activated_with_event()

◆ set_params()

◆ set_preferences()

void set_preferences ( void menu,
dt_lib_module_t self 
)

◆ set_properties()

◆ sort_folder_tag()

static gint sort_folder_tag ( gconstpointer  a,
gconstpointer  b 
)
static

References a, b, and name_key_tuple_t::collate_key.

Referenced by tree_view().

◆ split_path()

static char ** split_path ( const char *  path)
static

References dt_free, i, and size.

Referenced by tree_view().

◆ string_array_length()

static int string_array_length ( char **  list)
static

Referenced by tree_view().

◆ tag_changed()

◆ tag_collate_key()

static char * tag_collate_key ( char *  tag)
static

Referenced by tree_view().

◆ tree_count_show()

void tree_count_show ( GtkTreeViewColumn *  col,
GtkCellRenderer *  renderer,
GtkTreeModel *  model,
GtkTreeIter *  iter,
gpointer  data 
)

◆ tree_expand()

◆ tree_match_string()

static gboolean tree_match_string ( GtkTreeModel *  model,
GtkTreePath *  path,
GtkTreeIter *  iter,
gpointer  data 
)
static

◆ tree_reveal_func()

static gboolean tree_reveal_func ( GtkTreeModel *  model,
GtkTreePath *  path,
GtkTreeIter *  iter,
gpointer  data 
)
static

◆ tree_set_visibility()

static void tree_set_visibility ( GtkTreeModel *  model,
gpointer  data 
)
static

References model, tree_match_string(), and tree_reveal_func().

Referenced by tree_view().

◆ tree_view()

static void tree_view ( dt_lib_collect_rule_t dr)
static

References _combo_get_active_collection(), _create_filtered_model(), name_key_tuple_t::collate_key, darktable_t::collection, dt_lib_collect_rule_t::combo, name_key_tuple_t::count, d, darktable, darktable_t::db, dt_collection_get_extended_where(), DT_COLLECTION_PROP_CHANGE_TIMESTAMP, DT_COLLECTION_PROP_DAY, DT_COLLECTION_PROP_EXPORT_TIMESTAMP, DT_COLLECTION_PROP_FOLDERS, DT_COLLECTION_PROP_GEOTAGGING, DT_COLLECTION_PROP_IMPORT_TIMESTAMP, DT_COLLECTION_PROP_PRINT_TIMESTAMP, DT_COLLECTION_PROP_TAG, DT_COLLECTION_PROP_TIME, dt_conf_get_bool(), dt_database_get(), DT_DATETIME_EXIF_LENGTH, dt_datetime_gtimespan_to_exif(), DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, DT_LIB_COLLECT_COL_COUNT, DT_LIB_COLLECT_COL_FONT, DT_LIB_COLLECT_COL_INDEX, DT_LIB_COLLECT_COL_PATH, DT_LIB_COLLECT_COL_TEXT, DT_LIB_COLLECT_COL_TOOLTIP, DT_LIB_COLLECT_COL_UNREACHABLE, DT_LIB_COLLECT_COL_VISIBLE, dt_map_location_data_tag_root(), dt_util_dstrcat(), FALSE, free_tuple(), get_collect(), i, is_time_property(), item_is_numeric_collection(), model, name, name_key_tuple_t::name, dt_lib_collect_rule_t::num, _range_t::path1, _range_t::path2, range_select(), set_properties(), sort_folder_tag(), split_path(), _range_t::start, name_key_tuple_t::status, _range_t::stop, string_array_length(), tag_collate_key(), dt_lib_collect_rule_t::text, tree_expand(), tree_set_visibility(), TRUE, dt_lib_collect_rule_t::typing, and UNCATEGORIZED_TAG.

Referenced by _mount_changed(), _tree_query_tooltip(), _widget_auto_model_row_collapsed(), _widget_auto_model_row_expanded(), dt_accels_search(), dt_accels_window(), search_changed(), and update_view().

◆ update_view()

◆ view_onButtonPressed()

static gboolean view_onButtonPressed ( GtkWidget treeview,
GdkEventButton *  event,
dt_lib_collect_t d 
)
static

◆ view_onPopupMenu()

static gboolean view_onPopupMenu ( GtkWidget treeview,
dt_lib_collect_t d 
)
static

References d, DT_COLLECTION_PROP_FOLDERS, FALSE, TRUE, and view_popup_menu().

Referenced by gui_init().

◆ view_popup_menu()

static void view_popup_menu ( GtkWidget treeview,
GdkEventButton *  event,
dt_lib_collect_t d 
)
static

◆ view_popup_menu_onRemove()

◆ view_popup_menu_onSearchFilmroll()

◆ views()

const char ** views ( dt_lib_module_t self)

References v.

Variable Documentation

◆ _collect_filmrolls_select_like_stmt

sqlite3_stmt* _collect_filmrolls_select_like_stmt = NULL
static

◆ _collect_filmrolls_update_stmt

sqlite3_stmt* _collect_filmrolls_update_stmt = NULL
static

◆ UNCATEGORIZED_TAG

const char* UNCATEGORIZED_TAG = N_("uncategorized")
static

Referenced by tree_view().