[tracker/wip/extract-graphs: 4/11] tracker-extract: Add a "graph" parameter to dbus methods



commit 925358594000dca260ee1c0b910247b878f2dc55
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Aug 25 17:25:13 2011 +0200

    tracker-extract: Add a "graph" parameter to dbus methods
    
    Now the requester may provide a graph, that should be used by tracker-extract
    for any insert clause it generates in the preupdate sparql builder.

 src/libtracker-extract/tracker-extract-client.c |   11 ++++++++---
 src/libtracker-extract/tracker-extract-client.h |    1 +
 src/miners/fs/tracker-miner-files.c             |    2 ++
 src/tracker-extract/tracker-controller.c        |   11 +++++++----
 4 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/src/libtracker-extract/tracker-extract-client.c b/src/libtracker-extract/tracker-extract-client.c
index e082801..146b52c 100644
--- a/src/libtracker-extract/tracker-extract-client.c
+++ b/src/libtracker-extract/tracker-extract-client.c
@@ -294,6 +294,7 @@ static void
 get_metadata_fast_async (GDBusConnection    *connection,
                          GFile              *file,
                          const gchar        *mime_type,
+                         const gchar        *graph,
                          GCancellable       *cancellable,
                          GSimpleAsyncResult *res)
 {
@@ -319,9 +320,10 @@ get_metadata_fast_async (GDBusConnection    *connection,
 	uri = g_file_get_uri (file);
 
 	g_dbus_message_set_body (message,
-	                         g_variant_new ("(ssh)",
+	                         g_variant_new ("(sssh)",
 	                                        uri,
 	                                        mime_type,
+	                                        graph,
 	                                        g_unix_fd_list_append (fd_list,
 	                                                               pipefd[1],
 	                                                               NULL)));
@@ -333,7 +335,7 @@ get_metadata_fast_async (GDBusConnection    *connection,
 	g_object_unref (fd_list);
 	g_free (uri);
 
-	info = tracker_extract_info_new (file, mime_type, NULL);
+	info = tracker_extract_info_new (file, mime_type, graph);
 	data = metadata_call_data_new (info, res);
 
 	dbus_send_and_splice_async (connection,
@@ -350,6 +352,7 @@ get_metadata_fast_async (GDBusConnection    *connection,
  * tracker_extract_client_get_metadata:
  * @file: a #GFile
  * @mime_type: mimetype of @file
+ * @graph: graph that should be used for the generated insert clauses, or %NULL
  * @cancellable: (allow-none): cancellable for the async operation, or %NULL
  * @callback: (scope async): callback to call when the request is satisfied.
  * @user_data: (closure): data for the callback function
@@ -364,6 +367,7 @@ get_metadata_fast_async (GDBusConnection    *connection,
 void
 tracker_extract_client_get_metadata (GFile               *file,
                                      const gchar         *mime_type,
+                                     const gchar         *graph,
                                      GCancellable        *cancellable,
                                      GAsyncReadyCallback  callback,
                                      gpointer             user_data)
@@ -389,7 +393,8 @@ tracker_extract_client_get_metadata (GFile               *file,
 	res = g_simple_async_result_new (G_OBJECT (file), callback, user_data, NULL);
 	g_simple_async_result_set_handle_cancellation (res, TRUE);
 
-	get_metadata_fast_async (connection, file, mime_type, cancellable, res);
+	get_metadata_fast_async (connection, file, mime_type, graph,
+	                         cancellable, res);
 	g_object_unref (res);
 }
 
diff --git a/src/libtracker-extract/tracker-extract-client.h b/src/libtracker-extract/tracker-extract-client.h
index dd6e058..4290c13 100644
--- a/src/libtracker-extract/tracker-extract-client.h
+++ b/src/libtracker-extract/tracker-extract-client.h
@@ -31,6 +31,7 @@ G_BEGIN_DECLS
 
 void                 tracker_extract_client_get_metadata        (GFile               *file,
                                                                  const gchar         *mime_type,
+                                                                 const gchar         *graph,
                                                                  GCancellable        *cancellable,
                                                                  GAsyncReadyCallback  callback,
                                                                  gpointer             user_data);
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index 3d853d6..ae1e954 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -2075,6 +2075,7 @@ extractor_process_failsafe (TrackerMinerFiles *miner)
 
 		tracker_extract_client_get_metadata (data->file,
 						     data->mime_type,
+		                                     TRACKER_MINER_FS_GRAPH_URN,
 						     data->cancellable,
 						     extractor_get_failsafe_metadata_cb,
 						     data);
@@ -2281,6 +2282,7 @@ process_file_cb (GObject      *object,
 		/* Next step, if handled by the extractor, get embedded metadata */
 		tracker_extract_client_get_metadata (data->file,
 		                                     mime_type,
+		                                     TRACKER_MINER_FS_GRAPH_URN,
 		                                     data->cancellable,
 		                                     extractor_get_embedded_metadata_cb,
 		                                     data);
diff --git a/src/tracker-extract/tracker-controller.c b/src/tracker-extract/tracker-controller.c
index 42aa126..20558a3 100644
--- a/src/tracker-extract/tracker-controller.c
+++ b/src/tracker-extract/tracker-controller.c
@@ -93,6 +93,7 @@ static const gchar *introspection_xml =
 	"    <method name='GetMetadata'>"
 	"      <arg type='s' name='uri' direction='in' />"
 	"      <arg type='s' name='mime' direction='in' />"
+	"      <arg type='s' name='graph' direction='in' />"
 	"      <arg type='s' name='preupdate' direction='out' />"
 	"      <arg type='s' name='embedded' direction='out' />"
 	"      <arg type='s' name='where' direction='out' />"
@@ -100,6 +101,7 @@ static const gchar *introspection_xml =
 	"    <method name='GetMetadataFast'>"
 	"      <arg type='s' name='uri' direction='in' />"
 	"      <arg type='s' name='mime' direction='in' />"
+	"      <arg type='s' name='graph' direction='in' />"
 	"      <arg type='h' name='fd' direction='in' />"
 	"    </method>"
 	"    <method name='CancelTasks'>"
@@ -489,10 +491,10 @@ handle_method_call_get_metadata (TrackerController     *controller,
 	TrackerControllerPrivate *priv;
 	GetMetadataData *data;
 	TrackerDBusRequest *request;
-	const gchar *uri, *mime;
+	const gchar *uri, *mime, *graph;
 
 	priv = controller->priv;
-	g_variant_get (parameters, "(&s&s)", &uri, &mime);
+	g_variant_get (parameters, "(&s&s&s)", &uri, &mime, &graph);
 
 	reset_shutdown_timeout (controller);
 	request = tracker_dbus_request_begin (NULL, "%s (%s, %s)", __FUNCTION__, uri, mime);
@@ -665,14 +667,15 @@ handle_method_call_get_metadata_fast (TrackerController     *controller,
 	if (g_dbus_connection_get_capabilities (connection) & G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING) {
 		TrackerControllerPrivate *priv;
 		GetMetadataData *data;
-		const gchar *uri, *mime;
+		const gchar *uri, *mime, *graph;
 		gint index_fd, fd;
 		GUnixFDList *fd_list;
 		GError *error = NULL;
 
 		priv = controller->priv;
 
-		g_variant_get (parameters, "(&s&sh)", &uri, &mime, &index_fd);
+		g_variant_get (parameters, "(&s&s&sh)",
+		               &uri, &mime, &graph, &index_fd);
 
 		request = tracker_dbus_request_begin (NULL,
 		                                      "%s (uri:'%s', mime:'%s', index_fd:%d)",



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]