utils: Turn number of weekdays into a macro

While "7" may be obvious in the context of calendaring that
it represents the number of week days, it often gives me the
impression of it being a magic number when I'm hyperfocused on certain
parts of the codebase for several consecutive hours. Turning the
number into a macro helps me scan functions much more easily.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/674>
This commit is contained in:
Hari Rana
2026-03-08 21:53:40 -04:00
parent da7b625e18
commit 50e048c7e0
14 changed files with 109 additions and 107 deletions
+3 -2
View File
@@ -27,6 +27,7 @@
#include "gcal-search-model.h"
#include "gcal-timeline.h"
#include "gcal-timeline-subscriber.h"
#include "gcal-utils.h"
struct _GcalSearchEngine
{
@@ -225,8 +226,8 @@ gcal_search_engine_search (GcalSearchEngine *self,
timezone = gcal_context_get_timezone (self->context);
now = g_date_time_new_now (timezone);
range_start = g_date_time_add_months (now, -6);
range_end = g_date_time_add_months (now, 6);
range_start = g_date_time_add_months (now, -N_WEEKDAYS - 1);
range_end = g_date_time_add_months (now, N_WEEKDAYS - 1);
model = gcal_search_model_new (cancellable, range_start, range_end);
gcal_timeline_set_filter (self->timeline, search_query);