Only query a relation set if it is non-NULL
[platform/core/uifw/at-spi2-atk.git] / atk-adaptor / accessible-cache.c
index 4f87b18..813d03f 100644 (file)
@@ -38,7 +38,7 @@ toplevel_added_listener (AtkObject * accessible,
                          guint index, AtkObject * child);
 
 static void
-remove_object (gpointer data, GObject * gobj);
+remove_object (GObject * source, GObject * gobj, gpointer data);
 
 static void
 add_object (SpiCache * cache, GObject * gobj);
@@ -149,12 +149,17 @@ spi_cache_dispose (GObject * object)
 /*---------------------------------------------------------------------------*/
 
 static void
-remove_object (gpointer data, GObject * gobj)
+remove_object (GObject * source, GObject * gobj, gpointer data)
 {
   SpiCache *cache = SPI_CACHE (data);
   
   if (spi_cache_in (cache, gobj))
     {
+#ifdef SPI_ATK_DEBUG
+  g_debug ("CACHE REM - %s - %d - %s\n", atk_object_get_name (ATK_OBJECT (gobj)),
+            atk_object_get_role (ATK_OBJECT (gobj)),
+            spi_register_object_to_path (spi_global_register, gobj));
+#endif
       g_signal_emit (cache, cache_signals [OBJECT_REMOVED], 0, gobj);
       g_hash_table_remove (cache->objects, gobj);
     }
@@ -167,6 +172,12 @@ add_object (SpiCache * cache, GObject * gobj)
 
   g_hash_table_insert (cache->objects, gobj, NULL);
 
+#ifdef SPI_ATK_DEBUG
+  g_debug ("CACHE ADD - %s - %d - %s\n", atk_object_get_name (ATK_OBJECT (gobj)),
+            atk_object_get_role (ATK_OBJECT (gobj)),
+            spi_register_object_to_path (spi_global_register, gobj));
+#endif
+
   g_signal_emit (cache, cache_signals [OBJECT_ADDED], 0, gobj);
 }
 
@@ -254,11 +265,6 @@ add_subtree (SpiCache *cache, AtkObject * accessible)
           if (!spi_cache_in (cache, G_OBJECT (current)) &&
               !atk_state_set_contains_state  (set, ATK_STATE_MANAGES_DESCENDANTS))
             {
-#ifdef SPI_ATK_DEBUG
-              g_debug ("REG  - %s - %d - %s", atk_object_get_name (current),
-                       atk_object_get_role (current),
-                       atk_dbus_object_to_path (current));
-#endif
               append_children (current, traversal);
             }
         }
@@ -311,7 +317,7 @@ child_added_listener (GSignalInvocationHint * signal_hint,
       if (signal_hint->detail)
         detail = g_quark_to_string (signal_hint->detail);
 
-      if (!strcmp (detail, "add"))
+      if (!g_strcmp0 (detail, "add"))
         {
           gpointer child;
           int index = g_value_get_uint (param_values + 1);
@@ -386,4 +392,20 @@ spi_cache_in (SpiCache * cache, GObject * object)
     return FALSE;
 }
 
+#ifdef SPI_ATK_DEBUG
+void
+spi_cache_print_info (GObject * obj)
+{
+  char * path = spi_register_object_to_path (spi_global_register, obj);
+  if (spi_cache_in (spi_global_cache, obj))
+      g_printf ("%s IC\n", path);
+  else
+      g_printf ("%s NC\n", path);
+
+  if (path)
+      g_free (path);
+}
+#endif
+
 /*END------------------------------------------------------------------------*/