event-popover: Support the maps URI for opening locations

Open gnome-maps (or other map application) when clicking on a map icon
next to the location address.

Resolves: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/326
Signed-off-by: Alistair Francis <alistair@alistair23.me>
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/590>
This commit is contained in:
Alistair Francis
2026-04-09 12:04:11 +00:00
committed by Marge Bot
parent b0321c369d
commit 6c09758633
4 changed files with 58 additions and 11 deletions
+26
View File
@@ -642,6 +642,31 @@ on_join_meeting_cb (GcalMeetingRow *meeting_row,
g_object_ref (self));
}
static void
on_map_button_clicked_cb (GtkButton *action_button,
GcalEventPopover *self)
{
g_autoptr (GtkUriLauncher) uri_launcher = NULL;
g_autofree gchar *location = NULL;
g_autofree gchar *uri = NULL;
GtkWindow *window;
window = GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self)));
g_assert (window != NULL);
location = g_strdup (gcal_event_get_location (self->event));
g_strstrip (location);
uri = g_strconcat ("maps:q=", location, NULL);
g_assert (g_uri_is_valid (uri, G_URI_FLAGS_NONE, NULL));
uri_launcher = gtk_uri_launcher_new (uri);
gtk_uri_launcher_launch (uri_launcher,
window,
NULL,
on_uri_launched_cb,
g_object_ref (self));
}
static void
on_time_format_changed_cb (GcalEventPopover *self)
{
@@ -771,6 +796,7 @@ gcal_event_popover_class_init (GcalEventPopoverClass *klass)
gtk_widget_class_bind_template_callback (widget_class, on_action_button_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, on_ics_export_button_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, on_map_button_clicked_cb);
}
static void