From 4f87999cc1ab8e8e72848d52fa9a48fbfa6cb1d9 Mon Sep 17 00:00:00 2001 From: marcm Date: Wed, 6 Feb 2002 21:39:56 +0000 Subject: [PATCH] Provide implementation of getAttributes git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@235 e2bd861d-eb25-0410-b326-f6ed22b6b98c --- ChangeLog | 6 +++++- libspi/text.c | 43 ++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 37acf36..49a39f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ -2002-02-04 Bill Haneman +2002-02-06 Marc Mulcahy + + * libspi/text.c: Provide implementation for getAttributes. + + 2002-02-04 Bill Haneman * configure.in: Incremented revision. diff --git a/libspi/text.c b/libspi/text.c index b322239..6e27460 100644 --- a/libspi/text.c +++ b/libspi/text.c @@ -196,6 +196,36 @@ impl__get_caretOffset (PortableServer_Servant servant, } +static CORBA_char * +_string_from_attribute_set (AtkAttributeSet *set) +{ + gchar *attributes, *tmp, *tmp2; + CORBA_char *rv; + GSList *cur_attr; + AtkAttribute *at; + + attributes = g_strdup (""); + cur_attr = (GSList *) set; + while (cur_attr) + { + at = (AtkAttribute *) cur_attr->data; + tmp = g_strdup_printf ("%s%s:%s%s", + ((GSList *)(set) == cur_attr) ? "" : " ", + at->name, at->value, + (cur_attr->next) ? ", " : ""); + tmp2 = g_strconcat (attributes, tmp, NULL); + g_free (tmp); + g_free (attributes); + attributes = tmp2; + cur_attr = cur_attr->next; + } + rv = CORBA_string_dup (attributes); + g_free (attributes); + return rv; +} + + + static CORBA_string impl_getAttributes (PortableServer_Servant servant, const CORBA_long offset, @@ -203,13 +233,20 @@ impl_getAttributes (PortableServer_Servant servant, CORBA_long * endOffset, CORBA_Environment *ev) { + AtkAttributeSet *set; + gint intstart_offset, intend_offset; + CORBA_char *rv; AtkText *text = get_text_from_servant (servant); g_return_val_if_fail (text != NULL, CORBA_string_dup ("")); - g_print ("getAttributes not yet implemented.\n"); - - return CORBA_string_dup (""); + set = atk_text_get_run_attributes (text, offset, + &intstart_offset, &intend_offset); + *startOffset = (CORBA_long) intstart_offset; + *endOffset = (CORBA_long) intend_offset; + rv = _string_from_attribute_set (set); + atk_attribute_set_free (set); + return rv; } -- 2.7.4