[g-a-devel]libspi patch ...
- From: Michael Meeks <michael ximian com>
- To: Bill Haneman <bill haneman sun com>
- Cc: accessibility mailing list <gnome-accessibility-devel gnome org>, Release Team <gnome2-release-team gnome org>
- Subject: [g-a-devel]libspi patch ...
- Date: 20 Mar 2002 23:56:15 +0000
Hi Bill,
This patch ensures that we can do pointer comparisons on remote
accesibles so that parent->child->parent == parent eg. it involves some
API changes - but since nothing I'm aware of outside libspi actually
uses that API is this a problem ?
I think at-spi is on a pretty sticky wicket without it;
Regards,
Michael.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/at-spi/ChangeLog,v
retrieving revision 1.176
diff -u -p -u -r1.176 ChangeLog
--- ChangeLog 19 Mar 2002 22:31:43 -0000 1.176
+++ ChangeLog 20 Mar 2002 23:53:46 -0000
@@ -1,3 +1,23 @@
+2002-03-20 Michael Meeks <michael ximian com>
+
+ * libspi/base.c (spi_base_construct_default): unused, kill.
+ (spi_base_construct): rename
+ (de_register_public_ref, get_public_refs): move here
+ from accessible.c
+
+ * libspi/accessible.c (spi_accessible_construct):
+ use the new method.
+
+ * libspi/*.c: update spi_base_construct calls.
+
+ * libspi/editabletext.c
+ (spi_editable_text_interface_new): upd.
+
+ * libspi/text.c (spi_text_interface_new): upd.
+ (spi_text_construct): kill.
+
+ * libspi/hypertext.c (spi_hypertext_interface_new): upd.
+
2002-03-19 Michael Meeks <michael ximian com>
* registryd/registry.c (desktop_remove_application),
Index: atk-bridge/bridge.c
===================================================================
RCS file: /cvs/gnome/at-spi/atk-bridge/bridge.c,v
retrieving revision 1.32
diff -u -p -u -r1.32 bridge.c
--- atk-bridge/bridge.c 13 Mar 2002 16:05:22 -0000 1.32
+++ atk-bridge/bridge.c 20 Mar 2002 23:53:46 -0000
@@ -121,11 +121,8 @@ atk_bridge_init (gint *argc, gchar **arg
this_app = spi_application_new (atk_get_root ());
- fprintf (stderr, "About to register application\n");
-
- Accessibility_Registry_registerApplication (registry,
- BONOBO_OBJREF (this_app),
- &ev);
+ Accessibility_Registry_registerApplication (
+ registry, BONOBO_OBJREF (this_app), &ev);
g_atexit (spi_atk_bridge_exit_func);
Index: libspi/accessible.c
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/accessible.c,v
retrieving revision 1.42
diff -u -p -u -r1.42 accessible.c
--- libspi/accessible.c 15 Mar 2002 15:26:28 -0000 1.42
+++ libspi/accessible.c 20 Mar 2002 23:53:46 -0000
@@ -418,24 +418,6 @@ BONOBO_TYPE_FUNC_FULL (SpiAccessible,
PARENT_TYPE,
spi_accessible);
-static GHashTable *public_corba_refs = NULL;
-
-static GHashTable *
-get_public_refs (void)
-{
- if (!public_corba_refs)
- {
- public_corba_refs = g_hash_table_new (NULL, NULL);
- }
- return public_corba_refs;
-}
-
-static void
-de_register_public_ref (SpiBase *object)
-{
- g_hash_table_remove (get_public_refs (), object->gobj);
-}
-
SpiAccessible *
spi_accessible_new (AtkObject *o)
{
@@ -445,6 +427,7 @@ spi_accessible_new (AtkObject *o)
SpiAccessible *
spi_accessible_construct (GType type, AtkObject *o)
{
+ gboolean created;
SpiAccessible *retval;
CORBA_Environment ev;
@@ -453,23 +436,13 @@ spi_accessible_construct (GType type, At
g_assert (o);
g_assert (g_type_is_a (type, SPI_ACCESSIBLE_TYPE));
- if ((retval = g_hash_table_lookup (get_public_refs (), o)))
- {
- bonobo_object_ref (BONOBO_OBJECT (retval));
- return retval;
- }
- else
+ /* FIXME: this code needs to be in spi_base ! */
+ /* aggregate appropriate SPI interfaces based on ATK interfaces */
+ retval = spi_base_lookup_create (type, G_OBJECT (o), &created);
+ if (!created)
{
- retval = g_object_new (type, NULL);
- spi_base_construct (SPI_BASE (retval), G_OBJECT(o));
+ return retval;
}
-
- g_hash_table_insert (get_public_refs (), o, retval);
- g_signal_connect (G_OBJECT (retval), "destroy",
- G_CALLBACK (de_register_public_ref),
- NULL);
-
- /* aggregate appropriate SPI interfaces based on ATK interfaces */
if (ATK_IS_ACTION (o))
{
Index: libspi/action.c
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/action.c,v
retrieving revision 1.13
diff -u -p -u -r1.13 action.c
--- libspi/action.c 18 Dec 2001 13:38:44 -0000 1.13
+++ libspi/action.c 20 Mar 2002 23:53:46 -0000
@@ -81,11 +81,7 @@ spi_action_init (SpiAction *action)
SpiAction *
spi_action_interface_new (AtkObject *obj)
{
- SpiAction *new_action = g_object_new (SPI_ACTION_TYPE, NULL);
-
- spi_base_construct (SPI_BASE (new_action), G_OBJECT(obj));
-
- return new_action;
+ return spi_base_lookup_create (SPI_ACTION_TYPE, G_OBJECT (obj), NULL);
}
static AtkAction *
Index: libspi/application.c
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/application.c,v
retrieving revision 1.19
diff -u -p -u -r1.19 application.c
--- libspi/application.c 18 Dec 2001 13:38:44 -0000 1.19
+++ libspi/application.c 20 Mar 2002 23:53:46 -0000
@@ -362,9 +362,5 @@ BONOBO_TYPE_FUNC_FULL (SpiApplication,
SpiApplication *
spi_application_new (AtkObject *app_root)
{
- SpiApplication *retval = g_object_new (SPI_APPLICATION_TYPE, NULL);
-
- spi_base_construct (SPI_BASE (retval), G_OBJECT(app_root));
-
- return retval;
+ return spi_base_lookup_create (SPI_APPLICATION_TYPE, G_OBJECT (app_root), NULL);
}
Index: libspi/base.c
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/base.c,v
retrieving revision 1.4
diff -u -p -u -r1.4 base.c
--- libspi/base.c 18 Dec 2001 13:38:44 -0000 1.4
+++ libspi/base.c 20 Mar 2002 23:53:46 -0000
@@ -67,16 +67,64 @@ spi_base_init (SpiBase *object)
BONOBO_TYPE_FUNC (SpiBase, PARENT_TYPE, spi_base);
-void
-spi_base_construct (SpiBase *object, GObject *gobject)
+static GHashTable *public_corba_refs = NULL;
+
+static GHashTable *
+get_public_refs (void)
+{
+ if (!public_corba_refs)
+ {
+ public_corba_refs = g_hash_table_new (NULL, NULL);
+ }
+ return public_corba_refs;
+}
+
+static void
+de_register_public_ref (SpiBase *object)
{
- object->gobj = g_object_ref (gobject);
+ g_hash_table_remove (get_public_refs (), object->gobj);
}
-void
-spi_base_construct_default (SpiBase *object)
+gpointer
+spi_base_lookup_create (GType type, GObject *gobject, gboolean *opt_created)
{
- object->gobj = g_object_new (G_TYPE_OBJECT, NULL);
+ SpiBase *retval;
+
+ if ((retval = g_hash_table_lookup (get_public_refs (), gobject)))
+ {
+/* g_warning ("return ref copy (%p) for accessible %p",
+ BONOBO_OBJREF (retval), o); */
+ bonobo_object_ref (BONOBO_OBJECT (retval));
+
+ if (opt_created)
+ {
+ *opt_created = FALSE;
+ }
+
+ return retval;
+ }
+ else
+ {
+ retval = g_object_new (type, NULL);
+
+ retval->gobj = g_object_ref (gobject);
+
+ if (opt_created)
+ {
+ *opt_created = TRUE;
+ }
+
+/* g_warning ("return new ref (%p) for accessible %p",
+ BONOBO_OBJREF (retval), o); */
+ }
+
+ g_hash_table_insert (get_public_refs (), gobject, retval);
+
+ g_signal_connect (retval, "destroy",
+ G_CALLBACK (de_register_public_ref),
+ NULL);
+
+ return retval;
}
GObject *
Index: libspi/base.h
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/base.h,v
retrieving revision 1.3
diff -u -p -u -r1.3 base.h
--- libspi/base.h 18 Dec 2001 13:38:44 -0000 1.3
+++ libspi/base.h 20 Mar 2002 23:53:46 -0000
@@ -43,10 +43,10 @@ typedef struct {
} SpiBaseClass;
GType spi_base_get_type (void);
-void spi_base_construct (SpiBase *base,
- GObject *gobject);
-void spi_base_construct_default (SpiBase *base);
-GObject *spi_base_get_gobject (SpiBase *base);
+gpointer spi_base_lookup_create (GType type,
+ GObject *gobject,
+ gboolean *opt_created);
+GObject *spi_base_get_gobject (SpiBase *base);
G_END_DECLS
Index: libspi/component.c
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/component.c,v
retrieving revision 1.16
diff -u -p -u -r1.16 component.c
--- libspi/component.c 18 Dec 2001 13:38:44 -0000 1.16
+++ libspi/component.c 20 Mar 2002 23:53:46 -0000
@@ -215,9 +215,5 @@ BONOBO_TYPE_FUNC_FULL (SpiComponent,
SpiComponent *
spi_component_interface_new (AtkObject *o)
{
- SpiComponent *retval = g_object_new (SPI_COMPONENT_TYPE, NULL);
-
- spi_base_construct (SPI_BASE (retval), G_OBJECT(o));
-
- return retval;
+ return spi_base_lookup_create (SPI_COMPONENT_TYPE, G_OBJECT (o), NULL);
}
Index: libspi/editabletext.c
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/editabletext.c,v
retrieving revision 1.13
diff -u -p -u -r1.13 editabletext.c
--- libspi/editabletext.c 18 Dec 2001 13:38:44 -0000 1.13
+++ libspi/editabletext.c 20 Mar 2002 23:53:46 -0000
@@ -96,12 +96,7 @@ spi_editable_text_init (SpiEditableText
SpiEditableText *
spi_editable_text_interface_new (AtkObject *obj)
{
- SpiEditableText *new_editable = g_object_new (
- SPI_EDITABLE_TEXT_TYPE, NULL);
-
- spi_text_construct (SPI_TEXT (new_editable), obj);
-
- return new_editable;
+ return spi_base_lookup_create (SPI_EDITABLE_TEXT_TYPE, G_OBJECT (obj), NULL);
}
Index: libspi/hyperlink.c
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/hyperlink.c,v
retrieving revision 1.13
diff -u -p -u -r1.13 hyperlink.c
--- libspi/hyperlink.c 18 Dec 2001 13:38:44 -0000 1.13
+++ libspi/hyperlink.c 20 Mar 2002 23:53:46 -0000
@@ -85,12 +85,7 @@ spi_hyperlink_init (SpiHyperlink *hyperl
SpiHyperlink *
spi_hyperlink_new (AtkObject *object)
{
- SpiHyperlink *new_hyperlink = g_object_new (
- SPI_HYPERLINK_TYPE, NULL);
-
- spi_base_construct (SPI_BASE (new_hyperlink), G_OBJECT(object));
-
- return new_hyperlink;
+ return spi_base_lookup_create (SPI_HYPERLINK_TYPE, G_OBJECT (object), NULL);
}
Index: libspi/hypertext.c
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/hypertext.c,v
retrieving revision 1.11
diff -u -p -u -r1.11 hypertext.c
--- libspi/hypertext.c 18 Dec 2001 13:38:44 -0000 1.11
+++ libspi/hypertext.c 20 Mar 2002 23:53:46 -0000
@@ -31,11 +31,7 @@
SpiHypertext *
spi_hypertext_interface_new (AtkObject *obj)
{
- SpiHypertext *new_hypertext = g_object_new (SPI_HYPERTEXT_TYPE, NULL);
-
- spi_text_construct (SPI_TEXT (new_hypertext), obj);
-
- return new_hypertext;
+ return spi_base_lookup_create (SPI_HYPERTEXT_TYPE, G_OBJECT (obj), NULL);
}
Index: libspi/image.c
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/image.c,v
retrieving revision 1.11
diff -u -p -u -r1.11 image.c
--- libspi/image.c 18 Dec 2001 13:38:44 -0000 1.11
+++ libspi/image.c 20 Mar 2002 23:53:46 -0000
@@ -30,11 +30,7 @@
SpiImage *
spi_image_interface_new (AtkObject *obj)
{
- SpiImage *new_image = g_object_new (SPI_IMAGE_TYPE, NULL);
-
- spi_base_construct (SPI_BASE (new_image), G_OBJECT(obj));
-
- return new_image;
+ return spi_base_lookup_create (SPI_IMAGE_TYPE, G_OBJECT (obj), NULL);
}
static AtkImage *
Index: libspi/relation.c
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/relation.c,v
retrieving revision 1.7
diff -u -p -u -r1.7 relation.c
--- libspi/relation.c 2 Jan 2002 19:53:20 -0000 1.7
+++ libspi/relation.c 20 Mar 2002 23:53:46 -0000
@@ -114,9 +114,7 @@ impl_getTarget (PortableServer_Servant s
SpiRelation *
spi_relation_new (AtkRelation *obj)
{
- SpiRelation *new_relation = g_object_new (SPI_RELATION_TYPE, NULL);
- spi_base_construct (SPI_BASE (new_relation), G_OBJECT (obj));
- return new_relation;
+ return spi_base_lookup_create (SPI_RELATION_TYPE, G_OBJECT (obj), NULL);
}
Index: libspi/selection.c
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/selection.c,v
retrieving revision 1.10
diff -u -p -u -r1.10 selection.c
--- libspi/selection.c 18 Dec 2001 13:38:44 -0000 1.10
+++ libspi/selection.c 20 Mar 2002 23:53:46 -0000
@@ -31,11 +31,7 @@
SpiSelection *
spi_selection_interface_new (AtkObject *obj)
{
- SpiSelection *new_selection = g_object_new (SPI_SELECTION_TYPE, NULL);
-
- spi_base_construct (SPI_BASE (new_selection), G_OBJECT(obj));
-
- return new_selection;
+ return spi_base_lookup_create (SPI_SELECTION_TYPE, G_OBJECT (obj), NULL);
}
Index: libspi/stateset.c
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/stateset.c,v
retrieving revision 1.2
diff -u -p -u -r1.2 stateset.c
--- libspi/stateset.c 14 Mar 2002 20:39:41 -0000 1.2
+++ libspi/stateset.c 20 Mar 2002 23:53:46 -0000
@@ -145,11 +145,8 @@ atk_state_set_from_accessibility_state_s
SpiStateSet *
spi_state_set_new (AtkStateSet *obj)
{
- SpiStateSet *new_set = g_object_new (SPI_STATE_SET_TYPE, NULL);
- spi_base_construct (SPI_BASE (new_set), G_OBJECT (obj));
- return new_set;
+ return spi_base_lookup_create (SPI_STATE_SET_TYPE, G_OBJECT (obj), NULL);
}
-
static CORBA_boolean
Index: libspi/table.c
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/table.c,v
retrieving revision 1.12
diff -u -p -u -r1.12 table.c
--- libspi/table.c 18 Dec 2001 13:38:44 -0000 1.12
+++ libspi/table.c 20 Mar 2002 23:53:46 -0000
@@ -33,11 +33,7 @@
SpiTable *
spi_table_interface_new (AtkObject *obj)
{
- SpiTable *new_table = g_object_new (SPI_TABLE_TYPE, NULL);
-
- spi_base_construct (SPI_BASE (new_table), G_OBJECT(obj));
-
- return new_table;
+ return spi_base_lookup_create (SPI_TABLE_TYPE, G_OBJECT (obj), NULL);
}
Index: libspi/text.c
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/text.c,v
retrieving revision 1.13
diff -u -p -u -r1.13 text.c
--- libspi/text.c 6 Feb 2002 21:39:56 -0000 1.13
+++ libspi/text.c 20 Mar 2002 23:53:46 -0000
@@ -437,23 +437,8 @@ BONOBO_TYPE_FUNC_FULL (SpiText,
PARENT_TYPE,
spi_text);
-void
-spi_text_construct (SpiText *text, AtkObject *obj)
-{
- spi_base_construct (SPI_BASE (text), G_OBJECT(obj));
-}
-
-
SpiText *
spi_text_interface_new (AtkObject *obj)
{
- SpiText *retval;
-
- g_return_val_if_fail (ATK_IS_TEXT (obj), NULL);
-
- retval = g_object_new (SPI_TEXT_TYPE, NULL);
-
- spi_text_construct (retval, obj);
-
- return retval;
+ return spi_base_lookup_create (SPI_TEXT_TYPE, G_OBJECT (obj), NULL);
}
Index: libspi/text.h
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/text.h,v
retrieving revision 1.9
diff -u -p -u -r1.9 text.h
--- libspi/text.h 7 Dec 2001 16:43:16 -0000 1.9
+++ libspi/text.h 20 Mar 2002 23:53:46 -0000
@@ -43,8 +43,6 @@ struct _SpiTextClass {
};
GType spi_text_get_type (void);
-void spi_text_construct (SpiText *text,
- AtkObject *obj);
SpiText *spi_text_interface_new (AtkObject *obj);
G_END_DECLS
Index: libspi/value.c
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/value.c,v
retrieving revision 1.13
diff -u -p -u -r1.13 value.c
--- libspi/value.c 18 Dec 2001 13:38:44 -0000 1.13
+++ libspi/value.c 20 Mar 2002 23:53:46 -0000
@@ -81,11 +81,7 @@ spi_value_init (SpiValue *value)
SpiValue *
spi_value_interface_new (AtkObject *obj)
{
- SpiValue *new_value = g_object_new (SPI_VALUE_TYPE, NULL);
-
- spi_base_construct (SPI_BASE (new_value), G_OBJECT(obj));
-
- return new_value;
+ return spi_base_lookup_create (SPI_VALUE_TYPE, G_OBJECT (obj), NULL);
}
--
mmeeks gnu org <><, Pseudo Engineer, itinerant idiot
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]