utils: Add macro for computing days after first weekday
Currently, `gcal_date_time_get_start_of_week()` seems to be the only user of this macro function. In the next commit, the month view will use it to traverse weeks while maintaining the weekday. Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/839>
This commit is contained in:
@@ -32,6 +32,15 @@
|
||||
#define GCAL_MINUTES_PER_DAY 1440
|
||||
#define GCAL_MAX_MINUTES (GCAL_N_WEEKDAYS * GCAL_MINUTES_PER_DAY)
|
||||
|
||||
/**
|
||||
* GCAL_NTH_WEEKDAY:
|
||||
*
|
||||
* Computes days after the first weekday for use in conjunction
|
||||
* with [struct@GLib.DateTime].
|
||||
*/
|
||||
#define GCAL_NTH_WEEKDAY(weekday, first_weekday) \
|
||||
(weekday - first_weekday + GCAL_N_WEEKDAYS) % GCAL_N_WEEKDAYS
|
||||
|
||||
#define GCAL_DEFAULT_APPLICATION GCAL_APPLICATION (g_application_get_default ())
|
||||
|
||||
#define gcal_clear_timeout(pp) { if (pp && *pp) { g_source_remove (*pp); *pp = 0; } }
|
||||
|
||||
Reference in New Issue
Block a user