Move GTK+ modules to their own source files
[platform/core/uifw/at-spi2-atk.git] / atk-adaptor / bridge.c
index faec393..6822a02 100644 (file)
@@ -36,7 +36,6 @@
 #include <atk/atk.h>
 
 #include <droute/droute.h>
-#include <gmodule.h>
 #include <atspi/atspi.h>
 
 #include "bridge.h"
@@ -60,62 +59,11 @@ SpiBridge *spi_global_app_data = NULL;
 
 /*---------------------------------------------------------------------------*/
 
-/*
- * Returns a 'canonicalized' value for DISPLAY,
- * with the screen number stripped off if present.
- *
- */
-static const gchar *
-spi_display_name (void)
-{
-  static const char *canonical_display_name = NULL;
-  if (!canonical_display_name)
-    {
-      const gchar *display_env = g_getenv ("AT_SPI_DISPLAY");
-      if (!display_env)
-        {
-          display_env = g_getenv ("DISPLAY");
-          if (!display_env || !display_env[0])
-            canonical_display_name = ":0";
-          else
-            {
-              gchar *display_p, *screen_p;
-              canonical_display_name = g_strdup (display_env);
-              display_p = strrchr (canonical_display_name, ':');
-              screen_p = strrchr (canonical_display_name, '.');
-              if (screen_p && display_p && (screen_p > display_p))
-                {
-                  *screen_p = '\0';
-                }
-            }
-        }
-      else
-        {
-          canonical_display_name = display_env;
-        }
-    }
-  return canonical_display_name;
-}
-
-/*---------------------------------------------------------------------------*/
-
-static void
-set_reply (DBusPendingCall *pending, void *user_data)
-{
-    void **replyptr = (void **)user_data;
-
-    *replyptr = dbus_pending_call_steal_reply (pending);
-  dbus_pending_call_unref (pending);
-}
-
-/*---------------------------------------------------------------------------*/
-
 static void
 add_event (const char *bus_name, const char *event)
 {
   event_data *evdata;
   gchar **data;
-  GList *new_list;
 
   spi_atk_add_client (bus_name);
   evdata = (event_data *) g_malloc (sizeof (*evdata));
@@ -129,9 +77,7 @@ add_event (const char *bus_name, const char *event)
     }
   evdata->bus_name = g_strdup (bus_name);
   evdata->data = data;
-  new_list = g_list_append (spi_global_app_data->events, evdata);
-  if (new_list)
-    spi_global_app_data->events = new_list;
+  spi_global_app_data->events = g_list_append (spi_global_app_data->events, evdata);
 }
 
 static GSList *clients = NULL;
@@ -282,7 +228,6 @@ register_reply (DBusPendingCall *pending, void *user_data)
 {
   DBusMessage *reply;
   SpiBridge *app = user_data;
-  DBusMessage *message;
 
   reply = dbus_pending_call_steal_reply (pending);
   dbus_pending_call_unref (pending);
@@ -320,7 +265,7 @@ register_reply (DBusPendingCall *pending, void *user_data)
 static gboolean
 register_application (SpiBridge * app)
 {
-  DBusMessage *message, *reply;
+  DBusMessage *message;
   DBusMessageIter iter;
   DBusError error;
   DBusPendingCall *pending;
@@ -563,8 +508,6 @@ user_check (DBusConnection *bus, unsigned long uid, void *data)
 static void
 new_connection_cb (DBusServer *server, DBusConnection *con, void *data)
 {
-  GList *new_list;
-
   dbus_connection_set_unix_user_function (con, user_check, NULL, NULL);
   dbus_connection_ref(con);
   atspi_dbus_connection_setup_with_g_main(con, NULL);
@@ -642,7 +585,6 @@ handle_event_listener_registered (DBusConnection *bus, DBusMessage *message,
 static void
 remove_events (const char *bus_name, const char *event)
 {
-  event_data *evdata;
   gchar **remove_data;
   GList *list;
 
@@ -678,7 +620,6 @@ static void
 handle_event_listener_deregistered (DBusConnection *bus, DBusMessage *message,
                                     void *user_data)
 {
-  const char *orig_name;
   gchar *name;
   char *sender;
 
@@ -769,14 +710,13 @@ signal_filter (DBusConnection *bus, DBusMessage *message, void *user_data)
  * - Application registration with the AT-SPI registry.
  *
  */
-static int
+int
 adaptor_init (gint * argc, gchar ** argv[])
 {
   GOptionContext *opt;
   GError *err = NULL;
   DBusError error;
   AtkObject *root;
-  gchar *introspection_directory;
   static gboolean inited = FALSE;
 
   if (inited)
@@ -911,46 +851,8 @@ adaptor_init (gint * argc, gchar ** argv[])
   return 0;
 }
 
-/*---------------------------------------------------------------------------*/
-
-int
-gtk_module_init (gint * argc, gchar ** argv[])
-{
-  const gchar *load_bridge = g_getenv ("NO_AT_BRIDGE");
-
-  if (!load_bridge || g_ascii_strtod (load_bridge, NULL) == 0)
-    {
-      return adaptor_init (argc, argv);
-    }
-  return 0;
-}
-
-gchar*
-g_module_check_init (GModule *module)
-{
-  g_module_make_resident (module);
-
-  return NULL;
-}
-
-void
-gnome_accessibility_module_init (void)
-{
-  const gchar *load_bridge = g_getenv ("NO_AT_BRIDGE");
-
-  if (!load_bridge || g_ascii_strtod (load_bridge, NULL) == 0)
-    {
-      adaptor_init (NULL, NULL);
-
-      if (g_getenv ("AT_SPI_DEBUG"))
-        {
-          g_print ("Atk Accessibility bridge initialized\n");
-        }
-    }
-}
-
 void
-gnome_accessibility_module_shutdown (void)
+adaptor_cleanup (void)
 {
   GList *l;
   GSList *ls;