summaryrefslogtreecommitdiff
path: root/document-portal/xdp-main.c
diff options
context:
space:
mode:
Diffstat (limited to 'document-portal/xdp-main.c')
-rw-r--r--document-portal/xdp-main.c40
1 files changed, 8 insertions, 32 deletions
diff --git a/document-portal/xdp-main.c b/document-portal/xdp-main.c
index 5138c4c..611526f 100644
--- a/document-portal/xdp-main.c
+++ b/document-portal/xdp-main.c
@@ -51,37 +51,16 @@ xdp_list_apps (void)
return xdg_app_db_list_apps (db);
}
-guint32 *
+char **
xdp_list_docs (void)
{
- GArray *res;
- g_auto(GStrv) ids = NULL;
- guint32 id;
- int i;
-
AUTOLOCK(db);
-
- res = g_array_new (TRUE, FALSE, sizeof (guint32));
-
- ids = xdg_app_db_list_ids (db);
-
- for (i = 0; ids[i] != NULL; i++)
- {
- guint32 id = xdp_id_from_name (ids[i]);
- g_array_append_val (res, id);
- }
-
- id = 0;
- g_array_append_val (res, id);
-
- return (guint32 *)g_array_free (res, FALSE);
+ return xdg_app_db_list_ids (db);
}
XdgAppDbEntry *
-xdp_lookup_doc (guint32 id)
+xdp_lookup_doc (const char *doc_id)
{
- g_autofree char *doc_id = xdp_name_from_id (id);
-
AUTOLOCK(db);
return xdg_app_db_lookup (db, doc_id);
}
@@ -252,7 +231,7 @@ portal_delete (GDBusMethodInvocation *invocation,
old_apps = xdg_app_db_entry_list_apps (entry);
for (i = 0; old_apps[i] != NULL; i++)
xdp_fuse_invalidate_doc_app (id, old_apps[i], entry);
- xdp_fuse_invalidate_doc (id, entry);
+ xdp_fuse_invalidate_doc_app (id, NULL, entry);
if (persist_entry (entry))
xdg_app_permission_store_call_delete (permission_store, TABLE_NAME,
@@ -305,7 +284,7 @@ do_create_doc (struct stat *parent_st_buf, const char *path, gboolean reuse_exis
entry = xdg_app_db_entry_new (data);
xdg_app_db_set_entry (db, id, entry);
- xdp_fuse_invalidate_doc (id, entry);
+ xdp_fuse_invalidate_doc_app (id, NULL, entry);
if (persistent)
xdg_app_permission_store_call_set (permission_store,
@@ -402,12 +381,11 @@ portal_add (GDBusMethodInvocation *invocation,
if (st_buf.st_dev == fuse_dev)
{
/* The passed in fd is on the fuse filesystem itself */
- guint32 old_id;
g_autoptr(XdgAppDbEntry) old_entry = NULL;
- old_id = xdp_fuse_lookup_id_for_inode (st_buf.st_ino);
- g_debug ("path on fuse, id %x\n", old_id);
- if (old_id == 0)
+ id = xdp_fuse_lookup_id_for_inode (st_buf.st_ino);
+ g_debug ("path on fuse, id %s\n", id);
+ if (id == NULL)
{
g_dbus_method_invocation_return_error (invocation,
XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT,
@@ -415,8 +393,6 @@ portal_add (GDBusMethodInvocation *invocation,
return;
}
- id = xdp_name_from_id (old_id);
-
/* If the entry doesn't exist anymore, fail. Also fail if not
resuse_existing, because otherwise the user could use this to
get a copy with permissions and thus escape later permission