[tracker/wip/carlosg/portal: 131/141] portal: Handle */default keywords in policy
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/portal: 131/141] portal: Handle */default keywords in policy
- Date: Wed, 19 Feb 2020 11:57:17 +0000 (UTC)
commit af0af5a31dafb007ac61c5055b18abc3d2b65152
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Jan 24 12:40:01 2020 +0100
portal: Handle */default keywords in policy
Those translate to CONSTRAINT GRAPH ALL and CONSTRAINT GRAPH DEFAULT,
to let access to all graphs, or the default unnamed graph specifically.
src/portal/tracker-portal-endpoint.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/portal/tracker-portal-endpoint.c b/src/portal/tracker-portal-endpoint.c
index cebd6b590..a357d5383 100644
--- a/src/portal/tracker-portal-endpoint.c
+++ b/src/portal/tracker-portal-endpoint.c
@@ -26,6 +26,9 @@
#include "tracker-portal-endpoint.h"
+#define GRAPH_ALL "*"
+#define GRAPH_DEFAULT "default"
+
typedef struct _TrackerPortalEndpoint TrackerPortalEndpoint;
typedef struct _TrackerPortalEndpointClass TrackerPortalEndpointClass;
@@ -75,7 +78,12 @@ tracker_portal_endpoint_filter_graph (TrackerEndpointDBus *endpoint_dbus,
gint i;
for (i = 0; endpoint->graphs[i]; i++) {
- if (g_strcmp0 (graph_name, endpoint->graphs[i]) == 0) {
+ if (g_strcmp0 (endpoint->graphs[i], GRAPH_ALL) == 0) {
+ return FALSE;
+ } else if (!graph_name &&
+ g_strcmp0 (endpoint->graphs[i], GRAPH_DEFAULT) == 0) {
+ return FALSE;
+ } else if (g_strcmp0 (graph_name, endpoint->graphs[i]) == 0) {
return FALSE;
}
}
@@ -99,7 +107,12 @@ tracker_portal_endpoint_add_prologue (TrackerEndpointDBus *endpoint_dbus)
if (i != 0)
g_string_append (str, ", ");
- g_string_append_printf (str, "<%s>", endpoint->graphs[i]);
+ if (g_strcmp0 (endpoint->graphs[i], GRAPH_ALL) == 0)
+ g_string_append (str, "ALL");
+ else if (g_strcmp0 (endpoint->graphs[i], GRAPH_DEFAULT) == 0)
+ g_string_append (str, "DEFAULT");
+ else
+ g_string_append_printf (str, "<%s>", endpoint->graphs[i]);
}
endpoint->prologue = g_string_free (str, FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]