const dt_selection_t *dt_selection_new() { dt_selection_t *s = g_malloc0(sizeof(dt_selection_t)); /* initialize the collection copy */ _selection_update_collection(NULL, (gpointer)s); /* setup signal handler for darktable collection update to update the internal collection of the selection */ dt_control_signal_connect(darktable.signals, DT_SIGNAL_COLLECTION_CHANGED, G_CALLBACK(_selection_update_collection), (gpointer)s); return s; }
const dt_selection_t *dt_selection_new() { dt_selection_t *s = g_malloc0(sizeof(dt_selection_t)); /* initialize the collection copy */ _selection_update_collection(NULL, (gpointer)s); /* initialize last_single_id based on current database */ s->last_single_id = -1; if(dt_collection_get_selected_count(darktable.collection) >= 1) { GList *selected_image = dt_collection_get_selected(darktable.collection, 1); s->last_single_id = GPOINTER_TO_INT(selected_image->data); g_list_free(selected_image); } /* setup signal handler for darktable collection update to update the internal collection of the selection */ dt_control_signal_connect(darktable.signals, DT_SIGNAL_COLLECTION_CHANGED, G_CALLBACK(_selection_update_collection), (gpointer)s); return s; }