[tracker/direct-access: 35/122] libtracker-bus: Added for dbus implementation



commit 4f0b28bf22bd5527dd00d9204b6dab984a004065
Author: Martyn Russell <martyn lanedo com>
Date:   Wed Jul 14 11:11:05 2010 +0100

    libtracker-bus: Added for dbus implementation
    
    Also updated query method in abstract class to return optional Cursor

 configure.ac                                  |    1 +
 src/Makefile.am                               |    1 +
 src/libtracker-bus/Makefile.am                |   64 +++++++++++++++++++++++++
 src/libtracker-bus/tracker-connection.vala    |   47 ++++++++++++++++++
 src/libtracker-direct/tracker-connection.vala |    4 +-
 5 files changed, 115 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 9b80704..e6bde06 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1868,6 +1868,7 @@ AC_CONFIG_FILES([
 	src/libstemmer/Makefile
 	src/libtracker-common/Makefile
 	src/libtracker-sparql/Makefile
+	src/libtracker-bus/Makefile
 	src/libtracker-direct/Makefile
 	src/libtracker-data/Makefile
 	src/libtracker-fts/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index afd4030..640e0ec 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,6 +15,7 @@ SUBDIRS = 					\
 	libtracker-sparql 			\
 	libtracker-client			\
 	$(libtrackerfts_dir)			\
+	libtracker-bus				\
 	libtracker-data				\
 	libtracker-direct			\
 	libtracker-extract			\
diff --git a/src/libtracker-bus/Makefile.am b/src/libtracker-bus/Makefile.am
new file mode 100644
index 0000000..9551797
--- /dev/null
+++ b/src/libtracker-bus/Makefile.am
@@ -0,0 +1,64 @@
+include $(top_srcdir)/Makefile.decl
+
+INCLUDES =								\
+	-DG_LOG_DOMAIN=\"Tracker\"					\
+	-DTRACKER_COMPILATION						\
+	-I$(top_srcdir)/src						\
+	-I$(top_srcdir)/src/libtracker-sparql				\
+	-I$(top_builddir)/src						\
+	$(WARN_CFLAGS)							\
+	$(GLIB2_CFLAGS)							\
+	$(GCOV_CFLAGS)
+
+lib_LTLIBRARIES = libtracker-bus- TRACKER_API_VERSION@.la
+
+libtracker_busincludedir = $(includedir)/tracker-$(TRACKER_API_VERSION)/libtracker-bus
+
+libtracker_bus_la_VALASOURCES = \
+	tracker-connection.vala
+
+libtracker_bus_ TRACKER_API_VERSION@_la_SOURCES = 	\
+	libtracker-connection.vala.stamp			\
+	$(libtracker_bus_la_VALASOURCES:.vala=.c)
+
+libtracker_bus_ TRACKER_API_VERSION@_la_LDFLAGS = 	\
+	-shared -fPIC -module -avoid-version
+
+#	-export-symbols-regex '^tracker_.*'
+
+libtracker_businclude_HEADERS = 			\
+	$(top_srcdir)/src/libtracker-sparql/tracker-sparql-$(TRACKER_API_VERSION).vapi	\
+	tracker-bus.h
+
+# Vala sources
+vapi_sources =						\
+	$(top_srcdir)/src/libtracker-sparql/tracker-sparql-$(TRACKER_API_VERSION).vapi	\
+	$(top_srcdir)/src/libtracker-common/libtracker-common.vapi
+
+# Vala bindings
+vapidir = $(datadir)/vala/vapi
+vapi_DATA = \
+	tracker-bus-$(TRACKER_API_VERSION).vapi
+
+libtracker-bus.vala.stamp: $(libtracker_bus_la_VALASOURCES) $(vapi_sources)
+	$(AM_V_GEN)$(VALAC) $(GCOV_VALAFLAGS) -C $(VALAFLAGS) --pkg gio-2.0 -H tracker-bus.h --vapi tracker-bus-$(TRACKER_API_VERSION).vapi $^
+	$(AM_V_GEN)touch $@
+
+libtracker_bus_ TRACKER_API_VERSION@_la_LIBADD = 						\
+	$(GLIB2_LIBS) \
+	$(DBUS_LIBS)
+
+BUILT_SOURCES = 					\
+	libtracker-bus.vala.stamp
+
+CLEANFILES = 						\
+	$(BUILT_SOURCES)
+
+MAINTAINERCLEANFILES =					\
+	$(libtracker_bus_la_VALASOURCES:.vala=.c) \
+	libtracker-bus.vala.stamp			\
+	tracker-bus.h
+
+EXTRA_DIST = 						\
+	$(libtracker_bus_la_VALASOURCES) \
+	libtracker-bus.vala.stamp
diff --git a/src/libtracker-bus/tracker-connection.vala b/src/libtracker-bus/tracker-connection.vala
new file mode 100644
index 0000000..91c60f2
--- /dev/null
+++ b/src/libtracker-bus/tracker-connection.vala
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2010, Nokia <ivan frade nokia com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ */
+
+public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
+	static bool initialized;
+
+	public Connection ()
+	requires (!initialized) {
+		initialized = true;
+
+		// FIXME: Implement DBus stuff
+	}
+
+	~Connection () {
+		// Clean up connection
+		initialized = false;
+	}
+
+	public override Sparql.Cursor? query (string sparql, Cancellable? cancellable) throws GLib.Error {
+		return null;
+	}
+
+	public async override Sparql.Cursor? query_async (string sparql, Cancellable? cancellable = null) throws GLib.Error {
+		return null;
+	}
+}
+
+public Tracker.Sparql.Connection module_init () {
+	Tracker.Sparql.Connection plugin = new Tracker.Bus.Connection ();
+	return plugin;
+}
diff --git a/src/libtracker-direct/tracker-connection.vala b/src/libtracker-direct/tracker-connection.vala
index e3e0dea..2044902 100644
--- a/src/libtracker-direct/tracker-connection.vala
+++ b/src/libtracker-direct/tracker-connection.vala
@@ -33,14 +33,14 @@ public class Tracker.Direct.Connection : Tracker.Sparql.Connection {
 		initialized = false;
 	}
 
-	public override Sparql.Cursor query (string sparql, Cancellable? cancellable) throws GLib.Error {
+	public override Sparql.Cursor? query (string sparql, Cancellable? cancellable) throws GLib.Error {
 		var query_object = new Sparql.Query (sparql);
 		var cursor = query_object.execute_cursor ();
 		cursor.connection = this;
 		return cursor;
 	}
 
-	public async override Sparql.Cursor query_async (string sparql, Cancellable? cancellable = null) throws GLib.Error {
+	public async override Sparql.Cursor? query_async (string sparql, Cancellable? cancellable = null) throws GLib.Error {
 		// just creating the cursor won't block
 		return query (sparql, cancellable);
 	}



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