[glade--] glade-- generates buggy code with Gtk::Image?

alberto colombo <[email protected]> Mon, 02 Jan 2006 10:35:51 +0100
Newsgroups gmane.comp.gnome.glademm
Message-ID <[email protected]>
Hello and Happy New Year to the list.

I am new to this list, but not to glade. After over two years of
profitable usage of glade+libglademm as an interface designer, I tried
to experiment with glade-- as a code generator.

Now, if my interface includes a Gtk::Image widget, I get so many
(undocumented) problems that I wonder if anybody has met them already,
if it's a glade-- bug, or if I'm just missing some very obvious concept.

To replicate the problem, just create a new gtk+ project, select c++ as
language, create a window a put an image into it. Save the project,
build the source code, run autogen.sh and make:

window1_glade.cc: In constructor =E2=80=98window1_glade::window1_glade()=E2=
=80=99:
window1_glade.cc:53: error: =E2=80=98PixbufLoader=E2=80=99 is not a membe=
r of =E2=80=98Gdk=E2=80=99
...

Clearly, glade-- forgot to #include <gdkmm/pixbufloader.h>. Let's add it
in window1_glade.hh and run make again:

window1_glade.cc: In constructor =E2=80=98window1_glade::window1_glade()=E2=
=80=99:
window1_glade.cc:54: error: =E2=80=98_data=E2=80=99 was not declared in t=
his scope

What? Glade-- is using _data without having declared it? Let's have a
"grep _data *.hh *.cc":

window1_glade.hh:        GlademmData *gmm_data;
window1_glade.cc:   gmm_data =3D new GlademmData(get_accel_group());
window1_glade.cc:   _image1_loader->write(_data, sizeof _data);
window1_glade.cc:{  delete gmm_data;

Indeed, _data is used, but never declared. Even if I declare and
initialize it somewhere, this is not what I want, because at startup I
still don't know what image I should load. Using a pixbuf loader seems
an unnecessary complication and source of bugs. Why not just
instantiating the Gtk::Image and letting the user load whatever image in
whatever fashion s/he prefers?

The temporary solution I found is: do not add the Gtk::Image using
glade; instead, do it manually in the constructor of window1. However,
I'd like to be able to add Gtk:Images direcly from glade.=20

Any hints? BTW, here are the versions of my tools:

Gnome glade-2 2.12.0
glademm V2.6.0=20
g++ (GCC) 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9) [but using
older versions is the same]
autoconf (GNU Autoconf) 2.59
automake (GNU automake) 1.9.5
GNU Make 3.80
 pkg-config --modversion gtkmm-2.4
2.8.0

Thank you veeeery much!

albx