-
-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GetRealPath to document portal #1269
Changes from 2 commits
6dab11a
dfe03e6
64ed5b0
1794b06
6821356
797ea01
7aab70f
8a4e19e
341f35c
1dd61b9
5ad6f8f
a1a7c8d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -273,5 +273,17 @@ | |||||
<arg type='s' name='app_id' direction='in'/> | ||||||
<arg type='a{say}' name='docs' direction='out'/> | ||||||
</method> | ||||||
|
||||||
<!-- | ||||||
GetRealPath: | ||||||
@doc_id: the ID of the file in the document store | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
@path: the path for the file in the host filesystem | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
Gets the filesystem path for a document store entry. | ||||||
grulja marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
--> | ||||||
<method name="GetRealPath"> | ||||||
grulja marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
<arg type='s' name='doc_id' direction='in'/> | ||||||
<arg type='s' name='path' direction='out'/> | ||||||
</method> | ||||||
</interface> | ||||||
</node> |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1416,6 +1416,68 @@ portal_list (GDBusMethodInvocation *invocation, | |||||
return TRUE; | ||||||
} | ||||||
|
||||||
static gboolean | ||||||
portal_get_real_path (GDBusMethodInvocation *invocation, | ||||||
GVariant *parameters, | ||||||
XdpAppInfo *app_info) | ||||||
{ | ||||||
const char *id = NULL; | ||||||
g_autoptr(PermissionDbEntry) entry = NULL; | ||||||
|
||||||
g_variant_get (parameters, "(&s)", &id); | ||||||
|
||||||
XDP_AUTOLOCK (db); | ||||||
|
||||||
entry = permission_db_lookup (db, id); | ||||||
|
||||||
if (!entry) | ||||||
{ | ||||||
g_dbus_method_invocation_return_error (invocation, | ||||||
XDG_DESKTOP_PORTAL_ERROR, XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENT, | ||||||
"Invalid ID passed"); | ||||||
return TRUE; | ||||||
} | ||||||
|
||||||
if (!xdp_app_info_is_host (app_info)) | ||||||
{ | ||||||
g_autofree const char **apps = NULL; | ||||||
g_autofree const char *app_id = NULL; | ||||||
grulja marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
gboolean id_found = FALSE; | ||||||
int i; | ||||||
|
||||||
app_id = xdp_app_info_get_id(app_info); | ||||||
|
||||||
apps = permission_db_entry_list_apps (entry); | ||||||
for (i = 0; apps[i] != NULL; i++) | ||||||
{ | ||||||
if (g_strcmp0 (app_id, apps[i]) == 0) | ||||||
{ | ||||||
id_found = TRUE; | ||||||
break; | ||||||
} | ||||||
} | ||||||
|
||||||
if (!id_found) | ||||||
{ | ||||||
g_dbus_method_invocation_return_error (invocation, | ||||||
XDG_DESKTOP_PORTAL_ERROR, XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENT, | ||||||
"Invalid ID passed"); | ||||||
JakobDev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
return TRUE; | ||||||
} | ||||||
} | ||||||
|
||||||
g_autoptr (GVariant) data = permission_db_entry_get_data (entry); | ||||||
const char *path; | ||||||
|
||||||
g_variant_get (data, "(^&ayttu)", &path, NULL, NULL, NULL); | ||||||
|
||||||
g_dbus_method_invocation_return_value (invocation, | ||||||
g_variant_new ("(@s)", | ||||||
g_variant_new_string (path))); | ||||||
|
||||||
return TRUE; | ||||||
} | ||||||
|
||||||
static void | ||||||
peer_died_cb (const char *name) | ||||||
{ | ||||||
|
@@ -1445,6 +1507,7 @@ on_bus_acquired (GDBusConnection *connection, | |||||
g_signal_connect_swapped (dbus_api, "handle-lookup", G_CALLBACK (handle_method), portal_lookup); | ||||||
g_signal_connect_swapped (dbus_api, "handle-info", G_CALLBACK (handle_method), portal_info); | ||||||
g_signal_connect_swapped (dbus_api, "handle-list", G_CALLBACK (handle_method), portal_list); | ||||||
g_signal_connect_swapped (dbus_api, "handle-get-real-path", G_CALLBACK (handle_method), portal_get_real_path); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
file_transfer = file_transfer_create (); | ||||||
g_dbus_interface_skeleton_set_flags (file_transfer, | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.