The way I solve this is by actually subclassing GtkWindow for each window
and then add pointers to the rest of the widgets in that window. To achieve
the window interdependencies I either pass around pointers to other window
or even cleaner, create signals that I send from one window and listen to in
another windows. This is imho the proper "GObject" way of doing things, but
I agree that the syntax is quite messy both for subclassing and for adding
signals. This is why I use gob2 which makes it trivial both to subclass and
to add new signals to a class.

Regards,
Dov

2008/12/17 Tadej Borovšak <[email protected]>

> Hi.
>
> I think it's common practice in gtk programming to create structure of
> all widgets that are needed across the application and then pass a
> pointer to that structure to the callbacks that need access to GUI.
>
>
> 2008/12/16 Harinandan S <[email protected]>:
> > Hi All,
> >
> > I am using Gtk+ 2.12.2 and Glade 3. I create windows using glade3 and use
> > GtkBuilder to create widgets. My application has many windows and each
> > window has a builder object associated with this. At some point of time I
> > have many windows open. I need to change some widgets in one window
> > depending on changes done to other widgets in another window. For example
> in
> > one window I show a label, the current file selected and if user changes
> the
> > file using another window which has a file chooser dialog I'll update the
> > label.
> >
> > This requires pointer to the label. There are multiple dependencies like
> > this. Is there any way that I not maintain global variables and get the
> > pointer to other widgets? I have instances where there are more than two
> > windows open and multiple widget from other windows need to be accessed.
> > Also I cannot have all of them in one builder since I cannot afford to
> spend
> > memory to create all windows at a time.
> >
> > How to manage this and access different pointers in different windows?
> > Regards,
> > Harinandan S
> >
> > _______________________________________________
> > gtk-list mailing list
> > [email protected]
> > http://mail.gnome.org/mailman/listinfo/gtk-list
> >
> >
>
>
>
> --
> Tadej Borovšak
> 00386 (0)40 613 131
> [email protected]
> [email protected]
> _______________________________________________
> gtk-list mailing list
> [email protected]
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
_______________________________________________
gtk-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to