Do not ignore count for getMatchesTo
[platform/core/uifw/at-spi2-atk.git] / atk-adaptor / bridge.c
index 45bc15f..489f1b1 100644 (file)
@@ -158,7 +158,7 @@ spi_atk_bridge_get_bus (void)
 
 /*---------------------------------------------------------------------------*/
 
-static void
+static gboolean
 register_application (SpiBridge * app)
 {
   DBusMessage *message, *reply;
@@ -188,12 +188,21 @@ register_application (SpiBridge * app)
       dbus_message_iter_init (reply, &iter);
       dbus_message_iter_recurse (&iter, &iter_struct);
       if (!(dbus_message_iter_get_arg_type (&iter_struct) == DBUS_TYPE_STRING))
-            g_error ("AT-SPI: Could not obtain desktop path or name\n");
+        {
+          g_warning ("AT-SPI: Could not obtain desktop path or name\n");
+          return FALSE;
+        }
       dbus_message_iter_get_basic (&iter_struct, &app_name);
       if (!dbus_message_iter_next (&iter_struct))
-            g_error ("AT-SPI: Could not obtain desktop name");
+        {
+          g_warning ("AT-SPI: Could not obtain desktop name");
+          return FALSE;
+        }
       if (!(dbus_message_iter_get_arg_type (&iter_struct) == DBUS_TYPE_OBJECT_PATH))
-            g_error ("AT-SPI: Could not obtain desktop path");
+        {
+          g_warning ("AT-SPI: Could not obtain desktop path");
+          return FALSE;
+        }
       dbus_message_iter_get_basic (&iter_struct, &obj_path);
 
       app->desktop_name = g_strdup (app_name);
@@ -201,9 +210,10 @@ register_application (SpiBridge * app)
     }
   else
     {
-      g_error ("AT-SPI: Could not embed inside desktop: %s\n", error.message);
+      g_warning ("AT-SPI: Could not embed inside desktop: %s\n", error.message);
+      return FALSE;
     }
-
+  return TRUE;
 }
 
 /*---------------------------------------------------------------------------*/
@@ -295,7 +305,7 @@ socket_embed_hook (AtkSocket * socket, gchar * plug_id)
     {
       DBusMessage *message;
       *(plug_path++) = '\0';
-      message = dbus_message_new_method_call (plug_name, plug_path, "org.a11y.atspi.Accessible", "Embedded");
+      message = dbus_message_new_method_call (plug_name, plug_path, SPI_DBUS_INTERFACE_SOCKET, "Embedded");
       dbus_message_append_args (message, DBUS_TYPE_STRING, &path, DBUS_TYPE_INVALID);
       dbus_connection_send (spi_global_app_data->bus, message, NULL);
     }
@@ -414,6 +424,12 @@ adaptor_init (gint * argc, gchar ** argv[])
   treepath = droute_add_one (spi_global_app_data->droute,
                              "/org/at_spi/cache", spi_global_cache);
 
+  if (!treepath)
+    {
+      g_warning ("atk-bridge: Error in droute_add_one().  Already running?");
+      return 0;
+    }
+
   accpath = droute_add_many (spi_global_app_data->droute,
                              "/org/a11y/atspi/accessible",
                              NULL,
@@ -434,6 +450,7 @@ adaptor_init (gint * argc, gchar ** argv[])
   spi_initialize_hypertext (accpath);
   spi_initialize_image (accpath);
   spi_initialize_selection (accpath);
+  spi_initialize_socket (accpath);
   spi_initialize_table (accpath);
   spi_initialize_text (accpath);
   spi_initialize_value (accpath);
@@ -445,7 +462,7 @@ adaptor_init (gint * argc, gchar ** argv[])
   install_plug_hooks ();
 
   /* Register this app by sending a signal out to AT-SPI registry daemon */
-  if (!atspi_no_register)
+  if (!atspi_no_register && (!root || !ATK_IS_PLUG (root)))
     register_application (spi_global_app_data);
 
   g_atexit (exit_func);