[tracker/gdbus: 96/101] tracker-needle: GDBus porting of tracker-needle's Vala code



commit 3aaaa872de2acd09a147140187a59501fd1a886b
Author: Philip Van Hoof <philip codeminded be>
Date:   Mon Jan 17 13:25:17 2011 +0100

    tracker-needle: GDBus porting of tracker-needle's Vala code

 configure.ac                          |    4 +---
 src/tracker-needle/Makefile.am        |   22 +++++++++++-----------
 src/tracker-needle/tracker-stats.vala |   18 +++++++++---------
 3 files changed, 21 insertions(+), 23 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 11af728..48bd91b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -390,9 +390,7 @@ TRACKER_NEEDLE_REQUIRED="glib-2.0     >= $GLIB_REQUIRED
                          gio-unix-2.0 >= $GLIB_REQUIRED
                          gthread-2.0  >= $GLIB_REQUIRED
                          gmodule-2.0  >= $GLIB_REQUIRED
-                         gtk+-2.0     >= $GTK_REQUIRED
-                         dbus-1       >= $DBUS_REQUIRED
-                         dbus-glib-1  >= $DBUS_GLIB_REQUIRED"
+                         gtk+-2.0     >= $GTK_REQUIRED"
 
 PKG_CHECK_MODULES(TRACKER_NEEDLE, [$TRACKER_NEEDLE_REQUIRED],
                   [have_tracker_needle=yes],
diff --git a/src/tracker-needle/Makefile.am b/src/tracker-needle/Makefile.am
index c380afd..f3cdfde 100644
--- a/src/tracker-needle/Makefile.am
+++ b/src/tracker-needle/Makefile.am
@@ -2,13 +2,13 @@ include $(top_srcdir)/Makefile.decl
 
 bin_PROGRAMS = tracker-needle
 
-AM_VALAFLAGS =                                         \
-	--pkg dbus-glib-1 --pkg gtk+-2.0               \
-	$(BUILD_VALAFLAGS)                             \
+AM_VALAFLAGS = \
+	--pkg gtk+-2.0 --pkg gio-2.0 \
+	$(BUILD_VALAFLAGS) \
 	$(top_srcdir)/src/libtracker-sparql/tracker-sparql-$(TRACKER_API_VERSION).vapi \
 	config.vapi
 
-AM_CPPFLAGS =                                          \
+AM_CPPFLAGS =                                      \
 	$(BUILD_CFLAGS)                                \
 	-D_XOPEN_SOURCE                                \
 	-I$(top_srcdir)/src                            \
@@ -19,12 +19,12 @@ AM_CPPFLAGS =                                          \
 	$(TRACKER_NEEDLE_CFLAGS)                       \
 	-include config.h
 
-LDADD =                                                \
+LDADD =                                            \
 	$(top_builddir)/src/libtracker-sparql/libtracker-sparql-$(TRACKER_API_VERSION).la \
 	$(BUILD_LIBS)                                  \
 	$(TRACKER_NEEDLE_LIBS)
 
-tracker_needle_SOURCES =                               \
+tracker_needle_SOURCES =                           \
 	tracker-cell-renderer-text.vala                \
 	tracker-history.vala                           \
 	tracker-query.vala                             \
@@ -42,14 +42,14 @@ ui_DATA = tracker-needle.ui
 desktopdir = $(datadir)/applications
 desktop_DATA = tracker-needle.desktop
 
-BUILT_SOURCES =                                        \
+BUILT_SOURCES = \
 	tracker_needle_vala.stamp
 
-CLEANFILES =                                           \
+CLEANFILES = \
 	$(desktop_DATA)
 
-EXTRA_DIST =                                           \
-	$(ui_DATA)                                     \
-	$(desktop_DATA)                                \
+EXTRA_DIST = \
+	$(ui_DATA) \
+	$(desktop_DATA) \
 	config.vapi
 
diff --git a/src/tracker-needle/tracker-stats.vala b/src/tracker-needle/tracker-stats.vala
index 75b8000..7323785 100644
--- a/src/tracker-needle/tracker-stats.vala
+++ b/src/tracker-needle/tracker-stats.vala
@@ -23,8 +23,8 @@ using Gtk;
 private const string b = Config.APPNAME;
 
 [DBus (name = "org.freedesktop.Tracker1.Statistics")]
-interface Statistics : GLib.Object {
-	public abstract string[,] Get () throws DBus.Error;
+interface Statistics : DBusProxy {
+	public abstract string[,] Get () throws DBusError;
 }
 
 public class Tracker.Stats : Dialog {
@@ -44,11 +44,11 @@ public class Tracker.Stats : Dialog {
 		debug ("Setting up statistics D-Bus connection");
 
 		try {
-			var conn = DBus.Bus.get (DBus.BusType.SESSION);
-			tracker = (Statistics) conn.get_object ("org.freedesktop.Tracker1",
-			                                        "/org/freedesktop/Tracker1/Statistics",
-			                                        "org.freedesktop.Tracker1.Statistics");
-		} catch (DBus.Error e) {
+			tracker = GLib.Bus.get_proxy_sync (BusType.SESSION,
+			                                   "org.freedesktop.Tracker1",
+			                                   "/org/freedesktop/Tracker1/Statistics",
+			                                   DBusProxyFlags.DO_NOT_LOAD_PROPERTIES | DBusProxyFlags.DO_NOT_CONNECT_SIGNALS);
+		} catch (GLib.IOError e) {
 			var msg = new MessageDialog (null,
 			                             DialogFlags.MODAL,
 			                             MessageType.ERROR,
@@ -112,7 +112,7 @@ public class Tracker.Stats : Dialog {
 					key_used = ngettext ("Application", "Applications", val.to_int ());
 					break;
 				case "nfo:Video":
-//                case "nmm:Video":
+			  //case "nmm:Video":
 					key_used = ngettext ("Video", "Videos", val.to_int ());
 					break;
 				case "nmm:MusicAlbum":
@@ -148,7 +148,7 @@ public class Tracker.Stats : Dialog {
 
 				this.vbox.pack_start (hbox, true, true, 0);
 			}
-		} catch (DBus.Error e) {
+		} catch (DBusError e) {
 			warning ("Could not get Tracker statistics: " + e.message);
 		}
 



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