Re: Copying widgets



On 07/13/2009 04:00 AM, Jim George wrote:
On Sun, Jul 12, 2009 at 3:46 PM, Tristan Van Berkom<tvb gnome org> wrote:
On Sun, Jul 12, 2009 at 3:27 PM, Jim George<jimgeorge gmail com> wrote:
Hi all,
I'm writing a program that, like gimp, has a control window, from
which users can open one or more viewer windows that present different
aspects of a data set (it's a weather radar display program). The
sub-windows are identical, and I'm using libglade and glade-3 to do
the interface layouts. Currently, I call glade_xml_new each time I
want to create a new window. Is there a better way, which prevents
libglade from having to parse the XML each time?

From the documentation of glade_xml_new():

"Note also that the XML parse tree is cached to speed up creating another
GladeXML object for the same file".

Sure, you can build the dialog at startup time or on demand
the first time, but just hide it and show it on demand.

That's how I handle things like properties dialog boxes. The display
windows, however, are different in that there can be more than one
open at a time, and I have no way to predict how many the user would
like to have open. Currently, I'm forced to call glade_xml_new for
each new display window the user would like. If there was a clone
function, though, I could have done something like create a window on
startup, then clone it for each new window that the user wanted.

The caching feature mentioned above should avoid the need for such a cloning
feature I believe.

But I have no clue whether this is still true with GtkBuilder...

--
  Olivier




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