[tracker/direct-access: 47/85] libtracker-bus: Added for dbus implementation
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/direct-access: 47/85] libtracker-bus: Added for dbus implementation
- Date: Tue, 20 Jul 2010 14:08:34 +0000 (UTC)
commit 195537a09f942ce6f9730f26e73f9c4e7e6d0bae
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 +-
src/libtracker-sparql/tracker-connection.vala | 4 +-
6 files changed, 117 insertions(+), 4 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b920924..d2838b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1865,6 +1865,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);
}
diff --git a/src/libtracker-sparql/tracker-connection.vala b/src/libtracker-sparql/tracker-connection.vala
index 435ffcf..cdc1446 100644
--- a/src/libtracker-sparql/tracker-connection.vala
+++ b/src/libtracker-sparql/tracker-connection.vala
@@ -19,8 +19,8 @@
public abstract class Tracker.Sparql.Connection : Object {
// Query
- public abstract Cursor query (string sparql, Cancellable? cancellable = null) throws GLib.Error;
- public async abstract Cursor query_async (string sparql, Cancellable? cancellable = null) throws GLib.Error;
+ public abstract Cursor? query (string sparql, Cancellable? cancellable = null) throws GLib.Error;
+ public async abstract Cursor? query_async (string sparql, Cancellable? cancellable = null) throws GLib.Error;
// Update
public virtual void update (string sparql, Cancellable? cancellable = null) throws GLib.Error {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]