Attilio Fiandrotti wrote:
> Liam R E Quin wrote:
> 
>>On Sat, 2006-11-11 at 11:51 +0100, Attilio Fiandrotti wrote:
>>[...]
>>
>>
>>>I eventually managed this by scrolling the treeview from a callback that 
>>>gets fired after the expose event is fired.
>>>In order to have scrolling performed only the first time expose event is 
>>>fired, i use a global flag which i reset from inside the callback the 
>>>first time it's run.
>>
>>
>>An alternative might be to have the signal handler disconnect the
>>signal.
> 
> 
> That's what i did, as suggested by tomas: disconnecting the signal 
> handler from the treeview after it has run one time.
> Now scrolling works perfectly.
> By the way, is it so obvious you should wait for your treeview to be 
> realized before scrolling it?
> IIRC, this is not explicitly mentioned in the documentation.

following up to myself to report a strange issue i ran into today: my 
callback function is like this

void treeview_exposed_callback (GtkWidget *widget, GdkEventExpose 
*event, struct treeview_expose_callback_data *data)
{
     GtkTreePath *path  = gtk_tree_path_new_from_string (data -> path);
     gtk_tree_view_set_cursor (GTK_TREE_VIEW (widget), path, NULL, FALSE);
     gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (widget ), path, NULL, 
TRUE, 0.5, 0);
     gtk_tree_path_free (path);
     g_signal_handler_disconnect (G_OBJECT(widget), 
data->callback_function);
     free(data);
}

everything works great, but sometimes i get a crash which can be easily 
avoided by swapping order of gtk_tree_view_set_cursor() and 
gtk_tree_view_scroll_to_cell() calls.

Is there any valid reason for this crash i'm running into?
I'm using DirectFB backend, and unfortunately i have no chance to test 
with X backend in the very same conditions nor attach a debugger to the 
process.
I'd really apreciate any help to make light into this strange crash.

thanks

Attilio
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to