2008-01-14 Li Yuan <li.yuan@sun.com>
[platform/core/uifw/at-spi2-atk.git] / libspi / text.c
index 2236f25..103e719 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);
@@ -550,6 +551,7 @@ impl_getAttributeRun (PortableServer_Servant servant,
                                               &intstart_offset, &intend_offset);
 
      if (attributes) total_attributes = n_attributes = g_slist_length (attributes);
+
      if (includeDefaults)
      {
         default_attributes = atk_text_get_default_attributes (text);
@@ -561,21 +563,23 @@ impl_getAttributeRun (PortableServer_Servant servant,
      *startOffset = intstart_offset;
      *endOffset = intend_offset; 
 
+     retval = CORBA_sequence_CORBA_string__alloc ();
+     retval->_length = retval->_maximum = total_attributes;
+     retval->_buffer = CORBA_sequence_CORBA_string_allocbuf (total_attributes);
+     CORBA_sequence_set_release (retval, CORBA_TRUE);
+
      if (total_attributes)
-     {
-        retval = CORBA_sequence_CORBA_string__alloc ();
-        retval->_length = retval->_maximum = total_attributes;
-        retval->_buffer = CORBA_sequence_CORBA_string_allocbuf (total_attributes);
-        CORBA_sequence_set_release (retval, CORBA_TRUE);
-        
+     {  
         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, j);
+            retval->_buffer[i] = CORBA_string_dup (g_strconcat (attr->name, ":", attr->value, NULL));
         }
         
         atk_attribute_set_free (attributes);
@@ -589,6 +593,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 +614,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);
      }