Re: How to hadle the objects? g_set_data, global?



On Dec 11, 2007 7:54 PM, Diogo F. S. Ramos <diogofsr gmail com> wrote:
> After some months using GTK I reach a practical issue.
>
> Until now, to get data from treeviews, textcells and everything else I
> always used the g_set_data's technique to later make a g_get_data from
> buttons and the rest.
>
> Well, now I do have a slightly moderate sized program with a lot of
> references flying around and now I think I am losing what I tried in the
> first place: Clearness.
>
> What technique do you use? I am thinking to switch to something like a
> global object with all the references and then I take from it the
> references that I need. Sure I will need to figure out different names
> to everything, but this do not "seem" to be such a problem. I am always
> against global variables, but I think that the use of just one, and to
> be more clear, is ok.


I don't think my way is ideal, I am probably over-engeneering a lot
with it, but I'll tell you.

As I came from a background with basically Object Oriented languages,
I simply use every major entity in my application as a GObject.  It
takes some time to get used to the GObject stuff, but it is well worth
it for Gtk+ Applications. Keep in mind that your mileage may vary,
though.

Actually I think it would be good to hear what others have to say
about it. What do you think, guys ? set_data ? global stuff everywhere
? lots of gobjects ? or perhaps a mix of all that ?

Regards,
Alexandre Moreira.

>
> --
> Diogo F. S. Ramos
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>


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