Fixed to getAttributes methods, and Document interface aggregation.
authorbillh <billh@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Mon, 21 Aug 2006 17:03:05 +0000 (17:03 +0000)
committerbillh <billh@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Mon, 21 Aug 2006 17:03:05 +0000 (17:03 +0000)
Thanks to Ginn Chen for the initial patch (which was re-worked).

git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@851 e2bd861d-eb25-0410-b326-f6ed22b6b98c

ChangeLog
cspi/spi_accessible.c
libspi/accessible.c
libspi/document.c
libspi/text.c

index ce77424..1411c18 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2006-08-21  Bill Haneman <bill.haneman@sun.com>
+
+       Patch section from Ginn Chen...
+
+       * cspi/spi_accessible.c:
+       (_cspi_accessible_set_from_sequence): 
+       Changed g_newa to g_new0 on Ginn Chen's suggestion.
+
+       * libspi/accessible.c:
+       (impl_getAttributes): Fixed to use the AtkAttribute struct properly.
+       (spi_accessible_new): Add the Document interface if present.
+
+       * libspi/document.c:
+       (impl_getAttributes): Fixed to use AtkAttribute properly.
+
+       * libspi/text.c:
+       (impl_getAttributes, impl_getDefaultAttributes): 
+       (impl_getAttributeRun): Fixed to use AtkAttribute struct properly.
+       
 2006-08-17  Bill Haneman <bill.haneman@sun.com>
 
        * cspi/spi-private.h, cspi/spi_accessible.c:
index c59ba1c..2710ef8 100644 (file)
@@ -249,7 +249,7 @@ _cspi_attribute_set_from_sequence (const Accessibility_AttributeSet *seq)
     int i;
 
     set->len = seq->_length;
-    set->attributes = g_newa (char *, set->len);
+    set->attributes = g_new0 (char *, set->len);
     for (i = 0; i < set->len; ++i)
     {
        set->attributes[i] = g_strdup (seq->_buffer [i]);
index db9ab01..a5e29d5 100644 (file)
@@ -452,7 +452,8 @@ impl_accessibility_accessible_get_attributes (PortableServer_Servant servant,
                                               CORBA_Environment     *ev)
 {
     Accessibility_AttributeSet *retval;
-    GSList *attributes;
+    AtkAttributeSet *attributes = NULL;
+    AtkAttribute *attr = NULL;
     gint n_attributes = 0;
     gint i;
     
@@ -471,8 +472,11 @@ impl_accessibility_accessible_get_attributes (PortableServer_Servant servant,
     
     for (i = 0; i < n_attributes; ++i)
     {
-       retval->_buffer[i] = CORBA_string_dup (g_slist_nth_data (attributes, i));
+       attr = g_slist_nth_data (attributes, i);
+       retval->_buffer[i] = CORBA_string_dup (g_strconcat (attr->name, ":", attr->value, NULL));
     }
+
+    atk_attribute_set_free (attributes);
     
   return retval;
 }
@@ -623,6 +627,11 @@ spi_accessible_construct (GType type, AtkObject *o)
         bonobo_object_add_interface (bonobo_object (retval),
                                     BONOBO_OBJECT (spi_streamable_interface_new (o)));
       }
+    if (ATK_IS_DOCUMENT (o))
+      {
+       bonobo_object_add_interface (bonobo_object (retval),
+                                    BONOBO_OBJECT (spi_document_interface_new (o)));
+      }
 
     return retval;
 }
index 5d6e4ac..dc496ff 100644 (file)
@@ -97,6 +97,7 @@ impl_getAttributes (PortableServer_Servant servant,
   
   AtkDocument *document = get_document_from_servant (servant);
   AtkAttributeSet *attributes = NULL;
+  AtkAttribute *attr = NULL;
   Accessibility_AttributeSet *retval;
   gint n_attributes = 0;
   gint i;
@@ -119,7 +120,8 @@ impl_getAttributes (PortableServer_Servant servant,
   
   for (i = 0; i < n_attributes; ++i)
   {
-      retval->_buffer[i] = CORBA_string_dup (g_slist_nth_data (attributes, i));
+      attr = g_slist_nth_data (attributes, i);
+      retval->_buffer [i] = CORBA_string_dup (g_strconcat (attr->name, ":", attr->value, NULL));
   }
     
   atk_attribute_set_free (attributes);
index 2236f25..88fcf02 100644 (file)
@@ -538,6 +538,7 @@ impl_getAttributeRun (PortableServer_Servant servant,
                      CORBA_Environment *ev){
                      
      AtkAttributeSet *attributes, *default_attributes = NULL;
+     AtkAttribute *attr = NULL;
      gint intstart_offset, intend_offset;
      Accessibility_AttributeSet *retval = NULL;
      AtkText *text = get_text_from_servant (servant);
@@ -570,12 +571,14 @@ impl_getAttributeRun (PortableServer_Servant servant,
         
         for (i = 0; i < n_attributes; ++i)
         {
-            retval->_buffer[i] = CORBA_string_dup (g_slist_nth_data (attributes, i));
+            attr = g_slist_nth_data (attributes, i);
+            retval->_buffer[i] = CORBA_string_dup (g_strconcat (attr->name, ":", attr->value, NULL));
         }
         
         for (j = 0; j < n_default_attributes; ++i, ++j)
         {
-            retval->_buffer[i] = CORBA_string_dup (g_slist_nth_data (default_attributes, j));
+            attr = g_slist_nth_data (default_attributes, i);
+            retval->_buffer[i] = CORBA_string_dup (g_strconcat (attr->name, ":", attr->value, NULL));
         }
         
         atk_attribute_set_free (attributes);
@@ -589,6 +592,7 @@ static Accessibility_AttributeSet *
 impl_getDefaultAttributeSet (PortableServer_Servant servant,
                             CORBA_Environment *ev){
      AtkAttributeSet *attributes;
+     AtkAttribute *attr = NULL;
      Accessibility_AttributeSet *retval = NULL;
      AtkText *text = get_text_from_servant (servant);
      gint n_attributes = 0;
@@ -609,7 +613,8 @@ impl_getDefaultAttributeSet (PortableServer_Servant servant,
         
         for (i = 0; i < n_attributes; ++i)
         {
-            retval->_buffer[i] = CORBA_string_dup (g_slist_nth_data (attributes, i));
+            attr = g_slist_nth_data (attributes, i);
+            retval->_buffer [i] = CORBA_string_dup (g_strconcat (attr->name, ":", attr->value, NULL));
         }
         atk_attribute_set_free (attributes);
      }