[tracker/class-signal: 4/61] tracker-store, data/dbus: Remove unused TrackerResourceClass



commit 225901c3d6a31fc4465f714b45a7e677d0e7f528
Author: Philip Van Hoof <philip codeminded be>
Date:   Tue Aug 17 15:45:17 2010 +0200

    tracker-store, data/dbus: Remove unused TrackerResourceClass

 data/dbus/Makefile.am                      |    1 -
 data/dbus/tracker-resources-class.xml      |   26 ---
 src/tracker-store/Makefile.am              |    3 -
 src/tracker-store/tracker-dbus.c           |   94 +--------
 src/tracker-store/tracker-dbus.h           |    2 +-
 src/tracker-store/tracker-events.c         |    8 +
 src/tracker-store/tracker-main.c           |    2 +-
 src/tracker-store/tracker-resource-class.c |  332 ----------------------------
 src/tracker-store/tracker-resource-class.h |   69 ------
 src/tracker-store/tracker-resources.c      |   24 +--
 src/tracker-store/tracker-resources.h      |    3 +-
 11 files changed, 17 insertions(+), 547 deletions(-)
---
diff --git a/data/dbus/Makefile.am b/data/dbus/Makefile.am
index d715974..d5d58f3 100644
--- a/data/dbus/Makefile.am
+++ b/data/dbus/Makefile.am
@@ -8,7 +8,6 @@ config_DATA =							\
 	tracker-miner.xml					\
 	tracker-miner-web.xml					\
 	tracker-resources.xml					\
-	tracker-resources-class.xml				\
 	tracker-statistics.xml					\
 	tracker-writeback.xml					\
 	tracker-status.xml
diff --git a/src/tracker-store/Makefile.am b/src/tracker-store/Makefile.am
index a3131c5..a1549ee 100644
--- a/src/tracker-store/Makefile.am
+++ b/src/tracker-store/Makefile.am
@@ -44,8 +44,6 @@ tracker_store_SOURCES =							\
 	tracker-main.c							\
 	tracker-resources.c						\
 	tracker-resources.h						\
-	tracker-resource-class.c					\
-	tracker-resource-class.h					\
 	tracker-statistics.c						\
 	tracker-statistics.h						\
 	tracker-store.c							\
@@ -86,7 +84,6 @@ dbus_sources = 								\
 	tracker-backup-glue.h						\
 	tracker-resources-glue.h					\
 	tracker-statistics-glue.h					\
-	tracker-resources-class-glue.h					\
 	tracker-status-glue.h
 
 tracker-marshal.h: tracker-marshal.list
diff --git a/src/tracker-store/tracker-dbus.c b/src/tracker-store/tracker-dbus.c
index c047967..fdc9d1b 100644
--- a/src/tracker-store/tracker-dbus.c
+++ b/src/tracker-store/tracker-dbus.c
@@ -32,8 +32,6 @@
 #include "tracker-dbus.h"
 #include "tracker-resources.h"
 #include "tracker-resources-glue.h"
-#include "tracker-resource-class.h"
-#include "tracker-resources-class-glue.h"
 #include "tracker-status.h"
 #include "tracker-status-glue.h"
 #include "tracker-statistics.h"
@@ -348,102 +346,18 @@ tracker_dbus_register_objects (void)
 }
 
 gboolean
-tracker_dbus_register_class_signal_objects (void)
+tracker_dbus_register_prepare_class_signal (void)
 {
-	TrackerDBResultSet *result_set;
-	GSList *event_sources = NULL;
-	GStrv classes, p;
-	gpointer object, resources;
+	gpointer resources;
 
 	resources = tracker_dbus_get_object (TRACKER_TYPE_RESOURCES);
 
 	if (!resources) {
 		g_message ("Error during initialization, Resources DBus object not available");
-		return TRUE;
-	}
-
-	result_set = tracker_data_query_sparql ("SELECT ?class WHERE { ?class tracker:notify true }", NULL);
-
-	if (!result_set) {
-		g_message ("No Nepomuk classes to register on D-Bus");
-		return TRUE;
-	}
-
-	classes = tracker_dbus_query_result_to_strv (result_set, 0, NULL);
-	g_object_unref (result_set);
-
-	if (!classes) {
-		g_message ("No Nepomuk classes to register on D-Bus");
-		return TRUE;
-	}
-
-	for (p = classes; *p; p++) {
-		TrackerNamespace *namespace;
-		const gchar *rdf_class;
-		gchar *namespace_uri;
-		gchar *replaced, *path, *hash;
-
-		rdf_class = *p;
-		hash = strrchr (rdf_class, '#');
-
-		if (!hash) {
-			/* Support ontologies whose namespace
-			 * uri does not end in a hash, e.g.
-			 * dc.
-			 */
-			hash = strrchr (rdf_class, '/');
-		}
-
-		if (!hash) {
-			g_critical ("Unknown namespace for class:'%s'",
-			            rdf_class);
-			continue;
-		}
-
-		namespace_uri = g_strndup (rdf_class, hash - rdf_class + 1);
-		namespace = tracker_ontologies_get_namespace_by_uri (namespace_uri);
-		g_free (namespace_uri);
-
-		if (!namespace) {
-			g_critical ("Unknown namespace:'%s' for class:'%s'",
-			            namespace_uri,
-			            rdf_class);
-			continue;
-		}
-
-		replaced = g_strdup_printf ("%s/%s",
-		                            tracker_namespace_get_prefix (namespace),
-		                            hash + 1);
-		path = g_strdup_printf (TRACKER_RESOURCES_CLASS_PATH,
-		                        replaced);
-		g_free (replaced);
-
-		/* Add a org.freedesktop.Tracker1.Resources.Class */
-		object = tracker_resource_class_new (rdf_class, path, connection);
-		if (!object) {
-			g_critical ("Could not create TrackerResourcesClass object to register:'%s' class",
-			            rdf_class);
-			g_free (path);
-			return FALSE;
-		}
-
-		dbus_register_object (connection,
-		                      gproxy,
-		                      G_OBJECT (object),
-		                      &dbus_glib_tracker_resources_class_object_info,
-		                      path);
-		g_free (path);
-
-		/* TrackerResources takes over ownership and unrefs
-		 * the gobjects too.
-		 */
-		event_sources = g_slist_prepend (event_sources, g_object_ref (object));
-		objects = g_slist_prepend (objects, object);
+		return FALSE;
 	}
 
-	g_strfreev (classes);
-
-	tracker_resources_prepare (resources, event_sources);
+	tracker_resources_prepare (resources);
 
 	return TRUE;
 }
diff --git a/src/tracker-store/tracker-dbus.h b/src/tracker-store/tracker-dbus.h
index b5007b6..541b9e3 100644
--- a/src/tracker-store/tracker-dbus.h
+++ b/src/tracker-store/tracker-dbus.h
@@ -35,7 +35,7 @@ gboolean        tracker_dbus_register_objects              (void);
 GObject        *tracker_dbus_get_object                    (GType type);
 TrackerStatus  *tracker_dbus_register_notifier             (void);
 gboolean        tracker_dbus_register_names                (void);
-gboolean        tracker_dbus_register_class_signal_objects (void);
+gboolean        tracker_dbus_register_prepare_class_signal (void);
 
 G_END_DECLS
 
diff --git a/src/tracker-store/tracker-events.c b/src/tracker-store/tracker-events.c
index e577469..f1a7108 100644
--- a/src/tracker-store/tracker-events.c
+++ b/src/tracker-store/tracker-events.c
@@ -32,10 +32,12 @@ typedef struct {
 	struct {
 		GArray *sub_pred_ids;
 		GArray *object_ids;
+		GArray *class_ids;
 	} deletes;
 	struct {
 		GArray *sub_pred_ids;
 		GArray *object_ids;
+		GArray *class_ids;
 	} inserts;
 	gboolean frozen;
 } EventsPrivate;
@@ -236,8 +238,11 @@ tracker_events_reset (void)
 
 	g_array_set_size (private->deletes.sub_pred_ids, 0);
 	g_array_set_size (private->deletes.object_ids, 0);
+	g_array_set_size (private->deletes.class_ids, 0);
+
 	g_array_set_size (private->inserts.sub_pred_ids, 0);
 	g_array_set_size (private->inserts.object_ids, 0);
+	g_array_set_size (private->inserts.class_ids, 0);
 
 	private->frozen = FALSE;
 }
@@ -257,8 +262,11 @@ free_private (EventsPrivate *private)
 	g_hash_table_unref (private->allowances_id);
 	g_array_free (private->deletes.sub_pred_ids, TRUE);
 	g_array_free (private->deletes.object_ids, TRUE);
+	g_array_free (private->deletes.class_ids, TRUE);
+
 	g_array_free (private->inserts.sub_pred_ids, TRUE);
 	g_array_free (private->inserts.object_ids, TRUE);
+	g_array_free (private->inserts.class_ids, TRUE);
 	g_free (private);
 }
 
diff --git a/src/tracker-store/tracker-main.c b/src/tracker-store/tracker-main.c
index c4fd5d1..6059b4b 100644
--- a/src/tracker-store/tracker-main.c
+++ b/src/tracker-store/tracker-main.c
@@ -494,7 +494,7 @@ main (gint argc, gchar *argv[])
 		goto shutdown;
 	}
 
-	tracker_dbus_register_class_signal_objects ();
+	tracker_dbus_register_prepare_class_signal ();
 
 	tracker_events_init (get_notifiable_classes);
 	tracker_writeback_init (get_writeback_predicates);
diff --git a/src/tracker-store/tracker-resources.c b/src/tracker-store/tracker-resources.c
index a3489d7..a5f0461 100644
--- a/src/tracker-store/tracker-resources.c
+++ b/src/tracker-store/tracker-resources.c
@@ -37,7 +37,6 @@
 #include "tracker-dbus.h"
 #include "tracker-marshal.h"
 #include "tracker-resources.h"
-#include "tracker-resource-class.h"
 #include "tracker-events.h"
 #include "tracker-writeback.h"
 #include "tracker-store.h"
@@ -80,7 +79,7 @@ enum {
 };
 
 typedef struct {
-	GSList *event_sources;
+	gboolean nothing;
 } TrackerResourcesPrivate;
 
 typedef struct {
@@ -100,18 +99,6 @@ static void tracker_resources_finalize (GObject *object);
 static guint signals[LAST_SIGNAL] = { 0 };
 
 static void
-free_event_sources (TrackerResourcesPrivate *priv)
-{
-	if (priv->event_sources) {
-		g_slist_foreach (priv->event_sources,
-		                 (GFunc) g_object_unref, NULL);
-		g_slist_free (priv->event_sources);
-
-		priv->event_sources = NULL;
-	}
-}
-
-static void
 tracker_resources_class_init (TrackerResourcesClass *klass)
 {
 	GObjectClass *object_class;
@@ -632,21 +619,16 @@ on_statement_deleted (gint         graph_id,
 }
 
 void
-tracker_resources_prepare (TrackerResources *object,
-                           GSList           *event_sources)
+tracker_resources_prepare (TrackerResources *object)
 {
 	TrackerResourcesPrivate *priv;
 
 	priv = TRACKER_RESOURCES_GET_PRIVATE (object);
 
-	free_event_sources (priv);
-
 	tracker_data_add_insert_statement_callback (on_statement_inserted, object);
 	tracker_data_add_delete_statement_callback (on_statement_deleted, object);
 	tracker_data_add_commit_statement_callback (on_statements_committed, object);
 	tracker_data_add_rollback_statement_callback (on_statements_rolled_back, object);
-
-	priv->event_sources = event_sources;
 }
 
 static void
@@ -661,8 +643,6 @@ tracker_resources_finalize (GObject      *object)
 	tracker_data_remove_commit_statement_callback (on_statements_committed, object);
 	tracker_data_remove_rollback_statement_callback (on_statements_rolled_back, object);
 
-	free_event_sources (priv);
-
 	G_OBJECT_CLASS (tracker_resources_parent_class)->finalize (object);
 }
 
diff --git a/src/tracker-store/tracker-resources.h b/src/tracker-store/tracker-resources.h
index e917501..2148c7e 100644
--- a/src/tracker-store/tracker-resources.h
+++ b/src/tracker-store/tracker-resources.h
@@ -52,8 +52,7 @@ struct TrackerResourcesClass {
 
 GType             tracker_resources_get_type            (void);
 TrackerResources *tracker_resources_new                 (void);
-void              tracker_resources_prepare             (TrackerResources       *object,
-                                                         GSList                 *event_sources);
+void              tracker_resources_prepare             (TrackerResources       *object);
 void              tracker_resources_unprepare           (TrackerResources       *object);
 
 void              tracker_resources_unreg_batches       (TrackerResources       *object,



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