[tracker] tracker-store, examples, tests: Renamed ClassSignal to GraphUpdated



commit 2908738d048af716476bdd1ecc1b2a92030f9ad1
Author: Philip Van Hoof <philip codeminded be>
Date:   Mon Aug 30 13:56:01 2010 +0200

    tracker-store, examples, tests: Renamed ClassSignal to GraphUpdated

 data/dbus/tracker-resources.xml                    |    2 +-
 examples/class-signal/class-signal.c               |    2 +-
 src/tracker-store/tracker-events.c                 |    2 +-
 src/tracker-store/tracker-resources.c              |   34 ++++++++++----------
 src/tracker-store/tracker-resources.h              |    2 +-
 .../class-signal-performance-test.vala             |   24 ++++++-------
 tests/functional-tests/class-signal-test.vala      |   12 +++---
 7 files changed, 38 insertions(+), 40 deletions(-)
---
diff --git a/data/dbus/tracker-resources.xml b/data/dbus/tracker-resources.xml
index b415217..6c1287f 100644
--- a/data/dbus/tracker-resources.xml
+++ b/data/dbus/tracker-resources.xml
@@ -54,7 +54,7 @@
       <arg type="a{iai}" name="subjects" />
    </signal>
 
-   <signal name="ClassSignal">
+   <signal name="GraphUpdated">
       <arg type="s" name ="classname" />
       <arg type="a(iiii)" name="deletes" />
       <arg type="a(iiii)" name="inserts" />
diff --git a/examples/class-signal/class-signal.c b/examples/class-signal/class-signal.c
index 3f8324a..eedb974 100644
--- a/examples/class-signal/class-signal.c
+++ b/examples/class-signal/class-signal.c
@@ -94,7 +94,7 @@ class_signal_cb (DBusMessage *message)
 static DBusHandlerResult
 message_filter (DBusConnection *connection, DBusMessage *message, gpointer ud)
 {
-	if (dbus_message_is_signal (message, TRACKER_INTERFACE_RESOURCES, "ClassSignal")) {
+	if (dbus_message_is_signal (message, TRACKER_INTERFACE_RESOURCES, "GraphUpdated")) {
 		class_signal_cb (message);
 		return DBUS_HANDLER_RESULT_HANDLED;
 	}
diff --git a/src/tracker-store/tracker-events.c b/src/tracker-store/tracker-events.c
index ddc0654..0bc13f3 100644
--- a/src/tracker-store/tracker-events.c
+++ b/src/tracker-store/tracker-events.c
@@ -273,7 +273,7 @@ tracker_events_init (TrackerNotifyClassGetter callback)
 			g_hash_table_insert (private->allowances_id,
 			                     GINT_TO_POINTER (tracker_class_get_id (class)),
 			                     GINT_TO_POINTER (TRUE));
-			g_debug ("ClassSignal allowance: %s has ID %d",
+			g_debug ("GraphUpdated allowance: %s has ID %d",
 			         tracker_class_get_name (class),
 			         tracker_class_get_id (class));
 		}
diff --git a/src/tracker-store/tracker-resources.c b/src/tracker-store/tracker-resources.c
index 89f68c8..553b60e 100644
--- a/src/tracker-store/tracker-resources.c
+++ b/src/tracker-store/tracker-resources.c
@@ -41,8 +41,8 @@
 #include "tracker-writeback.h"
 #include "tracker-store.h"
 
-#define TRACKER_CLASS_SIGNAL_IMMEDIATE_EMIT_AT	1000
-#define TRACKER_CLASS_SIGNAL_SECONDS_PER_EMIT	1
+#define TRACKER_GRAPH_UPDATED_IMMEDIATE_EMIT_AT   1000
+#define TRACKER_SIGNALS_SECONDS_PER_EMIT          1
 
 #define RDF_PREFIX TRACKER_RDF_PREFIX
 #define RDF_TYPE RDF_PREFIX "type"
@@ -78,7 +78,7 @@ G_DEFINE_TYPE(TrackerResources, tracker_resources, G_TYPE_OBJECT)
 
 enum {
 	WRITEBACK,
-	CLASSSIGNAL,
+	GRAPHUPDATED,
 	LAST_SIGNAL
 };
 
@@ -122,11 +122,11 @@ tracker_resources_class_init (TrackerResourcesClass *klass)
 		              TRACKER_TYPE_INT_ARRAY_MAP);
 
 	/* This is just for introspection to work */
-	signals[CLASSSIGNAL] =
-		g_signal_new ("class-signal",
+	signals[GRAPHUPDATED] =
+		g_signal_new ("graph-updated",
 		              G_OBJECT_CLASS_TYPE (object_class),
 		              G_SIGNAL_RUN_LAST,
-		              G_STRUCT_OFFSET (TrackerResourcesClass, class_signal),
+		              G_STRUCT_OFFSET (TrackerResourcesClass, graph_updated),
 		              NULL, NULL,
 		              tracker_marshal_VOID__STRING_BOXED_BOXED,
 		              G_TYPE_NONE, 3,
@@ -552,8 +552,8 @@ foreach_add_to_iter (gint graph_id,
 }
 
 static gboolean
-emit_class_signal (TrackerResources *self,
-                   TrackerClass     *class)
+emit_graph_updated (TrackerResources *self,
+                    TrackerClass     *class)
 {
 	if (tracker_class_has_insert_events (class) || tracker_class_has_delete_events (class)) {
 		TrackerResourcesPrivate *priv;
@@ -565,7 +565,7 @@ emit_class_signal (TrackerResources *self,
 
 		message = dbus_message_new_signal (TRACKER_RESOURCES_PATH,
 		                                   TRACKER_RESOURCES_INTERFACE,
-		                                   "ClassSignal");
+		                                   "GraphUpdated");
 
 		class_uri = tracker_class_get_uri (class);
 
@@ -616,7 +616,7 @@ on_emit_signals (gpointer user_data)
 
 	while (g_hash_table_iter_next (&iter, &key, &value)) {
 		TrackerClass *class = key;
-		if (emit_class_signal (user_data, class)) {
+		if (emit_graph_updated (user_data, class)) {
 			had_any = TRUE;
 		}
 	}
@@ -674,21 +674,21 @@ on_statements_rolled_back (gpointer user_data)
 }
 
 static gboolean
-check_class_signal_signal (TrackerResources *object)
+check_graph_updated_signal (TrackerResources *object)
 {
 	TrackerResourcesPrivate *priv;
 
 	priv = TRACKER_RESOURCES_GET_PRIVATE (object);
 
 	/* Check for whether we need an immediate emit */
-	if (tracker_events_get_total (FALSE) > TRACKER_CLASS_SIGNAL_IMMEDIATE_EMIT_AT) {
+	if (tracker_events_get_total (FALSE) > TRACKER_GRAPH_UPDATED_IMMEDIATE_EMIT_AT) {
 		gpointer key, value;
 		GHashTableIter iter;
 
 		tracker_events_classes_iter (&iter);
 		while (g_hash_table_iter_next (&iter, &key, &value)) {
 			TrackerClass *class = key;
-			emit_class_signal (object, class);
+			emit_graph_updated (object, class);
 		}
 
 		/* Reset counter */
@@ -721,10 +721,10 @@ on_statement_inserted (gint         graph_id,
 	a = tracker_writeback_check (graph_id, graph, subject_id,
 	                             subject, pred_id, object_id,
 	                             object, rdf_types);
-	b = check_class_signal_signal (user_data);
+	b = check_graph_updated_signal (user_data);
 
 	if ((a || b) && priv->signal_timeout == 0) {
-		priv->signal_timeout = g_timeout_add_seconds (TRACKER_CLASS_SIGNAL_SECONDS_PER_EMIT,
+		priv->signal_timeout = g_timeout_add_seconds (TRACKER_SIGNALS_SECONDS_PER_EMIT,
 		                                              on_emit_signals,
 		                                              user_data);
 	}
@@ -752,10 +752,10 @@ on_statement_deleted (gint         graph_id,
 	a = tracker_writeback_check (graph_id, graph, subject_id,
 	                             subject, pred_id, object_id,
 	                             object, rdf_types);
-	b = check_class_signal_signal (user_data);
+	b = check_graph_updated_signal (user_data);
 
 	if ((a || b) && priv->signal_timeout == 0) {
-		priv->signal_timeout = g_timeout_add_seconds (TRACKER_CLASS_SIGNAL_SECONDS_PER_EMIT,
+		priv->signal_timeout = g_timeout_add_seconds (TRACKER_SIGNALS_SECONDS_PER_EMIT,
 		                                              on_emit_signals,
 		                                              user_data);
 	}
diff --git a/src/tracker-store/tracker-resources.h b/src/tracker-store/tracker-resources.h
index a24d675..11c4f15 100644
--- a/src/tracker-store/tracker-resources.h
+++ b/src/tracker-store/tracker-resources.h
@@ -48,7 +48,7 @@ struct TrackerResourcesClass {
 
 	void     (*writeback)                               (TrackerResources *resources,
 	                                                     GStrv subjects);
-	void     (*class_signal)                            (TrackerResources *resources,
+	void     (*graph_updated)                           (TrackerResources *resources,
 	                                                     const gchar      *classname,
 	                                                     GPtrArray        *deletes,
 	                                                     GPtrArray        *inserts);
diff --git a/tests/functional-tests/class-signal-performance-test.vala b/tests/functional-tests/class-signal-performance-test.vala
index 76e570d..02e2155 100644
--- a/tests/functional-tests/class-signal-performance-test.vala
+++ b/tests/functional-tests/class-signal-performance-test.vala
@@ -45,6 +45,7 @@ const string title_data = "title";
 
 
 struct Event {
+	int graph_id;
 	int subject_id;
 	int pred_id;
 	int object_id;
@@ -52,8 +53,8 @@ struct Event {
 
 [DBus (name = "org.freedesktop.Tracker1.Resources")]
 private interface Resources : GLib.Object {
-	[DBus (name = "ClassSignal")]
-	public signal void class_signal (string class_name, Event[] deletes, Event[] inserts);
+	[DBus (name = "GraphUpdated")]
+	public signal void graph_updated (string class_name, Event[] deletes, Event[] inserts);
 
 	[DBus (name = "SparqlUpdate")]
 	public abstract async void sparql_update_async (string query) throws Sparql.Error, DBus.Error;
@@ -86,17 +87,14 @@ public class TestApp {
 			                                                           "/org/freedesktop/Tracker1/Resources",
 			                                                           "org.freedesktop.Tracker1.Resources");
 
-			try {
-				class_object = (ResourcesClass) dbus_connection.get_object ("org.freedesktop.Tracker1",
-			                                                                "/org/freedesktop/Tracker1/Resources/Classes/nmm/MusicPiece",
-			                                                                "org.freedesktop.Tracker1.Resources.Class");
-			
-				class_object.subjects_added.connect (on_subjects_added);
-				class_object.subjects_changed.connect (on_subjects_changed);
-			} catch (GLib.Error e) {
-			}
+			class_object = (ResourcesClass) dbus_connection.get_object ("org.freedesktop.Tracker1",
+		                                                                "/org/freedesktop/Tracker1/Resources/Classes/nmm/MusicPiece",
+		                                                                "org.freedesktop.Tracker1.Resources.Class");
+
+			class_object.subjects_added.connect (on_subjects_added);
+			class_object.subjects_changed.connect (on_subjects_changed);
 
-			resources_object.class_signal.connect (on_class_signal_received);
+			resources_object.graph_updated.connect (on_graph_updated_received);
 			t = new GLib.Timer ();
 			
 		} catch (Sparql.Error e) {
@@ -127,7 +125,7 @@ public class TestApp {
 			print ("Old class signal count=%d time=%lf\n", count, t.elapsed ());
 	}
 
-	private void on_class_signal_received (string class_name, Event[] deletes, Event[] inserts) {
+	private void on_graph_updated_received (string class_name, Event[] deletes, Event[] inserts) {
 		foreach (Event insert in inserts)
 			count++;
 		//if (count == 20002)
diff --git a/tests/functional-tests/class-signal-test.vala b/tests/functional-tests/class-signal-test.vala
index 5affae3..7ab2126 100644
--- a/tests/functional-tests/class-signal-test.vala
+++ b/tests/functional-tests/class-signal-test.vala
@@ -33,8 +33,8 @@ struct Event {
 
 [DBus (name = "org.freedesktop.Tracker1.Resources")]
 private interface Resources : GLib.Object {
-	[DBus (name = "ClassSignal")]
-	public signal void class_signal (string class_name, Event[] deletes, Event[] inserts);
+	[DBus (name = "GraphUpdated")]
+	public signal void graph_updated (string class_name, Event[] deletes, Event[] inserts);
 
 	[DBus (name = "SparqlUpdate")]
 	public abstract async void sparql_update_async (string query) throws Sparql.Error, DBus.Error;
@@ -63,7 +63,7 @@ public class TestApp {
 			                                                           "/org/freedesktop/Tracker1/Resources",
 			                                                           "org.freedesktop.Tracker1.Resources");
 
-			resources_object.class_signal.connect (on_class_signal_received);
+			resources_object.graph_updated.connect (on_graph_updated_received);
 
 		} catch (Sparql.Error e) {
 			warning ("Could not connect to D-Bus service: %s", e.message);
@@ -125,7 +125,7 @@ public class TestApp {
 		return (0);
 	}
 
-	private async void on_class_signal_received_async (string dels_query, string ins_query) {
+	private async void on_graph_updated_received_async (string dels_query, string ins_query) {
 		try {
 			Sparql.Cursor cursor1, cursor2;
 
@@ -142,11 +142,11 @@ public class TestApp {
 		}
 	}
 
-	private void on_class_signal_received (string class_name, Event[] deletes, Event[] inserts) {
+	private void on_graph_updated_received (string class_name, Event[] deletes, Event[] inserts) {
 		string dels_qry = build_title_query (class_name, deletes).str;
 		string ins_qry = build_title_query (class_name, deletes).str;
 
-		on_class_signal_received_async (dels_qry, ins_qry);
+		on_graph_updated_received_async (dels_qry, ins_qry);
 	}
 
 	private void insert_data () {



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