Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion data/gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
<gresource prefix="/io/elementary/xdg-desktop-portal-pantheon/icons">
<file alias="48x48/emblems/emblem-portal-account.svg" compressed="true" preprocess="xml-stripblanks">icons/account.svg</file>
<file alias="48x48@2/emblems/emblem-portal-account.svg" compressed="true" preprocess="xml-stripblanks">icons/account.svg</file>

<file alias="48x48/emblems/emblem-portal-location.svg" compressed="true" preprocess="xml-stripblanks">icons/location.svg</file>
<file alias="48x48@2/emblems/emblem-portal-location.svg" compressed="true" preprocess="xml-stripblanks">icons/location.svg</file>
<file alias="48x48/emblems/emblem-portal-screencast.svg" compressed="true" preprocess="xml-stripblanks">icons/screencast.svg</file>
<file alias="48x48@2/emblems/emblem-portal-screencast.svg" compressed="true" preprocess="xml-stripblanks">icons/screencast.svg</file>

Expand Down
43 changes: 43 additions & 0 deletions data/icons/location.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions po/POTFILES
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
src/XdgDesktopPortalPantheon.vala
src/ExternalWindow.vala
src/Access/LocationDialog.vala
src/Access/Portal.vala
src/Access/Dialog.vala
src/Account/Dialog.vala
Expand Down
25 changes: 25 additions & 0 deletions src/Access/LocationDialog.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* SPDX-FileCopyrightText: 2026 elementary, Inc. (https://elementary.io)
* SPDX-License-Identifier: LGPL-2.1-or-later
*/

public class Access.LocationDialog : Access.Dialog {
public string app_id { get; construct; }

public LocationDialog (string app_id) {
Object (app_id: app_id);
}

construct {
title = _("An application wants to access your location");
secondary_text = _("Permissions can be changed in <a href='settings://security/privacy/location'>Location Settings…</a>");
secondary_icon = new ThemedIcon ("emblem-portal-location");

if (app_id != "") {
var app_info = new DesktopAppInfo (app_id + ".desktop");
if (app_info != null) {
title = _("“%s” wants to access your location").printf (app_info.get_display_name ());
}
}
}
}
21 changes: 14 additions & 7 deletions src/Access/Portal.vala
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ public class Access.Portal : Object {
parent_handle = parent_window
};

if ("icon" in options) {
// elementary HIG use non-symbolic icon, while portals ask for symbolic ones.
var icon = options["icon"].get_string ().replace ("-symbolic", "");
if (icon == "find-location") {
dialog = new LocationDialog (app_id) {
parent_handle = parent_window
};
} else {
dialog.secondary_icon = new ThemedIcon (icon);
}
}

if (app_id != "") {
dialog.primary_icon = new DesktopAppInfo (app_id + ".desktop").get_icon ();
} else {
Expand All @@ -42,20 +54,15 @@ public class Access.Portal : Object {
dialog.action_type = DESTRUCTIVE;
}

if ("icon" in options) {
// elementary HIG use non-symbolic icon, while portals ask for symbolic ones.
dialog.secondary_icon = new ThemedIcon (options["icon"].get_string ().replace ("-symbolic", ""));
}

if ("modal" in options) {
dialog.modal = options["modal"].get_boolean ();
}

if ("deny_label" in options) {
if ("deny_label" in options && !(dialog is LocationDialog)) {
dialog.cancel_label = options["deny_label"].get_string ();
}

if ("grant_label" in options) {
if ("grant_label" in options && !(dialog is LocationDialog)) {
dialog.allow_label = options["grant_label"].get_string ();
}

Expand Down
1 change: 1 addition & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ executable(
meson.project_name(),
'Access/Choice.vala',
'Access/Dialog.vala',
'Access/LocationDialog.vala',
'Access/Portal.vala',
'Account' / 'Dialog.vala',
'Account' / 'Portal.vala',
Expand Down