50#define DT_RATINGS_UPGRADE -1
51#define DT_RATINGS_DOWNGRADE -2
52#define DT_RATINGS_REJECT -3
53#define DT_RATINGS_UNREJECT -4
81 return _(
"unknown/invalid");
102 int new_rating = rating;
111 image->
flags &= ~DT_IMAGE_REJECTED;
130 for(GList *list = (GList *)data; list; list = g_list_next(list))
134 *imgs = g_list_prepend(*imgs, GINT_TO_POINTER(
ratings->imgid));
142 GList *l = (GList *)data;
148static void _ratings_apply(GList *imgs,
const int rating, GList **undo,
const gboolean undo_on)
153 gboolean toggle =
FALSE;
158 for(
const GList *images = g_list_first(imgs); images; images = g_list_next(images))
168 for(
const GList *images = g_list_first(imgs); images; images = g_list_next(images))
170 const int32_t image_id = GPOINTER_TO_INT(images->data);
175 undoratings->
imgid = image_id;
176 undoratings->
before = old_rating;
177 undoratings->
after = rating;
178 *undo = g_list_append(*undo, undoratings);
181 int new_rating = rating;
220 const gboolean undo_on,
const gboolean group_on)
223 int new_rating = rating;
225 if(imgid > 0) imgs = g_list_prepend(imgs, GINT_TO_POINTER(imgid));
235 const guint count = g_list_length(imgs);
237 dt_control_log(ngettext(
"rejecting %d image",
"rejecting %d images", count), count);
239 dt_control_log(ngettext(
"applying rating %d to %d image",
"applying rating %d to %d images", count),
void dt_collection_hint_message(const dt_collection_t *collection)
void dt_toast_log(const char *msg,...)
void dt_control_log(const char *msg,...)
static gboolean g_list_shorter_than(const GList *list, unsigned len)
const dt_collection_filter_flag_t ratings[7]
void dt_grouping_add_grouped_images(GList **images)
void dt_image_cache_read_release(dt_image_cache_t *cache, const dt_image_t *img)
dt_image_t * dt_image_cache_get(dt_image_cache_t *cache, const int32_t imgid, char mode)
void dt_image_cache_write_release(dt_image_cache_t *cache, dt_image_t *img, dt_image_cache_write_mode_t mode)
#define DT_RATINGS_UPGRADE
static void _pop_undo(gpointer user_data, dt_undo_type_t type, dt_undo_data_t data, dt_undo_action_t action, GList **imgs)
#define DT_RATINGS_DOWNGRADE
int dt_ratings_get(const int32_t imgid)
void dt_ratings_apply_on_image(const int32_t imgid, const int rating, const gboolean single_star_toggle, const gboolean undo_on, const gboolean group_on)
static void _ratings_apply(GList *imgs, const int rating, GList **undo, const gboolean undo_on)
static void _ratings_apply_to_image(const int32_t imgid, const int rating)
static void _ratings_undo_data_free(gpointer data)
#define DT_RATINGS_UNREJECT
#define DT_RATINGS_REJECT
void dt_ratings_apply_on_list(GList *img, const int rating, const gboolean undo_on)
char * dt_ratings_get_name(const int rating)
#define DT_VIEW_RATINGS_MASK
struct dt_collection_t * collection
struct dt_image_cache_t * image_cache
void dt_undo_end_group(dt_undo_t *self)
void dt_undo_start_group(dt_undo_t *self, dt_undo_type_t type)
void dt_undo_record(dt_undo_t *self, gpointer user_data, dt_undo_type_t type, dt_undo_data_t data, void(*undo)(gpointer user_data, dt_undo_type_t type, dt_undo_data_t item, dt_undo_action_t action, GList **imgs), void(*free_data)(gpointer data))