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

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

 



On Dec 12, 2007 12:15 AM, Diogo F. S. Ramos <diogofsr@xxxxxxxxx> wrote:
>
> Em Ter, 2007-12-11 às 22:57 -0200, Tristan Van Berkom escreveu:
> >  its well worth while to create a GObject for the major
> > entities of your app (see DevHelp sources for a good simple example).
>
> I always like to go the "extra mile" to do the things more clear and
> robust. So, that's not a problem, _at all_.
>
> But let me try to understand what you are suggesting.
>
> You are saying that I should create GObjects for stuff like main
> window, dialogs and things like that, insert the references for the
> widgets which each one of these has on it and then make methods to
> retrieve information from specifics widgets? Is that it?

Looking specifically at the main window stuff, so you can see how *I*
handle the situation.

I Usually create all my windows as a Child of GtkWindow, insert all
the widgets I need in it (if it is static, at least). Then I write
simple wrappers that I connect to specific behaviour on widgets.

As an example, if my app had window that consisted of an GtkEntry for
an address and Cancel and Connect buttons, then I would make a
GtkWindow child, pack everything inside.
Connect to the "clicked" signal on Cancel and inside the handle launch
a "cancel" signal to expose to the outside (with the Window as
emitter), do the same to the connect button. And I'd have a property
"address" in the window, too.

That way, my app has no idea on how exactly things are laid in the
window, I can write the application logic in terms of "business" (a
bit of stretch for a connecter) information and actions (the address
typed, and the cancel or connect actions).

BUT, as I said earler I am a Object Freak... I don't think this is the
ideal way to go, but I feel comfortable with it.

As you can see, in this simple case, there is no need for the Window
to store references for the widgets, since they're not really all that
useful after they're created and I connect to their signals.

Regards,
Alexandre Moreira.

>
> I am already reading the DevHelp for GObject, but I am not sure what I
> am looking for.
>
> --
>
> Diogo F. S. Ramos
>
> _______________________________________________
> gtk-list mailing list
> gtk-list@xxxxxxxxx
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux