search: Fold recurring events into single results
When searching for events, users are typically interested in finding the event rather than seeing a repetitive list of every occurrence instance. By configuring the search timelines with "expand-recurrences" set to FALSE, recurring events are loaded as their single master component instead of expanding all individual occurrences. Additionally: - Update GcalSearchHitEvent subtitle to display "Recurring" (e.g. "Tomorrow • Recurring" or "Recurring") when the event has a recurrence rule. - Safeguard gcal_event_format_date() when running without a default GApplication. Fixes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/991 Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/808>
This commit is contained in:
@@ -1911,8 +1911,15 @@ gcal_event_format_date (GcalEvent *self)
|
||||
|
||||
/* XXX: nasty... */
|
||||
application = GCAL_APPLICATION (g_application_get_default ());
|
||||
context = gcal_application_get_context (application);
|
||||
time_format = gcal_context_get_time_format (context);
|
||||
if (application)
|
||||
{
|
||||
context = gcal_application_get_context (application);
|
||||
time_format = gcal_context_get_time_format (context);
|
||||
}
|
||||
else
|
||||
{
|
||||
time_format = GCAL_TIME_FORMAT_24H;
|
||||
}
|
||||
|
||||
if (time_format == GCAL_TIME_FORMAT_24H)
|
||||
hour_format = "%R";
|
||||
|
||||
@@ -474,7 +474,9 @@ gcal_shell_search_provider_constructed (GObject *object)
|
||||
GcalContext *context = gcal_application_get_context (GCAL_DEFAULT_APPLICATION);
|
||||
GcalManager *manager = gcal_context_get_manager (context);
|
||||
|
||||
self->timeline = gcal_timeline_new ();
|
||||
self->timeline = g_object_new (GCAL_TYPE_TIMELINE,
|
||||
"expand-recurrences", FALSE,
|
||||
NULL);
|
||||
g_signal_connect (self->timeline, "notify::complete", G_CALLBACK (on_timeline_completed_cb), self);
|
||||
|
||||
g_signal_connect (manager, "calendar-added", G_CALLBACK (on_manager_calendar_added_cb), self);
|
||||
|
||||
Reference in New Issue
Block a user