Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
tags.c File Reference
#include "common/tags.h"
#include "common/collection.h"
#include "common/darktable.h"
#include "common/debug.h"
#include "common/grouping.h"
#include "common/selection.h"
#include "common/undo.h"
#include "control/conf.h"
#include "control/control.h"
#include <glib.h>
+ Include dependency graph for tags.c:

Go to the source code of this file.

Data Structures

struct  dt_undo_tags_t
 

Typedefs

typedef struct dt_undo_tags_t dt_undo_tags_t
 
typedef enum dt_tag_type_t dt_tag_type_t
 
typedef enum dt_tag_actions_t dt_tag_actions_t
 

Enumerations

enum  dt_tag_type_t {
  DT_TAG_TYPE_DT ,
  DT_TAG_TYPE_USER ,
  DT_TAG_TYPE_ALL
}
 
enum  dt_tag_actions_t {
  DT_TA_ATTACH = 0 ,
  DT_TA_DETACH ,
  DT_TA_SET ,
  DT_TA_SET_ALL
}
 

Functions

static gchar * _get_tb_removed_tag_string_values (GList *before, GList *after)
 
static gchar * _get_tb_added_tag_string_values (const int img, GList *before, GList *after)
 
static void _bulk_remove_tags (const int img, const gchar *tag_list)
 
static void _bulk_add_tags (const gchar *tag_list)
 
static void _pop_undo_execute (const int32_t imgid, GList *before, GList *after)
 
static void _pop_undo (gpointer user_data, dt_undo_type_t type, dt_undo_data_t data, dt_undo_action_t action, GList **imgs)
 
static void _undo_tags_free (gpointer data)
 
static void _tags_undo_data_free (gpointer data)
 
gboolean dt_tag_new (const char *name, guint *tagid)
 
gboolean dt_tag_new_from_gui (const char *name, guint *tagid)
 
guint dt_tag_remove (const guint tagid, gboolean final)
 
void dt_tag_delete_tag_batch (const char *flatlist)
 
guint dt_tag_remove_list (GList *tag_list)
 
gchar * dt_tag_get_name (const guint tagid)
 
void dt_tag_rename (const guint tagid, const gchar *new_tagname)
 
gboolean dt_tag_exists (const char *name, guint *tagid)
 
static gboolean _tag_add_tags_to_list (GList **list, const GList *tags)
 
static gboolean _tag_remove_tags_from_list (GList **list, const GList *tags)
 
static GList * _tag_get_tags (const int32_t imgid, const dt_tag_type_t type)
 
static gboolean _tag_execute (const GList *tags, const GList *imgs, GList **undo, const gboolean undo_on, const gint action)
 
gboolean dt_tag_attach_images (const guint tagid, const GList *img, const gboolean undo_on)
 
gboolean dt_tag_attach (const guint tagid, const int32_t imgid, const gboolean undo_on, const gboolean group_on)
 
gboolean dt_tag_set_tags (const GList *tags, const GList *img, const gboolean ignore_dt_tags, const gboolean clear_on, const gboolean undo_on)
 
gboolean dt_tag_attach_string_list (const gchar *tags, const GList *img, const gboolean undo_on)
 
gboolean dt_tag_detach_images (const guint tagid, const GList *img, const gboolean undo_on)
 
gboolean dt_tag_detach (const guint tagid, const int32_t imgid, const gboolean undo_on, const gboolean group_on)
 
gboolean dt_tag_detach_by_string (const char *name, const int32_t imgid, const gboolean undo_on, const gboolean group_on)
 
void dt_set_darktable_tags ()
 
uint32_t dt_tag_get_attached (const int32_t imgid, GList **result, const gboolean ignore_dt_tags)
 
static uint32_t _tag_get_attached_export (const int32_t imgid, GList **result)
 
static gint sort_tag_by_path (gconstpointer a, gconstpointer b)
 
static gint sort_tag_by_leave (gconstpointer a, gconstpointer b)
 
static gint sort_tag_by_count (gconstpointer a, gconstpointer b)
 
GList * dt_sort_tag (GList *tags, gint sort_type)
 
GList * dt_tag_get_list (int32_t imgid)
 
GList * dt_tag_get_hierarchical (int32_t imgid)
 
GList * dt_tag_get_tags (const int32_t imgid, const gboolean ignore_dt_tags)
 
static gint _is_not_exportable_tag (gconstpointer a, gconstpointer b)
 
GList * dt_tag_get_list_export (int32_t imgid, int32_t flags)
 
GList * dt_tag_get_hierarchical_export (int32_t imgid, int32_t flags)
 
gboolean dt_is_tag_attached (const guint tagid, const int32_t imgid)
 
GList * dt_tag_get_images (const gint tagid)
 
GList * dt_tag_get_images_from_list (const GList *img, const gint tagid)
 
uint32_t dt_tag_get_suggestions (GList **result)
 
void dt_tag_count_tags_images (const gchar *keyword, int *tag_count, int *img_count)
 
void dt_tag_get_tags_images (const gchar *keyword, GList **tag_list, GList **img_list)
 
uint32_t dt_tag_images_count (gint tagid)
 
uint32_t dt_tag_get_with_usage (GList **result)
 
uint32_t dt_tag_get_collection_tags (GList **result)
 
static gchar * dt_cleanup_synonyms (gchar *synonyms_entry)
 
gchar * dt_tag_get_synonyms (gint tagid)
 
void dt_tag_set_synonyms (gint tagid, gchar *synonyms_entry)
 
gint dt_tag_get_flags (gint tagid)
 
void dt_tag_set_flags (gint tagid, gint flags)
 
void dt_tag_add_synonym (gint tagid, gchar *synonym)
 
static void _free_result_item (gpointer data)
 
void dt_tag_free_result (GList **result)
 
uint32_t dt_tag_get_recent_used (GList **result)
 
uint32_t dt_tag_import (const char *filename)
 
uint32_t dt_tag_export (const char *filename)
 
char * dt_tag_get_subtags (const int32_t imgid, const char *category, const int level)
 
gboolean dt_tag_get_tag_order_by_id (const uint32_t tagid, uint32_t *sort, gboolean *descending)
 
uint32_t dt_tag_get_tag_id_by_name (const char *const name)
 
void dt_tag_set_tag_order_by_id (const uint32_t tagid, const uint32_t sort, const gboolean descending)
 
void dt_tags_cleanup (void)
 

Variables

static sqlite3_stmt * _tag_get_attached_single_stmt = NULL
 
static sqlite3_stmt * _tag_get_attached_single_ignore_stmt = NULL
 
static sqlite3_stmt * _tag_get_attached_selected_stmt = NULL
 
static sqlite3_stmt * _tag_get_attached_selected_ignore_stmt = NULL
 

Typedef Documentation

◆ dt_tag_actions_t

◆ dt_tag_type_t

◆ dt_undo_tags_t

Enumeration Type Documentation

◆ dt_tag_actions_t

Enumerator
DT_TA_ATTACH 
DT_TA_DETACH 
DT_TA_SET 
DT_TA_SET_ALL 

Definition at line 408 of file tags.c.

◆ dt_tag_type_t

Enumerator
DT_TAG_TYPE_DT 
DT_TAG_TYPE_USER 
DT_TAG_TYPE_ALL 

Definition at line 401 of file tags.c.

Function Documentation

◆ _bulk_add_tags()

static void _bulk_add_tags ( const gchar *  tag_list)
static

Definition at line 119 of file tags.c.

References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_PREPARE_V2, and dt_free.

Referenced by _pop_undo_execute().

◆ _bulk_remove_tags()

static void _bulk_remove_tags ( const int  img,
const gchar *  tag_list 
)
static

Definition at line 106 of file tags.c.

References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_PREPARE_V2, and dt_free.

Referenced by _pop_undo_execute().

◆ _free_result_item()

static void _free_result_item ( gpointer  data)
static

Definition at line 1584 of file tags.c.

References dt_free, and t.

Referenced by dt_tag_free_result().

◆ _get_tb_added_tag_string_values()

static gchar * _get_tb_added_tag_string_values ( const int  img,
GList *  before,
GList *  after 
)
static

Definition at line 83 of file tags.c.

References dt_util_dstrcat().

Referenced by _pop_undo_execute().

◆ _get_tb_removed_tag_string_values()

static gchar * _get_tb_removed_tag_string_values ( GList *  before,
GList *  after 
)
static

Definition at line 68 of file tags.c.

References dt_util_dstrcat().

Referenced by _pop_undo_execute().

◆ _is_not_exportable_tag()

static gint _is_not_exportable_tag ( gconstpointer  a,
gconstpointer  b 
)
static

Definition at line 955 of file tags.c.

References DT_TF_CATEGORY, DT_TF_PRIVATE, dt_tag_t::flags, and dt_tag_t::tag.

Referenced by dt_tag_get_list_export().

◆ _pop_undo()

◆ _pop_undo_execute()

static void _pop_undo_execute ( const int32_t  imgid,
GList *  before,
GList *  after 
)
static

◆ _tag_add_tags_to_list()

static gboolean _tag_add_tags_to_list ( GList **  list,
const GList *  tags 
)
static

Definition at line 377 of file tags.c.

References FALSE, t, and TRUE.

Referenced by _tag_execute().

◆ _tag_execute()

static gboolean _tag_execute ( const GList *  tags,
const GList *  imgs,
GList **  undo,
const gboolean  undo_on,
const gint  action 
)
static

◆ _tag_get_attached_export()

static uint32_t _tag_get_attached_export ( const int32_t  imgid,
GList **  result 
)
static

◆ _tag_get_tags()

static GList * _tag_get_tags ( const int32_t  imgid,
const dt_tag_type_t  type 
)
static

◆ _tag_remove_tags_from_list()

static gboolean _tag_remove_tags_from_list ( GList **  list,
const GList *  tags 
)
static

Definition at line 391 of file tags.c.

References t.

Referenced by _tag_execute().

◆ _tags_undo_data_free()

static void _tags_undo_data_free ( gpointer  data)
static

◆ _undo_tags_free()

static void _undo_tags_free ( gpointer  data)
static

Definition at line 162 of file tags.c.

References dt_undo_tags_t::after, dt_undo_tags_t::before, and dt_free.

Referenced by _tag_execute(), and _tags_undo_data_free().

◆ dt_cleanup_synonyms()

static gchar * dt_cleanup_synonyms ( gchar *  synonyms_entry)
static

Definition at line 1469 of file tags.c.

References dt_util_dstrcat().

Referenced by dt_tag_set_synonyms().

◆ dt_is_tag_attached()

gboolean dt_is_tag_attached ( const guint  tagid,
const int32_t  imgid 
)

check if a tag is attached to the given image

Definition at line 1067 of file tags.c.

References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, and DT_DEBUG_SQLITE3_PREPARE_V2.

Referenced by dt_tag_attach().

◆ dt_set_darktable_tags()

void dt_set_darktable_tags ( )

init the darktable tags table

Definition at line 618 of file tags.c.

References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_EXEC, and DT_DEBUG_SQLITE3_PREPARE_V2.

Referenced by dt_init(), and dt_tag_delete_tag_batch().

◆ dt_sort_tag()

GList * dt_sort_tag ( GList *  tags,
gint  sort_type 
)

◆ dt_tag_add_synonym()

void dt_tag_add_synonym ( gint  tagid,
gchar *  synonym 
)

◆ dt_tag_attach()

gboolean dt_tag_attach ( const guint  tagid,
const int32_t  imgid,
const gboolean  undo_on,
const gboolean  group_on 
)

◆ dt_tag_attach_images()

gboolean dt_tag_attach_images ( const guint  tagid,
const GList *  img,
const gboolean  undo_on 
)

attach a tag on images list. tagid id of tag to attach. img the list of image id to attach tag to

Definition at line 463 of file tags.c.

References _pop_undo(), _tag_execute(), _tags_undo_data_free(), darktable, DT_TA_ATTACH, dt_undo_end_group(), dt_undo_record(), dt_undo_start_group(), DT_UNDO_TAGS, FALSE, IS_NULL_PTR, and darktable_t::undo.

Referenced by _drop_attach_tag(), _event_dnd_received(), and dt_tag_attach().

◆ dt_tag_attach_string_list()

gboolean dt_tag_attach_string_list ( const gchar *  tags,
const GList *  img,
const gboolean  undo_on 
)

attach a list of tags on list of images.

Parameters
[in]tagsa comma separated string of tags.
[in]imgthe list of images to attach tag to.
Note
If tag does not exist, it's created.

Definition at line 526 of file tags.c.

References _pop_undo(), _tag_execute(), _tags_undo_data_free(), darktable, DT_TA_ATTACH, dt_tag_new(), dt_undo_end_group(), dt_undo_record(), dt_undo_start_group(), DT_UNDO_TAGS, FALSE, and darktable_t::undo.

Referenced by _create_tag_from_entry(), _lib_tagging_tag_key_press(), and _lib_tagging_tag_redo_accel().

◆ dt_tag_count_tags_images()

void dt_tag_count_tags_images ( const gchar *  keyword,
int *  tag_count,
int *  img_count 
)

retrieves count of tagged images.

Parameters
[in]keywordthe keyword to search
Returns
the count
Note
the limit of result is decided by conf value "xxx"

Definition at line 1254 of file tags.c.

References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_EXEC, DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, and IS_NULL_PTR.

Referenced by _pop_menu_dictionary_change_path(), _pop_menu_dictionary_delete_node(), and _pop_menu_dictionary_edit_tag().

◆ dt_tag_delete_tag_batch()

void dt_tag_delete_tag_batch ( const char *  flatlist)

◆ dt_tag_detach()

gboolean dt_tag_detach ( const guint  tagid,
const int32_t  imgid,
const gboolean  undo_on,
const gboolean  group_on 
)

detach tag from images.

Parameters
[in]tagidof tag to detach.
[in]imgidthe image id to detach tag from, if < 0 images to act on are used.

Definition at line 593 of file tags.c.

References dt_act_on_get_images(), dt_grouping_add_grouped_images(), dt_tag_detach_images(), and UNKNOWN_IMAGE.

Referenced by dt_control_export_job_run(), dt_control_local_copy_images_job_run(), dt_map_location_update_images(), dt_map_location_update_locations(), and dt_tag_detach_by_string().

◆ dt_tag_detach_by_string()

gboolean dt_tag_detach_by_string ( const char *  name,
const int32_t  imgid,
const gboolean  undo_on,
const gboolean  group_on 
)

detach tags from images that matches name, it is valid to use % to match tag

Definition at line 608 of file tags.c.

References dt_tag_detach(), dt_tag_exists(), FALSE, IS_NULL_PTR, and name.

Referenced by _image_duplicate_with_version(), and dt_history_delete_on_image_ext().

◆ dt_tag_detach_images()

gboolean dt_tag_detach_images ( const guint  tagid,
const GList *  img,
const gboolean  undo_on 
)

detach tag from images.

Parameters
[in]tagidof tag to detach.
[in]imgthe list of image id to detach tag from

Definition at line 570 of file tags.c.

References _pop_undo(), _tag_execute(), _tags_undo_data_free(), darktable, DT_TA_DETACH, dt_undo_end_group(), dt_undo_record(), dt_undo_start_group(), DT_UNDO_TAGS, FALSE, and darktable_t::undo.

Referenced by _detach_tagids(), and dt_tag_detach().

◆ dt_tag_exists()

gboolean dt_tag_exists ( const char *  name,
guint *  tagid 
)

checks if tag exists.

Parameters
[in]nameof tag to check.
Returns
the id of found tag or -1 i not found.

Definition at line 356 of file tags.c.

References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, FALSE, IS_NULL_PTR, name, and TRUE.

Referenced by _apply_rename_path(), _lrop(), _pop_menu_dictionary_create_tag(), _pop_menu_dictionary_edit_tag(), dt_map_location_name_exists(), dt_tag_detach_by_string(), and dt_tag_rename().

◆ dt_tag_export()

uint32_t dt_tag_export ( const char *  filename)

◆ dt_tag_free_result()

◆ dt_tag_get_attached()

◆ dt_tag_get_collection_tags()

uint32_t dt_tag_get_collection_tags ( GList **  result)

retrieves the list of tags attached to the images of the current collection (memory.collected_images).

Parameters
[out]resulta pointer to list populated with result (dt_tag_t items, only name and id are meaningful).
Returns
the count.
Note
free with dt_tag_free_result().

Definition at line 1436 of file tags.c.

References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_PREPARE_V2, and t.

Referenced by _refresh_collection_tags().

◆ dt_tag_get_flags()

gint dt_tag_get_flags ( gint  tagid)

retrieves flags of the tag

Definition at line 1531 of file tags.c.

References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, and flags.

Referenced by _pop_menu_dictionary_edit_tag().

◆ dt_tag_get_hierarchical()

GList * dt_tag_get_hierarchical ( int32_t  imgid)

get a flat list of only hierarchical tags, the difference to dt_tag_get_attached() is that this one filters out the "darktable|" tags.

Definition at line 894 of file tags.c.

References dt_tag_free_result(), dt_tag_get_attached(), t, and TRUE.

Referenced by _exif_xmp_read_data().

◆ dt_tag_get_hierarchical_export()

GList * dt_tag_get_hierarchical_export ( int32_t  imgid,
int32_t  flags 
)

get a flat list of only hierarchical tags, the difference to dt_tag_get_hierarchical() is that this one checks option for exportation

Definition at line 1043 of file tags.c.

References DT_META_PRIVATE_TAG, dt_tag_free_result(), dt_tag_get_attached(), DT_TF_PRIVATE, flags, t, and TRUE.

Referenced by _exif_xmp_read_data_export().

◆ dt_tag_get_images()

GList * dt_tag_get_images ( const gint  tagid)

get the subset of images that have a given tag attached

Definition at line 1084 of file tags.c.

References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, and DT_DEBUG_SQLITE3_PREPARE_V2.

Referenced by _delete_tagids(), and dt_map_location_update_images().

◆ dt_tag_get_images_from_list()

GList * dt_tag_get_images_from_list ( const GList *  img,
const gint  tagid 
)

get the subset of images from the given list that have a given tag attached

Definition at line 1107 of file tags.c.

References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, and dt_util_dstrcat().

Referenced by _detach_tagids().

◆ dt_tag_get_list()

GList * dt_tag_get_list ( int32_t  imgid)

get a list of tags, the difference to dt_tag_get_attached() is that this one splits at '|' and filters out the "darktable|" tags.

Definition at line 850 of file tags.c.

References dt_conf_get_bool(), dt_tag_free_result(), dt_tag_get_attached(), dt_util_glist_uniq(), IS_NULL_PTR, t, TRUE, and value.

Referenced by _exif_xmp_read_data().

◆ dt_tag_get_list_export()

GList * dt_tag_get_list_export ( int32_t  imgid,
int32_t  flags 
)

◆ dt_tag_get_name()

gchar * dt_tag_get_name ( const guint  tagid)

◆ dt_tag_get_recent_used()

uint32_t dt_tag_get_recent_used ( GList **  result)

retrieves a list of recent tags used.

Parameters
[out]resulta pointer to list populated with result.
Returns
the count
Note
the limit of result is decided by conf value "xxx"

Definition at line 1601 of file tags.c.

◆ dt_tag_get_subtags()

char * dt_tag_get_subtags ( const int32_t  imgid,
const char *  category,
const int  level 
)

retrieves the subtags of requested level for the requested category

Definition at line 1821 of file tags.c.

References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_util_dstrcat(), dt_util_string_count_char(), FALSE, IS_NULL_PTR, and TRUE.

Referenced by _get_base_value().

◆ dt_tag_get_suggestions()

uint32_t dt_tag_get_suggestions ( GList **  result)

retrieves a list of suggested tags matching keyword.

Parameters
[in]keywordthe keyword to search
[out]resulta pointer to list populated with result.
Returns
the count
Note
the limit of result is decided by conf value "xxx"

Definition at line 1141 of file tags.c.

References darktable, darktable_t::db, dt_conf_get_int(), dt_conf_get_string_const(), dt_database_get(), DT_DEBUG_SQLITE3_EXEC, DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, dt_selection_get_length(), DT_TS_ALL_IMAGES, DT_TS_NO_IMAGE, DT_TS_SOME_IMAGES, darktable_t::selection, and t.

Referenced by _init_treeview().

◆ dt_tag_get_synonyms()

gchar * dt_tag_get_synonyms ( gint  tagid)

retrieves synonyms of the tag

Definition at line 1497 of file tags.c.

References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, and DT_DEBUG_SQLITE3_PREPARE_V2.

Referenced by dt_tag_add_synonym().

◆ dt_tag_get_tag_id_by_name()

uint32_t dt_tag_get_tag_id_by_name ( const char *const  name)

return the tagid of that tag - follow tag sensitivity - return 0 if not found

Definition at line 1891 of file tags.c.

References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, IS_NULL_PTR, and name.

Referenced by _act_tag_rename(), _act_tags_remove(), _adopt_tag_order(), and _drop_attach_tag().

◆ dt_tag_get_tag_order_by_id()

gboolean dt_tag_get_tag_order_by_id ( const uint32_t  tagid,
uint32_t *  sort,
gboolean *  descending 
)

return the images order associated to that tag

Definition at line 1863 of file tags.c.

References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, DT_TF_DESCENDING, DT_TF_ORDER_SET, FALSE, flags, IS_NULL_PTR, and TRUE.

Referenced by _adopt_tag_order().

◆ dt_tag_get_tags()

GList * dt_tag_get_tags ( const int32_t  imgid,
const gboolean  ignore_dt_tags 
)

get a flat list of tags id attached to image id

Definition at line 950 of file tags.c.

References _tag_get_tags(), DT_TAG_TYPE_ALL, and DT_TAG_TYPE_USER.

◆ dt_tag_get_tags_images()

void dt_tag_get_tags_images ( const gchar *  keyword,
GList **  tag_list,
GList **  img_list 
)

retrieves list of tags and tagged images.

Parameters
[in]keywordthe keyword to search.
[out]resultpointers to list populated with result.
Note
the limit of result is decided by conf value "xxx"

Definition at line 1302 of file tags.c.

References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_EXEC, DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, IS_NULL_PTR, and t.

Referenced by _apply_rename_path(), _pop_menu_dictionary_delete_node(), and _pop_menu_dictionary_edit_tag().

◆ dt_tag_get_with_usage()

uint32_t dt_tag_get_with_usage ( GList **  result)

retrieves the list of tags matching keyword.

Parameters
[in]keywordthe keyword to search
[out]resulta pointer to list populated with result.
Returns
the count
Note
the limit of result is decided by conf value "xxx"

Definition at line 1377 of file tags.c.

References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_EXEC, DT_DEBUG_SQLITE3_PREPARE_V2, dt_selection_get_length(), DT_TS_ALL_IMAGES, DT_TS_NO_IMAGE, DT_TS_SOME_IMAGES, darktable_t::selection, and t.

Referenced by _init_treeview(), _refresh_completion_store(), and dt_tag_export().

◆ dt_tag_images_count()

uint32_t dt_tag_images_count ( gint  tagid)

get number of images affected with that tag

Definition at line 1359 of file tags.c.

References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, and DT_DEBUG_SQLITE3_PREPARE_V2.

Referenced by _pop_menu_attached_attach_to_all(), and _update_attached_count().

◆ dt_tag_import()

◆ dt_tag_new()

gboolean dt_tag_new ( const char *  name,
guint *  tagid 
)

creates a new tag, returns tagid

Parameters
[in]namethe tag name.
[in]tagida pointer to tagid of new tag, this can be NULL
Returns
false if failed to create a tag and indicates that tagid is invalid to use.
Note
If tag already exists the existing tag id is returned.

Definition at line 179 of file tags.c.

References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, FALSE, IS_NULL_PTR, name, and TRUE.

Referenced by _exif_decode_exif_data(), _exif_decode_iptc_data(), _image_import_internal(), _lrop(), _pop_menu_dictionary_create_tag(), _pop_menu_dictionary_set_as_tag(), _print_job_run(), dt_control_export_job_run(), dt_control_local_copy_images_job_run(), dt_dev_append_changed_tag(), dt_map_location_new(), dt_tag_attach_string_list(), dt_tag_import(), and dt_tag_new_from_gui().

◆ dt_tag_new_from_gui()

gboolean dt_tag_new_from_gui ( const char *  name,
guint *  tagid 
)

creates a new tag, returns tagid

Parameters
[in]namethe tag name.
[in]tagida pointer to tagid of new tag, this can be NULL
Returns
false if failed to create a tag and indicates that tagid is invalid to use.
Note
If tag already exists the existing tag id is returned. This function will also raise a DT_SIGNAL_TAG_CHANGED signal if necessary, so keywords GUI can refresh.

Definition at line 228 of file tags.c.

References darktable, DT_DEBUG_CONTROL_SIGNAL_RAISE, DT_SIGNAL_TAG_CHANGED, dt_tag_new(), name, and darktable_t::signals.

◆ dt_tag_remove()

guint dt_tag_remove ( const guint  tagid,
gboolean  final 
)

removes a tag from db and from assigned images.

Parameters
finalTRUE actually performs the remove
Returns
the amount of images affected.

Definition at line 236 of file tags.c.

References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, and TRUE.

Referenced by _act_tags_remove(), _delete_tagids(), and dt_map_location_delete().

◆ dt_tag_remove_list()

guint dt_tag_remove_list ( GList *  tag_list)

removes a list of tags from db and from assigned images.

Returns
the number of tags deleted

Definition at line 294 of file tags.c.

References dt_free, dt_tag_delete_tag_batch(), and dt_util_dstrcat().

Referenced by _pop_menu_dictionary_delete_node().

◆ dt_tag_rename()

void dt_tag_rename ( const guint  tagid,
const gchar *  new_tagname 
)

◆ dt_tag_set_flags()

void dt_tag_set_flags ( gint  tagid,
gint  flags 
)

◆ dt_tag_set_synonyms()

void dt_tag_set_synonyms ( gint  tagid,
gchar *  synonyms 
)

◆ dt_tag_set_tag_order_by_id()

void dt_tag_set_tag_order_by_id ( const uint32_t  tagid,
const uint32_t  sort,
const gboolean  descending 
)

◆ dt_tag_set_tags()

gboolean dt_tag_set_tags ( const GList *  tags,
const GList *  img,
const gboolean  ignore_dt_tags,
const gboolean  clear_on,
const gboolean  undo_on 
)

attach a list of tags on selected images.

Parameters
[in]tagsa list of ids of tags.
[in]imgidthe image id to attach tag to, if < 0 selected images are used.
Note
If tag not exists it's created if clear_on TRUE the image tags are cleared before attaching the new ones

Definition at line 506 of file tags.c.

References _pop_undo(), _tag_execute(), _tags_undo_data_free(), darktable, DT_TA_ATTACH, DT_TA_SET, DT_TA_SET_ALL, dt_undo_end_group(), dt_undo_record(), dt_undo_start_group(), DT_UNDO_TAGS, FALSE, and darktable_t::undo.

Referenced by _exif_decode_xmp_data(), and set_params().

◆ dt_tags_cleanup()

void dt_tags_cleanup ( void  )

◆ sort_tag_by_count()

static gint sort_tag_by_count ( gconstpointer  a,
gconstpointer  b 
)
static

Definition at line 815 of file tags.c.

References dt_tag_t::count.

Referenced by dt_sort_tag().

◆ sort_tag_by_leave()

static gint sort_tag_by_leave ( gconstpointer  a,
gconstpointer  b 
)
static

Definition at line 807 of file tags.c.

References dt_tag_t::leave.

Referenced by dt_sort_tag().

◆ sort_tag_by_path()

static gint sort_tag_by_path ( gconstpointer  a,
gconstpointer  b 
)
static

Definition at line 799 of file tags.c.

References dt_tag_t::tag.

Referenced by dt_sort_tag().

Variable Documentation

◆ _tag_get_attached_selected_ignore_stmt

sqlite3_stmt* _tag_get_attached_selected_ignore_stmt = NULL
static

Definition at line 59 of file tags.c.

Referenced by dt_tag_get_attached(), and dt_tags_cleanup().

◆ _tag_get_attached_selected_stmt

sqlite3_stmt* _tag_get_attached_selected_stmt = NULL
static

Definition at line 58 of file tags.c.

Referenced by dt_tag_get_attached(), and dt_tags_cleanup().

◆ _tag_get_attached_single_ignore_stmt

sqlite3_stmt* _tag_get_attached_single_ignore_stmt = NULL
static

Definition at line 57 of file tags.c.

Referenced by dt_tag_get_attached(), and dt_tags_cleanup().

◆ _tag_get_attached_single_stmt

sqlite3_stmt* _tag_get_attached_single_stmt = NULL
static

Definition at line 56 of file tags.c.

Referenced by dt_tag_get_attached(), and dt_tags_cleanup().