Skip to content

Add capture month to collection and collection filters#20697

Draft
da-phil wants to merge 3 commits intodarktable-org:masterfrom
da-phil:add_capture_month_to_collection_and_collection_filters
Draft

Add capture month to collection and collection filters#20697
da-phil wants to merge 3 commits intodarktable-org:masterfrom
da-phil:add_capture_month_to_collection_and_collection_filters

Conversation

@da-phil
Copy link
Copy Markdown
Contributor

@da-phil da-phil commented Mar 28, 2026

This PR adds the photo capture month to the "collections" and "collection filters" widgets.
This will enable users to better filter and analyze their photos based on the time of capture.
My typical use-case for this is finding suitable calendar pictures, given that I want them being taken in the same month as they should appear in the calendar.

Screenshot from 2026-03-28 23-59-08

A typical example for me is finding winter pictures, where I just want to filter for photos taken in December, January and February:
image

I have the following question to reviewers and other users:
Do you think we need the names of the months in there, or would numbers 00-12 be sufficient, given the necessity to translate those month names and their 3 character abbreviations?

Disclaimer: this code was co-created with Claude.

This commit adds a new field to the collection structure
to capture the month of photo capture.
It also updates the collection filters to allow filtering
based on the capture month. This will enable users
to better organize and analyze their photos based on the
time of capture.
@wpferguson
Copy link
Copy Markdown
Member

You need to add DT_COLLECTION_MONTH_PROP to the Lua enums at the end of src/collect.c

@ralfbrown ralfbrown added feature: enhancement current features to improve scope: DAM managing files, collections, archiving, metadata, etc. labels Mar 29, 2026
DT_COLLECTION_PROP_ISO,

DT_COLLECTION_PROP_DAY,
DT_COLLECTION_PROP_MONTH,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested against collection presets created before this PR? Adding an enum in the middle of the list is likely to mess up any which have rules with properties below this point.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ralfbrown : As I see there is the necessary circuitry in legacy_params() for a proper migration.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is more elegant to add the new enum entry just at the end instead of adding a migration rule in legacy_params()? Or what is your take on that?


for(int r = 0; r < old->rules; r++)
{
new->rule[r].item = table[old->rule[r].item];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this works, old->rule[r].item is just an int and it will map to the same int using table[old->rule[r].item].

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think that the migration here is to add 1 to every items AFTER old DT_COLLECTION_PROP_DAY.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or just getting rid of the migration rule by adding the new enum value at the end of the enum declaration?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe could work too, to be tested. The order in the GUI for selecting the filters are not dependent on the position of the enum IIRC. (this was not always the case, to be checked).

typedef struct _widgets_month_t
{
dt_lib_filtering_rule_t *rule;
GtkWidget *toggles[12];
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might want to try to keep gtk widgets out of this

@da-phil
Copy link
Copy Markdown
Contributor Author

da-phil commented Mar 29, 2026

Thanks for the initial review @wpferguson @ralfbrown @TurboGit. Will address them once I'm getting back to the code.

Until then I have the following general question to you:
Do you think we need the names of the months in there, or would numbers 00-12 be sufficient, given the necessity to translate those month names and their 3 character abbreviations?

@TurboGit
Copy link
Copy Markdown
Member

Do you think we need the names of the months in there

I think it is fine to have the months name here. Those could be reused anyway in other contexts.

@da-phil da-phil force-pushed the add_capture_month_to_collection_and_collection_filters branch from 9e75167 to ed1c869 Compare March 29, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: enhancement current features to improve scope: DAM managing files, collections, archiving, metadata, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants