at-bridge/Makefile.am: fixed LDFLAGS.
[platform/core/uifw/at-spi2-atk.git] / libspi / component.c
index 3c9ff9a..5e679d9 100644 (file)
@@ -62,7 +62,7 @@ accessibility_component_object_finalize (GObject *object)
         g_object_unref (component->atko);
        component->atko = NULL;
 
-        printf("atko freed, calling parent finalize\n");
+        printf("component atko freed, calling parent finalize\n");
         component_parent_class->finalize (object);
 }
 
@@ -77,10 +77,15 @@ impl_accessibility_component_contains (PortableServer_Servant servant,
                                        CORBA_Environment     *ev)
 {
   CORBA_boolean retval;
-  Component *component = COMPONENT (bonobo_object_from_servant (servant));
+  BonoboObject *obj;
+  Component *component;
+
+  obj = bonobo_object_from_servant (servant);
+  g_return_val_if_fail (IS_COMPONENT(obj), FALSE);
+  component = COMPONENT (obj);
+  g_return_val_if_fail (ATK_IS_COMPONENT(component->atko), FALSE);
   retval = atk_component_contains (ATK_COMPONENT (component->atko), (gint) x, (gint) y,
                                   (AtkCoordType) coord_type);
-  fprintf (stderr, "Component contains() called: %s\n", retval ? "true" : "false" );
   return retval;
 }
 
@@ -94,14 +99,21 @@ impl_accessibility_component_get_accessible_at_point (PortableServer_Servant ser
                                                       CORBA_short coord_type,
                                                       CORBA_Environment     *ev)
 {
+  BonoboObject *obj;
+  Component *component;
   Accessibility_Accessible retval;
-  Component *component = COMPONENT (bonobo_object_from_servant (servant));
   AtkObject *child;
+
+  obj = bonobo_object_from_servant (servant);
+  g_return_val_if_fail (IS_COMPONENT(obj), CORBA_OBJECT_NIL);
+  component = COMPONENT (obj);
+  g_return_val_if_fail (ATK_IS_COMPONENT(component->atko), CORBA_OBJECT_NIL);
+
   child = atk_component_ref_accessible_at_point (ATK_COMPONENT (component->atko),
                                                   (gint) x, (gint) y,
                                                   (AtkCoordType) coord_type);
   retval = bonobo_object_corba_objref (bonobo_object (accessible_new (child)));
-  return retval;
+  return CORBA_Object_duplicate (retval, ev);
 }
 
 /*
@@ -116,8 +128,15 @@ impl_accessibility_component_get_extents (PortableServer_Servant servant,
                                           const CORBA_short coord_type,
                                           CORBA_Environment     *ev)
 {
-  Component *component = COMPONENT (bonobo_object_from_servant (servant));
+  BonoboObject *obj;
+  Component *component;
   gint ix, iy, iw, ih;
+
+  obj = bonobo_object_from_servant (servant);
+  g_return_if_fail (IS_COMPONENT(obj));
+  component = COMPONENT (obj);
+  g_return_if_fail (ATK_IS_COMPONENT (component->atko));
+
   atk_component_get_extents (ATK_COMPONENT (component->atko), &ix, &iy, &iw, &ih,
                                   (AtkCoordType) coord_type);
   *x = (CORBA_long) ix;
@@ -136,8 +155,14 @@ impl_accessibility_component_get_position (PortableServer_Servant servant,
                                            const CORBA_short coord_type,
                                            CORBA_Environment     *ev)
 {
-  Component *component = COMPONENT (bonobo_object_from_servant (servant));
+  BonoboObject *obj = bonobo_object_from_servant (servant);
+  Component *component;
   gint ix, iy;
+
+  g_return_if_fail (IS_COMPONENT(obj));
+  component = COMPONENT(obj);
+  g_return_if_fail (ATK_IS_COMPONENT(component->atko));
+
   atk_component_get_position (ATK_COMPONENT (component->atko), &ix, &iy,
                               (AtkCoordType) coord_type);
   *x = (CORBA_long) ix;
@@ -153,8 +178,13 @@ impl_accessibility_component_get_size (PortableServer_Servant servant,
                                        CORBA_long * height,
                                        CORBA_Environment     *ev)
 {
-  Component *component = COMPONENT (bonobo_object_from_servant (servant));
+  Component *component;
+  BonoboObject *obj = bonobo_object_from_servant (servant);
   gint iw, ih;
+
+  g_return_if_fail (IS_COMPONENT(obj));
+  component = COMPONENT(obj);
+  g_return_if_fail (ATK_IS_COMPONENT(component->atko));
   atk_component_get_size (ATK_COMPONENT (component->atko), &iw, &ih);
   *width = (CORBA_long) iw;
   *height = (CORBA_long) ih;
@@ -223,5 +253,5 @@ component_interface_new (AtkObject *o)
                COMPONENT (g_object_new (accessibility_component_get_type (), NULL));
     retval->atko = o;
     g_object_ref (o);
-return retval;
+    return retval;
 }