[gnome-documents] miner: write document contributors to the tracker DB
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] miner: write document contributors to the tracker DB
- Date: Mon, 29 Aug 2011 18:59:30 +0000 (UTC)
commit f5b23990da379046ba4ab0b41b577a2143cfdc44
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Aug 29 14:57:17 2011 -0400
miner: write document contributors to the tracker DB
src/miner/gd-gdata-miner.c | 45 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/src/miner/gd-gdata-miner.c b/src/miner/gd-gdata-miner.c
index 680e3cd..d6dc206 100644
--- a/src/miner/gd-gdata-miner.c
+++ b/src/miner/gd-gdata-miner.c
@@ -388,6 +388,8 @@ gd_gdata_miner_process_entry (GdGDataMiner *self,
GDataCategory *category;
gboolean starred = FALSE;
+ GDataFeed *access_rules = NULL;
+
if (!GDATA_IS_DOCUMENTS_DOCUMENT (doc_entry))
{
/* TODO: folders */
@@ -499,6 +501,48 @@ gd_gdata_miner_process_entry (GdGDataMiner *self,
g_free (contact_resource);
}
+ access_rules = gdata_access_handler_get_rules (GDATA_ACCESS_HANDLER (entry),
+ GDATA_SERVICE (self->priv->service),
+ self->priv->cancellable,
+ NULL, NULL, error);
+
+ if (*error != NULL)
+ goto out;
+
+ for (l = gdata_feed_get_entries (access_rules); l != NULL; l = l->next)
+ {
+ GDataAccessRule *rule = l->data;
+ const gchar *scope_type;
+ const gchar *scope_value;
+ gchar *contact_resource;
+
+ gdata_access_rule_get_scope (rule, &scope_type, &scope_value);
+
+ /* default scope access means the document is completely public */
+ if (g_strcmp0 (scope_type, GDATA_ACCESS_SCOPE_DEFAULT) == 0)
+ continue;
+
+ /* skip domain scopes */
+ if (g_strcmp0 (scope_type, GDATA_ACCESS_SCOPE_DOMAIN) == 0)
+ continue;
+
+ contact_resource = _tracker_utils_ensure_contact_resource (self->priv->connection,
+ self->priv->cancellable, error,
+ scope_value,
+ "");
+
+ _tracker_sparql_connection_insert_or_replace_triple
+ (self->priv->connection,
+ self->priv->cancellable, error,
+ identifier, resource,
+ "nco:contributor", contact_resource);
+
+ g_free (contact_resource);
+
+ if (*error != NULL)
+ goto out;
+ }
+
date = _tracker_utils_iso8601_from_timestamp (gdata_entry_get_published (entry));
_tracker_sparql_connection_insert_or_replace_triple
(self->priv->connection,
@@ -522,6 +566,7 @@ gd_gdata_miner_process_entry (GdGDataMiner *self,
goto out;
out:
+ g_clear_object (&access_rules);
g_free (resource_url);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]