Re: Callbacks and widgets




This way is one of the best I found. 
Ensures compatibility and as you said performance impact is minimum.

Anyway, I found that using a mix of this way and using user data to set
widget pointers is a tradeof between performance and memory consumption.

So I set the widget dependencies with:

g_object_set_data(G_OBJECT(accept),PROFILE_TREEVIEW,(gpointer)treeview);

for the main widgets, and search for the secondaries...

This works like a charm and don't have to be searching for the most used
widgets...

Thank you all for your great help!!!


I have a 4th way to offer. I also use to access arbitrary widgets from
within widget's signal handlers frequently. I don't keep all widgets to
be reachable as global variables nor do I define or pass any data
structures to the handlers.

My way has proven to be quite comfortable at source level, since the
only precaution you need to take is to assign names to those widgets you
want to refer to, and to provide just one globally accessable variable
per window. The tiny performance impact by this function is absolutely
negligible at runtime, even if you perform 100 widget searches in a row.

http://www.spamkiller.bytechase.cx/democode/widget_find_by_name.c
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
-- 
Gonzalo Aguilar Delgado - Ingeniero en InformÃtica
        [ Seguridad & Medios de pago ]




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