[tracker/network-status: 2/2] Add example for TrackerMinerWeb



commit f60dc3c336c3cb4e1e1f342dd05496f9ef7a63df
Author: Adrien Bustany <abustany gnome org>
Date:   Mon May 3 10:06:01 2010 -0400

    Add example for TrackerMinerWeb

 examples/libtracker-miner/Makefile.am              |   42 +++++++++++++++++++-
 .../libtracker-miner/tracker-miner-web-test.vala   |   21 ++++++++++
 2 files changed, 62 insertions(+), 1 deletions(-)
---
diff --git a/examples/libtracker-miner/Makefile.am b/examples/libtracker-miner/Makefile.am
index 9bac048..850ed55 100644
--- a/examples/libtracker-miner/Makefile.am
+++ b/examples/libtracker-miner/Makefile.am
@@ -13,7 +13,15 @@ INCLUDES =							\
 	$(GIO_CFLAGS)						\
 	$(DBUS_CFLAGS)
 
-noinst_PROGRAMS = tracker-miner-test
+VALAFLAGS =							\
+	--vapidir $(top_srcdir)/src/libtracker-miner		\
+	--pkg tracker-miner
+
+BUILT_SOURCES = tracker-miner-web-test.vala.stamp
+
+noinst_PROGRAMS =						\
+	tracker-miner-test					\
+	tracker-miner-web-test
 
 tracker_miner_test_SOURCES =   					\
 	tracker-miner-test.c    				\
@@ -32,3 +40,35 @@ tracker_miner_test_LDADD =                             		\
        $(GLIB2_LIBS)                                   		\
        -lz                                             		\
        -lm
+
+tracker_miner_web_test_VALASOURCES =				\
+	tracker-miner-web-test.vala
+
+tracker_miner_web_test_SOURCES =				\
+	tracker-miner-web-test.vala.stamp			\
+	$(tracker_miner_web_test_VALASOURCES:.vala=.c)
+
+tracker_miner_web_test_LDADD =					\
+       $(top_builddir)/src/libtracker-miner/libtracker-miner- TRACKER_API_VERSION@.la \
+       $(top_builddir)/src/libtracker-client/libtracker-client- TRACKER_API_VERSION@.la \
+       $(top_builddir)/src/libtracker-common/libtracker-common.la \
+       $(DBUS_LIBS)						\
+       $(GMODULE_LIBS)						\
+       $(GTHREAD_LIBS)						\
+       $(GIO_LIBS)						\
+       $(GCOV_LIBS)						\
+       $(GLIB2_LIBS)						\
+       -lz							\
+       -lm
+
+tracker-miner-web-test.vala.stamp: $(tracker_miner_web_test_VALASOURCES)
+	$(AM_V_GEN)$(VALAC) $(GCOV_VALAFLAGS) -C $(VALAFLAGS) $^
+	touch $@
+
+MAINTAINERCLEANFILES =						\
+	tracker-miner-web-test.vala.stamp			\
+	$(tracker_miner_web_test_VALASOURCES:.vala=.c)
+
+EXTRA_DIST =							\
+	$(tracker_miner_web_test_VALASOURCES)			\
+	tracker-miner-web-test.vala.stamp
diff --git a/examples/libtracker-miner/tracker-miner-web-test.vala b/examples/libtracker-miner/tracker-miner-web-test.vala
new file mode 100644
index 0000000..8404834
--- /dev/null
+++ b/examples/libtracker-miner/tracker-miner-web-test.vala
@@ -0,0 +1,21 @@
+public class MinerWebTest : Tracker.MinerWeb {
+	Tracker.NetworkProvider network_provider;
+
+	construct {
+		name = "MinerWebTest";
+		network_provider = Tracker.NetworkProvider.get ();
+	}
+
+	public MinerWebTest () {
+		network_provider.status_changed.connect ((status) => {message ("Network status is now %u", status);});
+	}
+
+	public static int main (string[] args) {
+		MinerWebTest miner = new MinerWebTest ();
+		MainLoop loop = new MainLoop (null, false);
+
+		loop.run ();
+
+		return 0;
+	}
+}



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