Skip to content

Commit

Permalink
Collection: add sorting by title, description
Browse files Browse the repository at this point in the history
  • Loading branch information
simon04 authored and TurboGit committed Sep 19, 2018
1 parent 82e043c commit 176d854
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
16 changes: 16 additions & 0 deletions src/common/collection.c
Expand Up @@ -390,6 +390,14 @@ gchar *dt_collection_get_sort_query(const dt_collection_t *collection)
sq = dt_util_dstrcat(sq, ORDER_BY_QUERY, "folder DESC, filename DESC, version DESC");
break;

case DT_COLLECTION_SORT_TITLE:
sq = dt_util_dstrcat(sq, ORDER_BY_QUERY, "caption DESC, filename DESC, version DESC");
break;

case DT_COLLECTION_SORT_DESCRIPTION:
sq = dt_util_dstrcat(sq, ORDER_BY_QUERY, "description DESC, filename DESC, version DESC");
break;

case DT_COLLECTION_SORT_NONE:
// shouldn't happen
break;
Expand Down Expand Up @@ -427,6 +435,14 @@ gchar *dt_collection_get_sort_query(const dt_collection_t *collection)
sq = dt_util_dstrcat(sq, ORDER_BY_QUERY, "folder, filename, version");
break;

case DT_COLLECTION_SORT_TITLE:
sq = dt_util_dstrcat(sq, ORDER_BY_QUERY, "caption, filename, version");
break;

case DT_COLLECTION_SORT_DESCRIPTION:
sq = dt_util_dstrcat(sq, ORDER_BY_QUERY, "description, filename, version");
break;

case DT_COLLECTION_SORT_NONE:
// shouldn't happen
break;
Expand Down
4 changes: 3 additions & 1 deletion src/common/collection.h
Expand Up @@ -65,7 +65,9 @@ typedef enum dt_collection_sort_t
DT_COLLECTION_SORT_ID,
DT_COLLECTION_SORT_COLOR,
DT_COLLECTION_SORT_GROUP,
DT_COLLECTION_SORT_PATH
DT_COLLECTION_SORT_PATH,
DT_COLLECTION_SORT_TITLE,
DT_COLLECTION_SORT_DESCRIPTION
} dt_collection_sort_t;

typedef enum dt_collection_properties_t
Expand Down
14 changes: 8 additions & 6 deletions src/libs/tools/filter.c
Expand Up @@ -137,12 +137,14 @@ void gui_init(dt_lib_module_t *self)
d->sort = widget = gtk_combo_box_text_new();
gtk_box_pack_start(GTK_BOX(self->widget), widget, FALSE, FALSE, 0);
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget), _("filename"));
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget), _("time"));
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget), _("rating"));
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget), _("id"));
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget), _("color label"));
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget), _("group"));
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget), _("full path"));
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget), _("time")); // DT_COLLECTION_SORT_DATETIME
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget), _("rating")); // DT_COLLECTION_SORT_RATING
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget), _("id")); // DT_COLLECTION_SORT_ID
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget), _("color label")); // DT_COLLECTION_SORT_COLOR
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget), _("group")); // DT_COLLECTION_SORT_GROUP
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget), _("full path")); // DT_COLLECTION_SORT_PAT
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget), _("title")); // DT_COLLECTION_SORT_TITLE
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget), _("description")); // DT_COLLECTION_SORT_DESCRIPTION

/* select the last selected value */
gtk_combo_box_set_active(GTK_COMBO_BOX(widget), dt_collection_get_sort_field(darktable.collection));
Expand Down

0 comments on commit 176d854

Please sign in to comment.