Problem with AtkText get_text offset arguments



Hi,

I have defined a type implementing the AtkText
interface. I have implemented only get_text() and
get_character_count() for now. When atk_get_text gets
called, the arguments start_offset is 0 and end_offset
is -1. And if I try to return anything non-NULL, it
crashes with a segmentation fault when I try to poke
it with at-poke.
What am I doing wrong? Do I have to implement the
other functions too? What would be the minimal
implementation required for it to work?

When I poke the object, my_image_get_text() gets
called first and then my_image_get_character_count. Is
this okay?

Its atk_text_interface_init, the implementation of the
functions and the debugging output are as follows:
____________________________________________________

static void atk_text_interface_init (AtkTextIface
*iface) 
{
  fprintf(stderr, "Function:
atk_text_interface_init\n");

  g_return_if_fail (iface != NULL);

  iface->get_text = my_image_get_text;
  iface->get_character_count =
my_image_get_character_count;
}
____________________________________________________

static gchar messg[] = "Hello back there!";

static gchar* my_image_get_text(AtkText *text, gint
start_offset, gint end_offset)
{
        fprintf(stderr, "Function:
my_image_get_text\n");
        fprintf(stderr, "(my_image_get_text) Request:
start=%d, end=%d\n", start_offset, end_offset);
        fprintf(stderr, "(my_image_get_text) AtkText
*text = %u\n", text);
        if(start_offset > end_offset)
                return NULL;
        return messg;
}

static gint my_image_get_character_count (AtkText
*text)
{
        gint textlen;

        fprintf(stderr, "Function:
my_image_get_character_count\n");
        textlen = strlen(messg);
        fprintf(stderr,
"(my_image_get_character_count) Returning textlen =
%d\n", textlen);

        return textlen;
}
____________________________________________________

Debugging output:

Function: my_image_factory_class_init
Function: my_image_factory_create_accessible
(my_image_factory_create_accessible) widget =
135363816
Function: my_image_new
Function: my_image_get_type
Function: my_image_class_init
Function: atk_text_interface_init
Function: my_image_instance_init
Function: my_image_get_text
(my_image_get_text) Request: start=0, end=-1
(my_image_get_text) AtkText *text = 135364608
Function: my_image_get_character_count
(my_image_get_character_count) Returning textlen = 17
____________________________________________________

Thanks.

Regards,
Ashutosh


	
	
		
___________________________________________________________
BT Yahoo! Broadband - Free modem offer, sign up online today and save £80 http://btyahoo.yahoo.co.uk



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]