[tracker/wal: 12/53] tracker-import: Use new libtracker-sparql API
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wal: 12/53] tracker-import: Use new libtracker-sparql API
- Date: Mon, 16 Aug 2010 10:19:42 +0000 (UTC)
commit 4712807d4af3fbac87cfcb6eeee5b8bb7335f1ea
Author: Martyn Russell <martyn lanedo com>
Date: Tue Jul 20 17:26:53 2010 +0100
tracker-import: Use new libtracker-sparql API
src/tracker-utils/tracker-import.c | 43 +++++++++++++++++++----------------
1 files changed, 23 insertions(+), 20 deletions(-)
---
diff --git a/src/tracker-utils/tracker-import.c b/src/tracker-utils/tracker-import.c
index 3b78906..e099f75 100644
--- a/src/tracker-utils/tracker-import.c
+++ b/src/tracker-utils/tracker-import.c
@@ -29,13 +29,12 @@
#include <glib.h>
#include <glib/gi18n.h>
-#include <libtracker-client/tracker-client.h>
-#include <libtracker-common/tracker-common.h>
+#include <libtracker-sparql/tracker-sparql.h>
-#define ABOUT \
+#define ABOUT \
"Tracker " PACKAGE_VERSION "\n"
-#define LICENSE \
+#define LICENSE \
"This program is free software and comes without any warranty.\n" \
"It is licensed under version 2 or later of the General Public " \
"License which can be viewed at:\n" \
@@ -60,9 +59,10 @@ static GOptionEntry entries[] = {
int
main (int argc, char **argv)
{
- TrackerClient *client;
- GOptionContext *context;
- gchar **p;
+ TrackerSparqlConnection *connection;
+ GOptionContext *context;
+ GError *error = NULL;
+ gchar **p;
setlocale (LC_ALL, "");
@@ -102,33 +102,36 @@ main (int argc, char **argv)
g_option_context_free (context);
- client = tracker_client_new (0, G_MAXINT);
+ g_type_init ();
- if (!client) {
- g_printerr ("%s\n",
- _("Could not establish a D-Bus connection to Tracker"));
+ if (!g_thread_supported ()) {
+ g_thread_init (NULL);
+ }
+
+ connection = tracker_sparql_connection_get (&error);
+
+ if (!connection) {
+ g_printerr ("%s: %s\n",
+ _("Could not establish a connection to Tracker"),
+ error ? error->message : _("No error given"));
+ g_clear_error (&error);
return EXIT_FAILURE;
}
for (p = filenames; *p; p++) {
GError *error = NULL;
- GFile *file;
- gchar *uri;
+ GFile *file;
g_print ("%s:'%s'\n",
_("Importing Turtle file"),
*p);
file = g_file_new_for_commandline_arg (*p);
- uri = g_file_get_uri (file);
-
- tracker_resources_load (client, uri, &error);
-
+ tracker_sparql_connection_import (connection, file, NULL, &error);
g_object_unref (file);
- g_free (uri);
if (error) {
- g_printerr ("%s, %s\n",
+ g_printerr (" %s, %s\n",
_("Unable to import Turtle file"),
error->message);
@@ -140,7 +143,7 @@ main (int argc, char **argv)
g_print ("\n");
}
- g_object_unref (client);
+ g_object_unref (connection);
return EXIT_SUCCESS;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]