[at-spi2-core] Remove the dbind and droute libraries.



commit 23b7cb9bd63b1a9c93b07a4451decdd7e14bf96d
Author: Mark Doffman <mark doffman codethink co uk>
Date:   Sat Nov 7 17:46:26 2009 +0000

    Remove the dbind and droute libraries.
    DBind and DRoute are now only used by at-spi2-atk so have become static libraries.

 .gitignore                             |    1 +
 Makefile.am                            |    2 +-
 README                                 |   16 -
 configure.ac                           |   39 +--
 dbind/Makefile.am                      |   24 --
 dbind/dbind-any.c                      |  553 -----------------------------
 dbind/dbind-any.h                      |   31 --
 dbind/dbind-config.h.in                |    8 -
 dbind/dbind.c                          |  230 ------------
 dbind/dbind.h                          |   46 ---
 dbind/dbtest.c                         |  403 ---------------------
 droute/Makefile.am                     |   33 --
 droute/droute-pairhash.c               |   87 -----
 droute/droute-pairhash.h               |   41 ---
 droute/droute-test.c                   |  243 -------------
 droute/droute-variant.c                |  118 -------
 droute/droute-variant.h                |   35 --
 droute/droute.c                        |  595 --------------------------------
 droute/droute.h                        |   95 -----
 droute/test.interface.One              |   15 -
 droute/test.interface.Two              |   15 -
 m4/dbind.m4                            |   43 ---
 pkgconfig/Makefile.am                  |    2 -
 pkgconfig/dbind-0.1-uninstalled.pc.in  |    8 -
 pkgconfig/dbind-0.1.pc.in              |   11 -
 pkgconfig/droute-0.1-uninstalled.pc.in |    8 -
 pkgconfig/droute-0.1.pc.in             |   11 -
 registryd/Makefile.am                  |    3 +-
 registryd/deviceeventcontroller.c      |  106 +++++--
 registryd/deviceeventcontroller.h      |    7 +-
 registryd/registry-main.c              |   10 +-
 registryd/registry.c                   |   58 +++-
 registryd/registry.h                   |    5 +-
 33 files changed, 133 insertions(+), 2769 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 9e5ccf3..e8ebeab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,4 @@ config.h.in~
 config
 configure
 xml/introspection/org.freedesktop.atspi.*
+m4/*.m4
diff --git a/Makefile.am b/Makefile.am
index f5f8edb..5565ece 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,3 @@
-SUBDIRS=pkgconfig xml tools dbind droute registryd
+SUBDIRS=xml tools registryd
 
 ACLOCAL_AMFLAGS=-I m4
diff --git a/README b/README
index b430d0a..d7c24ac 100644
--- a/README
+++ b/README
@@ -68,22 +68,6 @@ The directories within this package are arranged as follows:
         Miscellaneous tools. Mostly for converting protocol
         XML into D-Bus introspection, 'C' types and documentation.
 
-    droute
-
-        Contains a framework for registering objects
-        with a D-Bus connection and for routing messages to
-        the implementing object.
-
-        Used by the ATK adaptor.
-
-    dbind
-
-        Library to ease making D-Bus method calls, contains
-        marshalling code to convert function arguments
-        and a provided D-Bus signature into a D-Bus message.
-
-        Used by cspi.
-
     registryd
 
         The registry daemon code. The registry daemon
diff --git a/configure.ac b/configure.ac
index 438b531..fe7b473 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8,18 +8,6 @@ AT_SPI_CORE_MICRO_VERSION=1
 AT_SPI_CORE_VERSION="$AT_SPI_CORE_MAJOR_VERSION.$AT_SPI_CORE_MINOR_VERSION"
 AC_SUBST(AT_SPI_CORE_VERSION)
 
-DBIND_MAJOR_VERSION=0
-DBIND_MINOR_VERSION=1
-DBIND_MICRO_VERSION=1
-DBIND_VERSION="$DBIND_MAJOR_VERSION.$DBIND_MINOR_VERSION"
-AC_SUBST(DBIND_VERSION)
-
-DROUTE_MAJOR_VERSION=0
-DROUTE_MINOR_VERSION=1
-DROUTE_MICRO_VERSION=1
-DROUTE_VERSION="$DROUTE_MAJOR_VERSION.$DROUTE_MINOR_VERSION"
-AC_SUBST(DROUTE_VERSION) 
-
 LT_RELEASE=$AT_SPI_CORE_VERSION
 LT_CURRENT=0
 LT_REVISION=1
@@ -56,10 +44,6 @@ PKG_CHECK_MODULES(GOBJ, [gobject-2.0 >= 2.0.0])
 AC_SUBST(GOBJ_LIBS)
 AC_SUBST(GOBJ_CFLAGS)
 
-PKG_CHECK_MODULES(GMODULE, [gmodule-2.0 >= 2.0.0])	
-AC_SUBST(GMODULE_LIBS)
-AC_SUBST(GMODULE_CFLAGS)
-
 PKG_CHECK_MODULES(GDK, [gdk-2.0 >= 2.0.0])
 AC_SUBST(GDK_LIBS)
 AC_SUBST(GDK_CFLAGS)
@@ -136,32 +120,11 @@ else
 fi
 AC_SUBST(DBUS_SERVICES_DIR)
 
-dnl find sizes & alignments
-orig_CPPFLAGS=$CPPFLAGS
-CPPFLAGS="$CPPFLAGS $DBUS_CFLAGS"
-DBIND_CHECK_ALIGNOF(char)
-DBIND_CHECK_ALIGNOF(dbus_bool_t)
-DBIND_CHECK_ALIGNOF(dbus_int16_t)
-DBIND_CHECK_ALIGNOF(dbus_int32_t)
-DBIND_CHECK_ALIGNOF(dbus_int64_t)
-DBIND_CHECK_ALIGNOF(double)
-DBIND_CHECK_ALIGNOF(dbind_pointer)
-DBIND_CHECK_ALIGNOF(dbind_struct)
-CPPFLAGS=$orig_CPPFLAGS 
-
 AC_SUBST(LIBTOOL_EXPORT_OPTIONS)
 
 AC_CONFIG_FILES([Makefile
-                 pkgconfig/dbind-0.1.pc
-                 pkgconfig/dbind-0.1-uninstalled.pc
-                 pkgconfig/droute-0.1.pc
-                 pkgconfig/droute-0.1-uninstalled.pc
-                 pkgconfig/Makefile
 		 xml/Makefile
 		 tools/Makefile
-		 droute/Makefile
-		 registryd/Makefile
-		 dbind/Makefile
-		 dbind/dbind-config.h])
+		 registryd/Makefile])
 
 AC_OUTPUT
diff --git a/registryd/Makefile.am b/registryd/Makefile.am
index 15b7761..52820f6 100644
--- a/registryd/Makefile.am
+++ b/registryd/Makefile.am
@@ -14,8 +14,7 @@ at_spi2_registryd_LDADD = $(DBUS_GLIB_LIBS)	\
 			  $(X_LIBS)		\
 			  $(SM_LIBS)		\
 			  $(XTST_LIBS)		\
-			  $(XEVIE_LIBS)		\
-			  $(top_builddir)/droute/libdroute.la
+			  $(XEVIE_LIBS)
 
 at_spi2_registryd_SOURCES =	\
 	de-marshaller.h         \
diff --git a/registryd/deviceeventcontroller.c b/registryd/deviceeventcontroller.c
index 41ae97e..95c049c 100644
--- a/registryd/deviceeventcontroller.c
+++ b/registryd/deviceeventcontroller.c
@@ -52,7 +52,7 @@
 #include <gdk/gdkx.h> /* TODO: hide dependency (wrap in single porting file) */
 #include <gdk/gdkkeysyms.h>
 
-#include <droute/droute.h>
+#include <dbus/dbus.h>
 
 #include "paths.h"
 #include "keymasks.h"
@@ -166,6 +166,24 @@ static gboolean spi_dec_poll_mouse_idle (gpointer data);
 
 G_DEFINE_TYPE(SpiDEController, spi_device_event_controller, G_TYPE_OBJECT)
 
+DBusMessage *
+invalid_arguments_error (DBusMessage *message)
+{
+    DBusMessage *reply;
+    gchar       *errmsg;
+
+    errmsg= g_strdup_printf (
+            "Method \"%s\" with signature \"%s\" on interface \"%s\" was supplied with invalid arguments\n",
+            dbus_message_get_member (message),
+            dbus_message_get_signature (message),
+            dbus_message_get_interface (message));
+    reply = dbus_message_new_error (message,
+                                    DBUS_ERROR_INVALID_ARGS,
+                                    errmsg);
+    g_free (errmsg);
+    return reply;
+}
+
 /* Private methods */
 static dbus_bool_t
 spi_dbus_add_disconnect_match (DBusConnection *bus, const char *name)
@@ -1922,7 +1940,7 @@ impl_register_device_event_listener (DBusConnection *bus,
   dbus_error_init(&error);
   if (!dbus_message_get_args(message, &error, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_UINT32, &event_types, DBUS_TYPE_INVALID))
   {
-    return droute_invalid_arguments_error (message);
+    return invalid_arguments_error (message);
   }
   dec_listener = spi_dec_listener_new (dbus_message_get_sender(message), path, event_types);
   ret =  spi_controller_register_device_listener (
@@ -2112,7 +2130,7 @@ impl_deregister_device_event_listener (DBusConnection *bus,
   dbus_error_init(&error);
   if (!dbus_message_get_args(message, &error, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_UINT32, &event_types, DBUS_TYPE_INVALID))
   {
-    return droute_invalid_arguments_error (message);
+    return invalid_arguments_error (message);
   }
   listener = spi_dec_listener_new (dbus_message_get_sender(message), path, event_types);
   spi_controller_deregister_device_listener (
@@ -2423,7 +2441,7 @@ static DBusMessage * impl_generate_keyboard_event (DBusConnection *bus, DBusMess
   dbus_error_init(&error);
   if (!dbus_message_get_args(message, &error, DBUS_TYPE_INT32, &keycode, DBUS_TYPE_STRING, &keystring, DBUS_TYPE_UINT32, &synth_type, DBUS_TYPE_INVALID))
   {
-    return droute_invalid_arguments_error (message);
+    return invalid_arguments_error (message);
   }
 
 #ifdef SPI_DEBUG
@@ -2502,7 +2520,7 @@ static DBusMessage * impl_generate_mouse_event (DBusConnection *bus, DBusMessage
   dbus_error_init (&error);
   if (!dbus_message_get_args(message, &error, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, DBUS_TYPE_STRING, &eventName, DBUS_TYPE_INVALID))
   {
-    return droute_invalid_arguments_error (message);
+    return invalid_arguments_error (message);
   }
 
 #ifdef SPI_DEBUG
@@ -2574,7 +2592,7 @@ impl_notify_listeners_sync (DBusConnection *bus, DBusMessage *message, void *use
 
   if (!spi_dbus_demarshal_deviceEvent(message, &event))
   {
-    return droute_invalid_arguments_error (message);
+    return invalid_arguments_error (message);
   }
 #ifdef SPI_DEBUG
   g_print ("notifylistening listeners synchronously: controller %p, event id %d\n",
@@ -2601,7 +2619,7 @@ impl_notify_listeners_async (DBusConnection *bus, DBusMessage *message, void *us
 
   if (!spi_dbus_demarshal_deviceEvent(message, &event))
   {
-    return droute_invalid_arguments_error (message);
+    return invalid_arguments_error (message);
   }
 #ifdef SPI_DEBUG
   g_print ("notifylistening listeners asynchronously: controller %p, event id %d\n",
@@ -2759,39 +2777,71 @@ static void wait_for_release_event (XEvent          *event,
   check_release_handler = g_timeout_add (CHECK_RELEASE_DELAY, check_release, &pressed_event);
 }
 
-static DRouteMethod dev_methods[] =
+static DBusHandlerResult
+handle_dec_method (DBusConnection *bus, DBusMessage *message, void *user_data)
+{
+  const gchar *iface   = dbus_message_get_interface (message);
+  const gchar *member  = dbus_message_get_member (message);
+  const gint   type    = dbus_message_get_type (message);
+
+  DBusMessage *reply = NULL;
+
+  /* Check for basic reasons not to handle */
+  if (type   != DBUS_MESSAGE_TYPE_METHOD_CALL ||
+      member == NULL ||
+      iface  == NULL)
+      return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+  if (!strcmp (iface, SPI_DBUS_INTERFACE_DEC))
+      return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+  if      (!strcmp (member, "registerKeystrokeListener"))
+      reply = impl_register_keystroke_listener (bus, message, user_data);
+  else if (!strcmp (member, "registerDeviceEventListener"))
+      reply = impl_register_device_event_listener (bus, message, user_data);
+  else if (!strcmp (member, "deregisterKeystrokeListener"))
+      reply = impl_deregister_keystroke_listener (bus, message, user_data);
+  else if (!strcmp (member, "deregisterDeviceEventListener"))
+      reply = impl_deregister_device_event_listener (bus, message, user_data);
+  else if (!strcmp (member, "generateKeyboardEvent"))
+      reply = impl_generate_keyboard_event (bus, message, user_data);
+  else if (!strcmp (member, "generateMouseEvent"))
+      reply = impl_generate_mouse_event (bus, message, user_data);
+  else if (!strcmp (member, "notifyListenersSync"))
+      reply = impl_notify_listeners_sync (bus, message, user_data);
+  else if (!strcmp (member, "notifyListenersAsync"))
+      reply = impl_notify_listeners_async (bus, message, user_data);
+  else
+      return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+  if (!reply)
+    {
+      reply = dbus_message_new_method_return (message);
+    }
+  dbus_connection_send (bus, reply, NULL);
+  dbus_message_unref (reply);
+  
+  return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+static DBusObjectPathVTable dec_vtable =
 {
-  { impl_register_keystroke_listener, "registerKeystrokeListener" },
-  { impl_register_device_event_listener, "registerDeviceEventListener" },
-  { impl_deregister_keystroke_listener, "deregisterKeystrokeListener" },
-  { impl_deregister_device_event_listener, "deregisterDeviceEventListener" },
-  { impl_generate_keyboard_event, "generateKeyboardEvent" },
-  { impl_generate_mouse_event, "generateMouseEvent" },
-  { impl_notify_listeners_sync, "notifyListenersSync" },
-  { impl_notify_listeners_async, "notifyListenersAsync" },
-  { NULL, NULL }
+  NULL,
+  &handle_dec_method,
+  NULL, NULL, NULL, NULL
 };
 
 SpiDEController *
-spi_registry_dec_new (SpiRegistry *reg, DBusConnection *bus, DRouteContext *droute)
+spi_registry_dec_new (SpiRegistry *reg, DBusConnection *bus)
 {
   SpiDEController *dec = g_object_new (SPI_DEVICE_EVENT_CONTROLLER_TYPE, NULL);
-  DRoutePath *path;
 
   dec->registry = g_object_ref (reg);
   dec->bus = bus;
 
-  path = droute_add_one (droute,
-                         SPI_DBUS_PATH_DEC,
-                         dec);
-
-  droute_path_add_interface (path,
-                             SPI_DBUS_INTERFACE_DEC,
-                             dev_methods,
-                             NULL);
+  dbus_connection_register_object_path (bus, SPI_DBUS_PATH_DEC, &dec_vtable, dec);
 
   spi_dec_init_mouse_listener (dec);
-  /* TODO: kill mouse listener on finalize */
 
   return dec;
 }
diff --git a/registryd/deviceeventcontroller.h b/registryd/deviceeventcontroller.h
index e36c193..0e7c129 100644
--- a/registryd/deviceeventcontroller.h
+++ b/registryd/deviceeventcontroller.h
@@ -26,7 +26,7 @@
 
 #include <X11/Xlib.h>
 #include <gdk/gdk.h>
-#include <droute/droute.h>
+#include <dbus/dbus.h>
 
 typedef struct _SpiDEController SpiDEController;
 
@@ -57,15 +57,14 @@ typedef struct {
 
 GType            spi_device_event_controller_get_type (void);
 SpiDEController *spi_device_event_controller_new      (SpiRegistry    *registry,
-                                                       DBusConnection *bus,
-                                                       DRouteContext  *droute);
+                                                       DBusConnection *bus);
 
 void spi_device_event_controller_start_poll_mouse (SpiRegistry *registry);
 void spi_device_event_controller_stop_poll_mouse (void);
 
 void spi_remove_device_listeners (SpiDEController *controller, const char *bus_name);
 
-SpiDEController *spi_registry_dec_new (SpiRegistry *reg, DBusConnection *bus, DRouteContext *droute);
+SpiDEController *spi_registry_dec_new (SpiRegistry *reg, DBusConnection *bus);
 G_END_DECLS
 
 #endif /* DEVICEEVENTCONTROLLER_H_ */
diff --git a/registryd/registry-main.c b/registryd/registry-main.c
index a5dc5ba..5704903 100644
--- a/registryd/registry-main.c
+++ b/registryd/registry-main.c
@@ -26,7 +26,7 @@
 #include <string.h>
 #include <glib.h>
 
-#include <droute/droute.h>
+#include <dbus/dbus.h>
 
 #include "paths.h"
 #include "registry.h"
@@ -49,7 +49,6 @@ main (int argc, char **argv)
 {
   SpiRegistry *registry;
   SpiDEController *dec;
-  DRouteContext *droute;
   gchar *introspection_directory;
 
   GMainLoop *mainloop;
@@ -101,11 +100,8 @@ main (int argc, char **argv)
   if (introspection_directory == NULL)
       introspection_directory = ATSPI_INTROSPECTION_PATH;
 
-  /* Set up D-Route for use by the dec */
-  droute = droute_new (bus, introspection_directory);
-
-  registry = spi_registry_new (bus, droute);
-  dec = spi_registry_dec_new (registry, bus, droute);
+  registry = spi_registry_new (bus);
+  dec = spi_registry_dec_new (registry, bus);
 
   g_main_loop_run (mainloop);
   return 0;
diff --git a/registryd/registry.c b/registryd/registry.c
index 5d7b807..764e09f 100644
--- a/registryd/registry.c
+++ b/registryd/registry.c
@@ -247,33 +247,61 @@ signal_filter (DBusConnection *bus, DBusMessage *message, void *user_data)
 static gchar *app_sig_match_name_owner =
        "type='signal', interface='org.freedesktop.DBus', member='NameOwnerChanged'";
 
-static DRouteMethod dev_methods[] =
+static DBusHandlerResult
+handle_registry_method (DBusConnection *bus, DBusMessage *message, void *user_data)
+{
+  const gchar *iface   = dbus_message_get_interface (message);
+  const gchar *member  = dbus_message_get_member (message);
+  const gint   type    = dbus_message_get_type (message);
+
+  DBusMessage *reply = NULL;
+
+  /* Check for basic reasons not to handle */
+  if (type   != DBUS_MESSAGE_TYPE_METHOD_CALL ||
+      member == NULL ||
+      iface  == NULL)
+      return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+  if (!strcmp (iface, SPI_DBUS_INTERFACE_REGISTRY))
+      return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+  if      (!strcmp (member, "getApplications"))
+      reply = impl_getApplications (bus, message, user_data);
+  else if (!strcmp (member, "registerApplication"))
+      reply = impl_registerApplication (bus, message, user_data);
+  else if (!strcmp (member, "deregisterApplication"))
+      reply = impl_deregisterApplication (bus, message, user_data);
+  else
+      return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+  if (!reply)
+    {
+      reply = dbus_message_new_method_return (message);
+    }
+  dbus_connection_send (bus, reply, NULL);
+  dbus_message_unref (reply);
+  
+  return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+static DBusObjectPathVTable registry_vtable =
 {
-  { impl_getApplications, "getApplications" },
-  { impl_registerApplication, "registerApplication" },
-  { impl_deregisterApplication, "deregisterApplication" },
-  { NULL, NULL }
+  NULL,
+  &handle_registry_method,
+  NULL, NULL, NULL, NULL
 };
 
 SpiRegistry *
-spi_registry_new (DBusConnection *bus, DRouteContext *droute)
+spi_registry_new (DBusConnection *bus)
 {
   SpiRegistry *reg = g_object_new (SPI_REGISTRY_TYPE, NULL);
-  DRoutePath *path;
 
   reg->bus = bus;
 
   dbus_bus_add_match (bus, app_sig_match_name_owner, NULL);
   dbus_connection_add_filter (bus, signal_filter, reg, NULL);
 
-  path = droute_add_one (droute,
-                         SPI_DBUS_PATH_REGISTRY,
-                         reg);
-
-  droute_path_add_interface (path,
-                             SPI_DBUS_INTERFACE_REGISTRY,
-                             dev_methods,
-                             NULL);
+  dbus_connection_register_object_path (bus, SPI_DBUS_PATH_REGISTRY, &registry_vtable, reg);
 
   return reg;
 }
diff --git a/registryd/registry.h b/registryd/registry.h
index 68ec403..6d1be2a 100644
--- a/registryd/registry.h
+++ b/registryd/registry.h
@@ -27,7 +27,7 @@
 #include <glib.h>
 #include <glib-object.h>
 
-#include <droute/droute.h>
+#include <dbus/dbus.h>
 
 typedef struct _SpiRegistry SpiRegistry;
 typedef struct _SpiRegistryClass SpiRegistryClass;
@@ -52,8 +52,7 @@ struct _SpiRegistryClass {
 };
 
 GType        spi_registry_get_type (void);
-SpiRegistry *spi_registry_new      (DBusConnection *bus,
-                                    DRouteContext  *droute);
+SpiRegistry *spi_registry_new      (DBusConnection *bus);
 
 G_END_DECLS
 



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