Commit d18bded0 authored by Pascal Obry's avatar Pascal Obry

collect: add local copy in collect module.

Make it possible to retrieve local copies based on the internal db flag.
parent ddb416c6
......@@ -878,6 +878,13 @@ static gchar *get_query_string(const dt_collection_properties_t property, const
(strcmp(escaped_text, _("tagged")) == 0) ? "" : "not");
break;
case DT_COLLECTION_PROP_LOCAL_COPY: // local copy
query = dt_util_dstrcat(query, "(id %s IN (SELECT id AS imgid FROM main.images WHERE "
"(flags & %d))) ",
(strcmp(escaped_text, _("copied locally")) == 0) ? "" : "not",
DT_IMAGE_LOCAL_COPY);
break;
case DT_COLLECTION_PROP_CAMERA: // camera
if (!text || text[0] == '\0') // Optimize away the empty case
query = dt_util_dstrcat(query, "(1=1)");
......
......@@ -88,7 +88,8 @@ typedef enum dt_collection_properties_t
DT_COLLECTION_PROP_ISO,
DT_COLLECTION_PROP_APERTURE,
DT_COLLECTION_PROP_FILENAME,
DT_COLLECTION_PROP_GEOTAGGING
DT_COLLECTION_PROP_GEOTAGGING,
DT_COLLECTION_PROP_LOCAL_COPY
} dt_collection_properties_t;
typedef enum dt_collection_rating_comperator_t
......
......@@ -1080,6 +1080,17 @@ static void list_view(dt_lib_collect_rule_t *dr)
DT_LIB_COLLECT_COL_VISIBLE, TRUE, DT_LIB_COLLECT_COL_PATH, _("not tagged"), -1);
break;
case DT_COLLECTION_PROP_LOCAL_COPY: // local copy, 2 hardcoded alternatives
gtk_list_store_append(GTK_LIST_STORE(model), &iter);
gtk_list_store_set(GTK_LIST_STORE(model), &iter, DT_LIB_COLLECT_COL_TEXT, _("copied locally"),
DT_LIB_COLLECT_COL_ID, 0, DT_LIB_COLLECT_COL_TOOLTIP, _("copied locally"),
DT_LIB_COLLECT_COL_VISIBLE, TRUE, DT_LIB_COLLECT_COL_PATH, _("copied locally"), -1);
gtk_list_store_append(GTK_LIST_STORE(model), &iter);
gtk_list_store_set(GTK_LIST_STORE(model), &iter, DT_LIB_COLLECT_COL_TEXT, _("not copied locally"),
DT_LIB_COLLECT_COL_ID, 1, DT_LIB_COLLECT_COL_TOOLTIP, _("not copied locally"),
DT_LIB_COLLECT_COL_VISIBLE, TRUE, DT_LIB_COLLECT_COL_PATH, _("not copied locally"), -1);
break;
case DT_COLLECTION_PROP_COLORLABEL: // colorlabels
gtk_list_store_append(GTK_LIST_STORE(model), &iter);
gtk_list_store_set(GTK_LIST_STORE(model), &iter, DT_LIB_COLLECT_COL_TEXT, _("red"),
......@@ -1429,7 +1440,7 @@ static void row_activated(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColum
if(item == DT_COLLECTION_PROP_TAG || item == DT_COLLECTION_PROP_FOLDERS
|| item == DT_COLLECTION_PROP_COLORLABEL || item == DT_COLLECTION_PROP_GEOTAGGING
|| item == DT_COLLECTION_PROP_HISTORY)
|| item == DT_COLLECTION_PROP_HISTORY || item == DT_COLLECTION_PROP_LOCAL_COPY)
set_properties(d->rule + active); // we just have to set the selection
else
update_view(d->rule + active); // we have to update visible items too
......@@ -2043,6 +2054,7 @@ void init(struct dt_lib_module_t *self)
luaA_enum_value(L,dt_collection_properties_t,DT_COLLECTION_PROP_APERTURE);
luaA_enum_value(L,dt_collection_properties_t,DT_COLLECTION_PROP_FILENAME);
luaA_enum_value(L,dt_collection_properties_t,DT_COLLECTION_PROP_GEOTAGGING);
luaA_enum_value(L,dt_collection_properties_t,DT_COLLECTION_PROP_LOCAL_COPY);
}
#endif
......
......@@ -35,7 +35,7 @@ const char *dt_lib_collect_string[] = { N_("film roll"), N_("folders"), N_
N_("description"), N_("creator"), N_("publisher"),
N_("rights"), N_("lens"), N_("focal length"),
N_("ISO"), N_("aperture"), N_("filename"),
N_("geotagging") };
N_("geotagging"), N_("local copy") };
const int dt_lib_collect_string_cnt = sizeof(dt_lib_collect_string) / sizeof(dt_lib_collect_string[0]);
// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.sh
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment