comp.lang.ada
 help / color / mirror / Atom feed
* help building ada with glade
@ 2012-02-22 23:43 Patrick
  2012-02-23  8:44 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 11+ messages in thread
From: Patrick @ 2012-02-22 23:43 UTC (permalink / raw)



I am learning ada gtk (ver 2.14 ). I am still pretty clueless but I
can follow along with the makefiles in the examples folder, they are
also building fine.

In the testgtk folder there are some examples that use glade, I can't
build them. I actually can't build using the makefile in this folder
or the folder above it. Here are the results of these


typing make in build/gtkada-gpl-2.18.0-src

make -C src
make[1]: Entering directory `/media/fast60/Programming/ada/AdaCore/
GtkAda/build/gtkada-gpl-2.18.0-src/src'
mkdir -p lib-obj
gnatmake -Pgtkada_src -u -fPIC -XBUILD=Production -XOPENGL=True -
XGNOME=True -XGLADE=True
gcc-4.4 -c -gnatec=/media/fast60/Programming/ada/AdaCore/GtkAda/build/
gtkada-gpl-2.18.0-src/src/gnat.adc -gnatec=/media/fast60/Programming/
ada/AdaCore/GtkAda/build/gtkada-gpl-2.18.0-src/src/gnat.adc -gnatQ -O2
-gnatn -gnatws -fPIC -I- -gnatA /media/fast60/Programming/ada/AdaCore/
GtkAda/build/gtkada-gpl-2.18.0-src/src/gtk-about_dialog.adb
gtk-about_dialog.ads:231:04: pragma "Obsolescent" misplaced, must
immediately follow a declaration
gtk-about_dialog.ads:235:04: pragma "Obsolescent" misplaced, must
immediately follow a declaration
gnatmake: "/media/fast60/Programming/ada/AdaCore/GtkAda/build/gtkada-
gpl-2.18.0-src/src/gtk-about_dialog.adb" compilation error
make[1]: *** [ada] Error 4
make[1]: Leaving directory `/media/fast60/Programming/ada/AdaCore/
GtkAda/build/gtkada-gpl-2.18.0-src/src'
make: *** [src] Error 2

typing make in gtkada-gpl-2.18.0-src/examples/gtk_examples

gnatprep -r -c -DHAVE_GL=True -DWIN32=False \
	  opengl/view_gl.gpb opengl/view_gl.adb
gnatprep: unable to create output file "opengl/view_gl.adb"
make: *** [opengl/view_gl.adb] Error 4


I tried to use the same commands used in the makefiles that worked but
ended up with this error when typing this:

gnatmake -gnata -gnaty -gnatwu  create_builder `gtkada-config`


gcc-4.4 -c -gnata -gnaty -gnatwu -I/usr/share/ada/adainclude/gtkada2
create_builder.adb
create_builder.adb:34:06: file "gtk-builder.ads" not found
create_builder.adb:43:06: file "common.ads" not found
gnatmake: "create_builder.adb" compilation error

I have these packages installed:
libgnomeada2
libgtkada-glade
libgtkada

I am on Mint linux now, (based on Ubuntu)

Sorry for this very long email, if anyone has a few pointers for me or
could point me to some documentation that would be really great-
Patrick









^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: help building ada with glade
  2012-02-22 23:43 help building ada with glade Patrick
@ 2012-02-23  8:44 ` Dmitry A. Kazakov
  2012-02-23  9:58   ` Patrick
  2012-02-24  5:53   ` J-P. Rosen
  0 siblings, 2 replies; 11+ messages in thread
From: Dmitry A. Kazakov @ 2012-02-23  8:44 UTC (permalink / raw)


On Wed, 22 Feb 2012 15:43:07 -0800 (PST), Patrick wrote:

> I am learning ada gtk (ver 2.14 )

The latest version is 2.24. The version 2.14 is considerably incompatible
with both 2.18 and 2.24.

> In the testgtk folder there are some examples that use glade,

If you want to learn/use Gtk, forget about GLADE. Don't invest much in
examples, only if you are stuck. Start to write your application. Don't
think about perfection. Gtk is not a kind of thing you could do much
upfront. Just make it working, improve incrementally...

> Sorry for this very long email, if anyone has a few pointers for me or
> could point me to some documentation that would be really great

There is on-line GtkAda documentation:

http://libre.adacore.com/wp-content/files/auto_update/gtkada-docs/gtkada_rm/gtkada_rm

However, since you have 2.14, it contains an older version of this
documentation which was much better. Use it instead.

For all issues regarding Gtk (Glib, GObject etc) see Gnome developing
center:

http://developer.gnome.org/gtk/2.24/

GtkAda documentation is largely derived from this source and GtkAda is
quite thin bindings.

For Cairo see:

http://cairographics.org/documentation

Have fun!

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: help building ada with glade
  2012-02-23  8:44 ` Dmitry A. Kazakov
@ 2012-02-23  9:58   ` Patrick
  2012-02-24  5:53   ` J-P. Rosen
  1 sibling, 0 replies; 11+ messages in thread
From: Patrick @ 2012-02-23  9:58 UTC (permalink / raw)


Thanks Dmitry

Very good advice which I will follow, thanks again-Patrick



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: help building ada with glade
  2012-02-23  8:44 ` Dmitry A. Kazakov
  2012-02-23  9:58   ` Patrick
@ 2012-02-24  5:53   ` J-P. Rosen
  2012-02-24  8:39     ` Dmitry A. Kazakov
  1 sibling, 1 reply; 11+ messages in thread
From: J-P. Rosen @ 2012-02-24  5:53 UTC (permalink / raw)


Le 23/02/2012 09:44, Dmitry A. Kazakov a �crit :
> If you want to learn/use Gtk, forget about GLADE. Don't invest much in
> examples, only if you are stuck. Start to write your application. Don't
> think about perfection. Gtk is not a kind of thing you could do much
> upfront. Just make it working, improve incrementally...
> 
YMMV. I did learn Gtk by generating simple applications with Glade and
looking at the generated code. This lowers the height of the first step
to get something working a lot.

Glade is quite nice for casual GUIs (maybe not if you want something
really sophisticated). Why do you think otherwise?

-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: help building ada with glade
  2012-02-24  5:53   ` J-P. Rosen
@ 2012-02-24  8:39     ` Dmitry A. Kazakov
  2012-02-24 23:12       ` J-P. Rosen
  0 siblings, 1 reply; 11+ messages in thread
From: Dmitry A. Kazakov @ 2012-02-24  8:39 UTC (permalink / raw)


On Fri, 24 Feb 2012 06:53:57 +0100, J-P. Rosen wrote:

> Le 23/02/2012 09:44, Dmitry A. Kazakov a �crit :
>> If you want to learn/use Gtk, forget about GLADE. Don't invest much in
>> examples, only if you are stuck. Start to write your application. Don't
>> think about perfection. Gtk is not a kind of thing you could do much
>> upfront. Just make it working, improve incrementally...
>> 
> YMMV. I did learn Gtk by generating simple applications with Glade and
> looking at the generated code. This lowers the height of the first step
> to get something working a lot.

I doubt that code generated by GLADE illustrates issues essential for
dealing with GTK: objects (GObject), values (GValue), signals, containers
(packing), MVC (in trees, combos, text buffers).

I doubt that any generated code could help learning anything.

> Glade is quite nice for casual GUIs (maybe not if you want something
> really sophisticated). Why do you think otherwise?

I don't believe that a GUI project can be assisted with GLADE, which
presumes its ability to incorporate user made modifications of the
generated code. GTK is simply unsuitable for this. It is too low level, too
messy. It lacks any means to separate the UI from the semantics. Ergo, no
need to look into any generator (I admit, I don't know GLADE well), none
can be good for GTK.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: help building ada with glade
  2012-02-24  8:39     ` Dmitry A. Kazakov
@ 2012-02-24 23:12       ` J-P. Rosen
  2012-02-25  9:06         ` Dmitry A. Kazakov
  0 siblings, 1 reply; 11+ messages in thread
From: J-P. Rosen @ 2012-02-24 23:12 UTC (permalink / raw)


Le 24/02/2012 09:39, Dmitry A. Kazakov a �crit :
> I doubt that code generated by GLADE illustrates issues essential for
> dealing with GTK: objects (GObject), values (GValue), signals, containers
> (packing), MVC (in trees, combos, text buffers).
Exactly. Glade protects me from all that complicated mess. If I want an
action on button pressed, I select the action in Glade, and I just have
to fill the body of a subprogram named On_Key_Pressed. You may argue
that I don't learn the intrinsics of Gtk this way, fine, but I prefer
not to have to.

> I don't believe that a GUI project can be assisted with GLADE, which
> presumes its ability to incorporate user made modifications of the
> generated code. GTK is simply unsuitable for this. It is too low level, too
> messy. It lacks any means to separate the UI from the semantics. Ergo, no
> need to look into any generator (I admit, I don't know GLADE well), none
> can be good for GTK.
> 
Please use it first. A nice thing with Glade is precisely that the
semantics is well separated from all the glue, and (on Linux at least)
it is able to make round-trip engineering (i.e. : if you add stuff to
what has been generated, it is not lost the next time you regenerate
your interface).

-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: help building ada with glade
  2012-02-24 23:12       ` J-P. Rosen
@ 2012-02-25  9:06         ` Dmitry A. Kazakov
  2012-02-26  6:55           ` J-P. Rosen
  2013-09-10  6:40           ` briot.emmanuel
  0 siblings, 2 replies; 11+ messages in thread
From: Dmitry A. Kazakov @ 2012-02-25  9:06 UTC (permalink / raw)


On Sat, 25 Feb 2012 00:12:06 +0100, J-P. Rosen wrote:

> Le 24/02/2012 09:39, Dmitry A. Kazakov a �crit :
>> I doubt that code generated by GLADE illustrates issues essential for
>> dealing with GTK: objects (GObject), values (GValue), signals, containers
>> (packing), MVC (in trees, combos, text buffers).
> Exactly. Glade protects me from all that complicated mess. If I want an
> action on button pressed, I select the action in Glade, and I just have
> to fill the body of a subprogram named On_Key_Pressed. 

Do you really mean the "key-press-event"? [*] I presume you rather did
"clicked" event from a button widget. If GUI consisted of only buttons,
then you would need no GLADE to design such simple thing.

> You may argue
> that I don't learn the intrinsics of Gtk this way, fine, but I prefer
> not to have to.

I would argue that this nasty stuff need to be learnt in order to design
GTK applications.

>> I don't believe that a GUI project can be assisted with GLADE, which
>> presumes its ability to incorporate user made modifications of the
>> generated code. GTK is simply unsuitable for this. It is too low level, too
>> messy. It lacks any means to separate the UI from the semantics. Ergo, no
>> need to look into any generator (I admit, I don't know GLADE well), none
>> can be good for GTK.
>> 
> Please use it first.

Not much different from MS GUI builder, which I long ago ceased to use for
same reasons I never used GLADE. One lesson was enough.

> A nice thing with Glade is precisely that the
> semantics is well separated from all the glue, and (on Linux at least)
> it is able to make round-trip engineering (i.e. : if you add stuff to
> what has been generated, it is not lost the next time you regenerate
> your interface).

But it is impossible to do due to GTK design [**]. The most typical and
safe pattern for handling signals is that a composite widget connects to a
signal of its child and passes itself as a parameter to the signal handler,
because you need to know it in the handler. For this
Gtk.Handlers.User_Callback must be instantiated. I have no idea how a code
generator could deal with this in the round-trip manner.

I presume that GLADE rather uses strictly static forms when each composite
widget has just one instance and all callbacks are statically bound to just
one instance of the emitter and one recipient.

I never use such design, even if it appears sufficient at first glance,
e.g., as you said, for a casual GUI.

My advice for the beginners is to learn to use GtkAda in a different way
and as early as possible. That is when any widget is designed to have
multiple instances and be usable as a child of any container. For each
widget a corresponding Ada type is derived from some base GTK container
(like Gtk_Table_Record). The children are kept hidden as well as handlers
of their signals. I.e. widgets are kept opaque.

--------
* Handing "key-press-event" is far from trivial in GTK. They are not
emitted at all, by default, as well as the "key-release-event" signal. To
handle these signals the application must modify the Gdk_Event_Mask of the
widget using Set_Events, with far reaching consequences for some widgets.

** Though handling signals is important one needs much more to know how to
use GTK.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: help building ada with glade
  2012-02-25  9:06         ` Dmitry A. Kazakov
@ 2012-02-26  6:55           ` J-P. Rosen
  2012-02-26  8:36             ` Dmitry A. Kazakov
  2013-09-10  6:40           ` briot.emmanuel
  1 sibling, 1 reply; 11+ messages in thread
From: J-P. Rosen @ 2012-02-26  6:55 UTC (permalink / raw)


Le 25/02/2012 10:06, Dmitry A. Kazakov a �crit :
> Do you really mean the "key-press-event"? [*] I presume you rather did
> "clicked" event from a button widget. If GUI consisted of only buttons,
> then you would need no GLADE to design such simple thing.
Maybe it was Key_clicked, it does not change my point.
> 
>> You may argue
>> that I don't learn the intrinsics of Gtk this way, fine, but I prefer
>> not to have to.
> 
> I would argue that this nasty stuff need to be learnt in order to design
> GTK applications.
If you want to become an expert and do sophisticated stuff, fine. If you
are a casual user who makes regular GUIs, no. I have made such applications.

> Not much different from MS GUI builder, which I long ago ceased to use for
> same reasons I never used GLADE. One lesson was enough.
So, you didn't use it, but you know it's bad? If it's your choice, fine,
but don't push that advice to others!
> 

> But it is impossible to do due to GTK design [**]. [..]
> I presume that GLADE rather uses strictly static forms [...]

You didn't use it, but you think it's impossible. I used it, I did it,
and I appreciated it.

Once again, you are free to explain to the OP how /you/ use GTK. But
please don't give advice to not use something that you didn't try yourself.
-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: help building ada with glade
  2012-02-26  6:55           ` J-P. Rosen
@ 2012-02-26  8:36             ` Dmitry A. Kazakov
  2013-09-07 20:37               ` Patrick
  0 siblings, 1 reply; 11+ messages in thread
From: Dmitry A. Kazakov @ 2012-02-26  8:36 UTC (permalink / raw)


On Sun, 26 Feb 2012 07:55:00 +0100, J-P. Rosen wrote:

> Le 25/02/2012 10:06, Dmitry A. Kazakov a �crit :

>> Not much different from MS GUI builder, which I long ago ceased to use for
>> same reasons I never used GLADE. One lesson was enough.
> So, you didn't use it, but you know it's bad?

Because I know: 1) GTK/GtkAda, 2) MS and Open/Look GUI builders. 

>> But it is impossible to do due to GTK design [**]. [..]
>> I presume that GLADE rather uses strictly static forms [...]
> 
> You didn't use it, but you think it's impossible.

Yes.

> Once again, you are free to explain to the OP how /you/ use GTK. But
> please don't give advice to not use something that you didn't try yourself.

My post considered learning GTK/GtkAda. I listed things essential for
understanding GTK. Maybe GLADE is terrific, as you said, for casual GUIs.
But you didn't say that GLADE is good for either learning GTK or for
designing less casual GUIs.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: help building ada with glade
  2012-02-26  8:36             ` Dmitry A. Kazakov
@ 2013-09-07 20:37               ` Patrick
  0 siblings, 0 replies; 11+ messages in thread
From: Patrick @ 2013-09-07 20:37 UTC (permalink / raw)


I am digging up a 1.5 year old thread because I have an answer to my original post and it might help someone if they want to build gtk-ada 2.18 or perhaps 2.14. I am running Centos and it has gtk 2.18, hence the older version

configure works but make fails. Just comment out lines 231 and 235 in gtk-about_dialog.ads to remove the Obsolescent pragma and all will be good-Patrick

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: help building ada with glade
  2012-02-25  9:06         ` Dmitry A. Kazakov
  2012-02-26  6:55           ` J-P. Rosen
@ 2013-09-10  6:40           ` briot.emmanuel
  1 sibling, 0 replies; 11+ messages in thread
From: briot.emmanuel @ 2013-09-10  6:40 UTC (permalink / raw)


> But it is impossible to do due to GTK design [**]. The most typical and
> safe pattern for handling signals is that a composite widget connects to a
> signal of its child and passes itself as a parameter to the signal handler,
> because you need to know it in the handler. For this
> Gtk.Handlers.User_Callback must be instantiated. I have no idea how a code
> generator could deal with this in the round-trip manner.

Just wanted to react on this small technical point: you do not want to use
a User_Callback if you are passing a child of GObject_Record in parameter.
Instead, use Object_Connect, which has the benefits of automatically
disconnecting whenever one of the two widgets (the one for the event, the
one in parameter) is destroyed. 
Plus that limits the number of instances of User_Callback, and thus reduces
the size of the executable.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-09-10  6:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-22 23:43 help building ada with glade Patrick
2012-02-23  8:44 ` Dmitry A. Kazakov
2012-02-23  9:58   ` Patrick
2012-02-24  5:53   ` J-P. Rosen
2012-02-24  8:39     ` Dmitry A. Kazakov
2012-02-24 23:12       ` J-P. Rosen
2012-02-25  9:06         ` Dmitry A. Kazakov
2012-02-26  6:55           ` J-P. Rosen
2012-02-26  8:36             ` Dmitry A. Kazakov
2013-09-07 20:37               ` Patrick
2013-09-10  6:40           ` briot.emmanuel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox