[tracker/gdbus: 22/74] miners/fs: Remove unneeded old helper functions



commit 1acbf9253bfee841ad27373d1657e6062a52ff9b
Author: Philip Van Hoof <philip codeminded be>
Date:   Fri Dec 31 10:20:31 2010 +0100

    miners/fs: Remove unneeded old helper functions

 src/miners/fs/tracker-dbus.c |  172 ------------------------------------------
 src/miners/fs/tracker-dbus.h |    5 +-
 src/miners/fs/tracker-main.c |   24 ------
 3 files changed, 1 insertions(+), 200 deletions(-)
---
diff --git a/src/miners/fs/tracker-dbus.c b/src/miners/fs/tracker-dbus.c
index a63285e..818a212 100644
--- a/src/miners/fs/tracker-dbus.c
+++ b/src/miners/fs/tracker-dbus.c
@@ -22,175 +22,3 @@
 #include <libtracker-common/tracker-dbus.h>
 
 #include "tracker-dbus.h"
-#include "tracker-miner-files-index.h"
-
-static DBusGConnection *connection;
-static GSList          *objects;
-
-static gboolean
-dbus_register_service (DBusGProxy  *proxy,
-                       const gchar *name)
-{
-	GError *error = NULL;
-	guint   result;
-
-	g_message ("Registering D-Bus service...\n"
-	           "  Name:'%s'",
-	           name);
-
-	if (!org_freedesktop_DBus_request_name (proxy,
-	                                        name,
-	                                        DBUS_NAME_FLAG_DO_NOT_QUEUE,
-	                                        &result, &error)) {
-		g_critical ("Could not aquire name:'%s', %s",
-		            name,
-		            error ? error->message : "no error given");
-		g_error_free (error);
-
-		return FALSE;
-	}
-
-	if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
-		g_critical ("D-Bus service name:'%s' is already taken, "
-		            "perhaps the daemon is already running?",
-		            name);
-		return FALSE;
-	}
-
-	return TRUE;
-}
-
-/*
-static void
-dbus_register_object (DBusGConnection       *lconnection,
-                      DBusGProxy            *proxy,
-                      GObject               *object,
-                      const DBusGObjectInfo *info,
-                      const gchar           *path)
-{
-	g_message ("Registering D-Bus object...");
-	g_message ("  Path:'%s'", path);
-	g_message ("  Type:'%s'", G_OBJECT_TYPE_NAME (object));
-
-	dbus_g_object_type_install_info (G_OBJECT_TYPE (object), info);
-	dbus_g_connection_register_g_object (lconnection, path, object);
-}
-*/
-
-static gboolean
-dbus_register_names (void)
-{
-	GError *error = NULL;
-	DBusGProxy *gproxy;
-
-	if (connection) {
-		g_critical ("The DBusGConnection is already set, have we already initialized?");
-		return FALSE;
-	}
-
-	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
-
-	if (!connection) {
-		g_critical ("Could not connect to the D-Bus session bus, %s",
-		            error ? error->message : "no error given.");
-		g_clear_error (&error);
-		return FALSE;
-	}
-
-	/* The definitions below (DBUS_SERVICE_DBUS, etc) are
-	 * predefined for us to just use (dbus_g_proxy_...)
-	 */
-	gproxy = dbus_g_proxy_new_for_name (connection,
-	                                    DBUS_SERVICE_DBUS,
-	                                    DBUS_PATH_DBUS,
-	                                    DBUS_INTERFACE_DBUS);
-/*
-	* Register the service name for org.freedesktop.Tracker1.Miner.Files.Index *
-	if (!dbus_register_service (gproxy, TRACKER_MINER_FILES_INDEX_SERVICE)) {
-		g_object_unref (gproxy);
-		return FALSE;
-	}*/
-
-	g_object_unref (gproxy);
-
-	return TRUE;
-}
-
-gboolean
-tracker_dbus_init (void)
-{
-	/* Don't reinitialize */
-	if (objects) {
-		return TRUE;
-	}
-
-	/* Register names and get proxy/connection details */
-	if (!dbus_register_names ()) {
-		return FALSE;
-	}
-
-	return TRUE;
-}
-
-void
-tracker_dbus_shutdown (void)
-{
-	if (objects) {
-		g_slist_foreach (objects, (GFunc) g_object_unref, NULL);
-		g_slist_free (objects);
-		objects = NULL;
-	}
-
-	connection = NULL;
-}
-
-gboolean
-tracker_dbus_register_objects (gpointer object)
-{
-	DBusGProxy *gproxy;
-
-	g_return_val_if_fail (TRACKER_IS_MINER_FILES_INDEX (object), FALSE);
-
-	if (!connection) {
-		g_critical ("D-Bus support must be initialized before registering objects!");
-		return FALSE;
-	}
-
-	/* Add org.freedesktop.Tracker1.Extract */
-	if (!object) {
-		g_critical ("Could not create TrackerExtract object to register");
-		return FALSE;
-	}
-
-	gproxy = dbus_g_proxy_new_for_name (connection,
-	                                    DBUS_SERVICE_DBUS,
-	                                    DBUS_PATH_DBUS,
-	                                    DBUS_INTERFACE_DBUS);
-
-/*
-	dbus_register_object (connection,
-	                      gproxy,
-	                      G_OBJECT (object),
-	                      &dbus_glib_tracker_miner_files_index_object_info,
-	                      TRACKER_MINER_FILES_INDEX_PATH);
-	objects = g_slist_prepend (objects, object);
-*/
-
-	g_object_unref (gproxy);
-
-	return TRUE;
-}
-
-GObject *
-tracker_dbus_get_object (GType type)
-{
-	GSList *l;
-
-	for (l = objects; l; l = l->next) {
-		if (G_OBJECT_TYPE (l->data) == type) {
-			return l->data;
-		}
-	}
-
-	return NULL;
-}
diff --git a/src/miners/fs/tracker-dbus.h b/src/miners/fs/tracker-dbus.h
index 89fe775..c616911 100644
--- a/src/miners/fs/tracker-dbus.h
+++ b/src/miners/fs/tracker-dbus.h
@@ -26,10 +26,7 @@
 
 G_BEGIN_DECLS
 
-gboolean tracker_dbus_init             (void);
-void     tracker_dbus_shutdown         (void);
-gboolean tracker_dbus_register_objects (gpointer object);
-GObject *tracker_dbus_get_object       (GType    type);
+
 
 G_END_DECLS
 
diff --git a/src/miners/fs/tracker-main.c b/src/miners/fs/tracker-main.c
index 38cc3b8..ef389b7 100644
--- a/src/miners/fs/tracker-main.c
+++ b/src/miners/fs/tracker-main.c
@@ -600,16 +600,6 @@ main (gint argc, gchar *argv[])
 
 	sanity_check_option_values (config);
 
-	/* Make sure we initialize DBus, this shows we are started
-	 * successfully when called upon from the daemon.
-	 */
-	if (!tracker_dbus_init ()) {
-		g_object_unref (config);
-		tracker_log_shutdown ();
-
-		return EXIT_FAILURE;
-	}
-
 	main_loop = g_main_loop_new (NULL, FALSE);
 
 	miner_files = tracker_miner_files_new (config);
@@ -625,18 +615,6 @@ main (gint argc, gchar *argv[])
 	if (!object) {
 		g_object_unref (miner_files);
 		g_object_unref (config);
-		tracker_dbus_shutdown ();
-		tracker_log_shutdown ();
-
-		return EXIT_FAILURE;
-	}
-
-	/* Make Tracker available for introspection */
-	if (!tracker_dbus_register_objects (object)) {
-		g_object_unref (miner_files);
-		g_object_unref (object);
-		g_object_unref (config);
-		tracker_dbus_shutdown ();
 		tracker_log_shutdown ();
 
 		return EXIT_FAILURE;
@@ -669,8 +647,6 @@ main (gint argc, gchar *argv[])
 	g_slist_foreach (miners, (GFunc) finalize_miner, NULL);
 	g_slist_free (miners);
 
-	tracker_dbus_shutdown ();
-
 	tracker_log_shutdown ();
 
 	g_print ("\nOK\n\n");



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