/* ATK - Accessibility Toolkit
- * Copyright 2001 Sun Microsystems Inc.
+ * Copyright 2001, 2002, 2003 Sun Microsystems Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* Boston, MA 02111-1307, USA.
*/
+#include "config.h"
+
#include <atk/atkgobjectaccessible.h>
+#include <atk/atkregistry.h>
+#include <atk/atkutil.h>
+/**
+ * SECTION:atkgobjectaccessible
+ * @Short_description: This object class is derived from AtkObject and
+ * can be used as a basis implementing accessible objects.
+ * @Title:AtkGObjectAccessible
+ *
+ * This object class is derived from AtkObject. It can be used as a
+ * basis for implementing accessible objects for GObjects which are
+ * not derived from GtkWidget. One example of its use is in providing
+ * an accessible object for GnomeCanvasItem in the GAIL library.
+ */
static void atk_gobject_accessible_class_init (AtkGObjectAccessibleClass *klass);
static void atk_real_gobject_accessible_initialize (AtkObject *atk_obj,
gpointer data);
*
* Gets the accessible object for the specified @obj.
*
- * Returns: a #AtkObject which is the accessible object for the @obj
+ * Returns: (transfer none): a #AtkObject which is the accessible object for
+ * the @obj
**/
AtkObject*
atk_gobject_accessible_for_object (GObject *obj)
G_OBJECT_TYPE (obj));
accessible = atk_object_factory_create_accessible (factory,
obj);
- if (!quark_accessible_object)
+ if (!ATK_IS_GOBJECT_ACCESSIBLE (accessible))
{
/*
* The AtkObject which was created was not a AtkGObjectAccessible
*/
- quark_accessible_object = g_quark_from_static_string ("accessible-object");
g_object_weak_ref (obj,
(GWeakNotify) g_object_unref,
accessible);
+ if (!quark_accessible_object)
+ quark_accessible_object = g_quark_from_static_string ("accessible-object");
}
g_object_set_qdata (obj, quark_accessible_object, accessible);
}
/**
* atk_gobject_accessible_get_object:
- * @obj: a #AtkObject
+ * @obj: a #AtkGObjectAccessible
*
* Gets the GObject for which @obj is the accessible object.
*
- * Returns: a #GObject which is the object for which @obj is the accessible objedct
+ * Returns: (transfer none): a #GObject which is the object for which @obj is
+ * the accessible object
**/
GObject *
atk_gobject_accessible_get_object (AtkGObjectAccessible *obj)
static void
atk_gobject_accessible_dispose (gpointer data)
{
+ GObject *object;
+
g_return_if_fail (ATK_IS_GOBJECT_ACCESSIBLE (data));
+ object = atk_gobject_accessible_get_object (data);
+ if (object)
+ g_object_set_qdata (object, quark_accessible_object, NULL);
+
g_object_set_qdata (G_OBJECT (data), quark_object, NULL);
atk_object_notify_state_change (ATK_OBJECT (data), ATK_STATE_DEFUNCT,
TRUE);