[tracker] libtracker-common: Remove unused D-Bus request hook functionality
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-common: Remove unused D-Bus request hook functionality
- Date: Tue, 28 Dec 2010 08:37:42 +0000 (UTC)
commit 364e7cf4bbce0c328c9174aeffdd64246a5dda13
Author: Jürg Billeter <j bitron ch>
Date: Tue Dec 28 09:32:58 2010 +0100
libtracker-common: Remove unused D-Bus request hook functionality
src/libtracker-common/tracker-dbus.c | 93 ---------------------------
src/libtracker-common/tracker-dbus.h | 13 ----
src/tracker-store/tracker-statistics.c | 3 -
tests/libtracker-common/tracker-dbus-test.c | 77 ----------------------
4 files changed, 0 insertions(+), 186 deletions(-)
---
diff --git a/src/libtracker-common/tracker-dbus.c b/src/libtracker-common/tracker-dbus.c
index 181fb62..bedb350 100644
--- a/src/libtracker-common/tracker-dbus.c
+++ b/src/libtracker-common/tracker-dbus.c
@@ -33,12 +33,6 @@
*/
#define CLIENT_CLEAN_UP_TIME 300
-struct TrackerDBusRequestHandler {
- TrackerDBusRequestFunc new;
- TrackerDBusRequestFunc done;
- gpointer user_data;
-};
-
typedef struct {
gchar *sender;
gchar *binary;
@@ -57,9 +51,6 @@ typedef struct {
gboolean expect_variable_names;
} SendAndSpliceData;
-static GSList *hooks;
-static gboolean block_hooks;
-
static gboolean client_lookup_enabled;
static DBusGConnection *freedesktop_connection;
static DBusGProxy *freedesktop_proxy;
@@ -68,46 +59,6 @@ static GHashTable *clients;
static void client_data_free (gpointer data);
static gboolean client_clean_up_cb (gpointer data);
-static void
-request_handler_call_for_new (guint request_id)
-{
- GSList *l;
-
- if (block_hooks) {
- return;
- }
-
- for (l = hooks; l; l = l->next) {
- TrackerDBusRequestHandler *handler;
-
- handler = l->data;
-
- if (handler->new) {
- (handler->new)(request_id, handler->user_data);
- }
- }
-}
-
-static void
-request_handler_call_for_done (guint request_id)
-{
- GSList *l;
-
- if (block_hooks) {
- return;
- }
-
- for (l = hooks; l; l = l->next) {
- TrackerDBusRequestHandler *handler;
-
- handler = l->data;
-
- if (handler->done) {
- (handler->done)(request_id, handler->user_data);
- }
- }
-}
-
static gboolean
clients_init (void)
{
@@ -339,32 +290,6 @@ tracker_dbus_get_next_request_id (void)
return request_id++;
}
-TrackerDBusRequestHandler *
-tracker_dbus_request_add_hook (TrackerDBusRequestFunc new,
- TrackerDBusRequestFunc done,
- gpointer user_data)
-{
- TrackerDBusRequestHandler *handler;
-
- handler = g_slice_new0 (TrackerDBusRequestHandler);
- handler->new = new;
- handler->done = done;
- handler->user_data = user_data;
-
- hooks = g_slist_append (hooks, handler);
-
- return handler;
-}
-
-void
-tracker_dbus_request_remove_hook (TrackerDBusRequestHandler *handler)
-{
- g_return_if_fail (handler != NULL);
-
- hooks = g_slist_remove (hooks, handler);
- g_slice_free (TrackerDBusRequestHandler, handler);
-}
-
void
tracker_dbus_request_new (gint request_id,
DBusGMethodInvocation *context,
@@ -389,8 +314,6 @@ tracker_dbus_request_new (gint request_id,
str);
g_free (str);
-
- request_handler_call_for_new (request_id);
}
void
@@ -399,8 +322,6 @@ tracker_dbus_request_success (gint request_id,
{
ClientData *cd;
- request_handler_call_for_done (request_id);
-
cd = client_get_for_context (context);
g_debug ("---> [%d%s%s|%lu] Success, no error given",
@@ -421,8 +342,6 @@ tracker_dbus_request_failed (gint request_id,
gchar *str;
va_list args;
- request_handler_call_for_done (request_id);
-
if (format) {
va_start (args, format);
str = g_strdup_vprintf (format, args);
@@ -523,18 +442,6 @@ tracker_dbus_request_debug (gint request_id,
}
void
-tracker_dbus_request_block_hooks (void)
-{
- block_hooks = TRUE;
-}
-
-void
-tracker_dbus_request_unblock_hooks (void)
-{
- block_hooks = FALSE;
-}
-
-void
tracker_dbus_enable_client_lookup (gboolean enabled)
{
/* If this changed and we disabled everything, simply shut it
diff --git a/src/libtracker-common/tracker-dbus.h b/src/libtracker-common/tracker-dbus.h
index e2e8159..50b70f5 100644
--- a/src/libtracker-common/tracker-dbus.h
+++ b/src/libtracker-common/tracker-dbus.h
@@ -98,11 +98,6 @@ G_BEGIN_DECLS
#define TRACKER_DBUS_PATH_EXTRACT "/org/freedesktop/Tracker1/Extract"
#define TRACKER_DBUS_INTERFACE_EXTRACT "org.freedesktop.Tracker1.Extract"
-typedef struct TrackerDBusRequestHandler TrackerDBusRequestHandler;
-
-typedef void (*TrackerDBusRequestFunc) (guint request_id,
- gpointer user_data);
-
typedef void (*TrackerDBusSendAndSpliceCallback) (void *buffer,
gssize buffer_size,
GStrv variable_names,
@@ -129,12 +124,6 @@ gchar ** tracker_dbus_slist_to_strv (GSList
/* Requests */
guint tracker_dbus_get_next_request_id (void);
-TrackerDBusRequestHandler *
- tracker_dbus_request_add_hook (TrackerDBusRequestFunc new,
- TrackerDBusRequestFunc done,
- gpointer user_data);
-void tracker_dbus_request_remove_hook (TrackerDBusRequestHandler *handler);
-
void tracker_dbus_request_new (gint request_id,
DBusGMethodInvocation *context,
const gchar *format,
@@ -158,8 +147,6 @@ void tracker_dbus_request_debug (gint
DBusGMethodInvocation *context,
const gchar *format,
...);
-void tracker_dbus_request_block_hooks (void);
-void tracker_dbus_request_unblock_hooks (void);
void tracker_dbus_enable_client_lookup (gboolean enable);
diff --git a/src/tracker-store/tracker-statistics.c b/src/tracker-store/tracker-statistics.c
index 0829e90..4080acd 100644
--- a/src/tracker-store/tracker-statistics.c
+++ b/src/tracker-store/tracker-statistics.c
@@ -81,7 +81,6 @@ tracker_statistics_get (TrackerStatistics *object,
request_id = tracker_dbus_get_next_request_id ();
- tracker_dbus_request_block_hooks ();
tracker_dbus_request_new (request_id, context, "%s()", __FUNCTION__);
values = g_ptr_array_new ();
@@ -114,6 +113,4 @@ tracker_statistics_get (TrackerStatistics *object,
g_ptr_array_foreach (values, (GFunc) g_strfreev, NULL);
g_ptr_array_free (values, TRUE);
-
- tracker_dbus_request_unblock_hooks ();
}
diff --git a/tests/libtracker-common/tracker-dbus-test.c b/tests/libtracker-common/tracker-dbus-test.c
index de2f0cb..c34c2bb 100644
--- a/tests/libtracker-common/tracker-dbus-test.c
+++ b/tests/libtracker-common/tracker-dbus-test.c
@@ -299,81 +299,6 @@ test_dbus_request_failed_coverage ()
g_test_trap_assert_passed ();
}
-static gint hook_new_called = 0;
-static gint hook_done_called = 0;
-
-static void
-hook_test_new_request (guint request_id,
- gpointer user_data)
-{
- hook_new_called += 1;
-}
-
-static void
-hook_test_done_request (guint request_id,
- gpointer user_data)
-{
- hook_done_called += 1;
-}
-
-static void
-test_dbus_hooks ()
-{
- gint request_id;
- DBusGMethodInvocation *context = (DBusGMethodInvocation *)g_strdup ("aaa");
- TrackerDBusRequestHandler *handler;
-
- tracker_dbus_request_unblock_hooks ();
-
- handler = tracker_dbus_request_add_hook (hook_test_new_request,
- hook_test_done_request,
- NULL);
- g_assert (hook_new_called == 0 && hook_done_called == 0);
-
- request_id = tracker_dbus_get_next_request_id ();
- tracker_dbus_request_new (request_id, context, "Test Message. Is OK");
-
- g_assert_cmpint (hook_new_called, ==, 1);
- g_assert_cmpint (hook_done_called, ==, 0);
-
- tracker_dbus_request_success (request_id, context);
- g_assert_cmpint (hook_new_called, ==, 1);
- g_assert_cmpint (hook_done_called, ==, 1);
-
- tracker_dbus_request_failed (request_id, context, NULL, "Test Message. Is OK");
- g_assert_cmpint (hook_new_called, ==, 1);
- g_assert_cmpint (hook_done_called, ==, 2);
-
- /* Block the hooks and check that the callbacks are not invoked */
- tracker_dbus_request_block_hooks ();
-
- request_id = tracker_dbus_get_next_request_id ();
- tracker_dbus_request_new (request_id, context, "Test Message. Is OK");
- g_assert_cmpint (hook_new_called, ==, 1);
- g_assert_cmpint (hook_done_called, ==, 2);
-
- tracker_dbus_request_success (request_id, context);
- g_assert_cmpint (hook_new_called, ==, 1);
- g_assert_cmpint (hook_done_called, ==, 2);
-
- tracker_dbus_request_failed (request_id, context, NULL, "Test Message. Is OK");
- g_assert_cmpint (hook_new_called, ==, 1);
- g_assert_cmpint (hook_done_called, ==, 2);
-
- /* Unlock, but remove the hooks */
- tracker_dbus_request_unblock_hooks ();
- tracker_dbus_request_remove_hook (handler);
-
- request_id = tracker_dbus_get_next_request_id ();
- tracker_dbus_request_new (request_id, context, "Test Message. Is OK");
- g_assert_cmpint (hook_new_called, ==, 1);
- g_assert_cmpint (hook_done_called, ==, 2);
-
- tracker_dbus_request_failed (request_id, context, NULL, "Test Message. Is OK");
- g_assert_cmpint (hook_new_called, ==, 1);
- g_assert_cmpint (hook_done_called, ==, 2);
-}
-
int
main (int argc, char **argv) {
@@ -399,8 +324,6 @@ main (int argc, char **argv) {
test_dbus_request_failed);
g_test_add_func ("/libtracker-common/tracker-dbus/request_failed_coverage",
test_dbus_request_failed_coverage);
- g_test_add_func ("/libtracker-common/tracker-dbus/hooks",
- test_dbus_hooks);
result = g_test_run ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]