Discussion:
GtkAda using Glade
(too old to reply)
Gary
2011-05-17 23:58:43 UTC
Permalink
I am evaluating Ada for a GUI app using GtkAda/Glade. I have the
latest version of Ada from AdaCore. I've had no problem getting small
example apps to work with and without Glade. What I am having a
problem with is setting up signals through Glade. I simply want to set
up the "delete" event for the main window so "gtk_main_quit" will be
executed. Exactly how do I do that? I have many years of programming
experience with many languages, but I am fairly new to Ada... although
it should just be a matter of working with it a bit to get comfortable
with it. The same goes for GTK+. I have experimented with it using C,
FreePascal, and FreeBasic... so I am familiar with the concept if not
the practice. I'm just not clear on how to set up signals with Glade.
I know you use the properties panel under the "signals" tab, but I
don't know what to put in the various fields.
John B. Matthews
2011-05-18 01:14:44 UTC
Permalink
In article
Post by Gary
I am evaluating Ada for a GUI app using GtkAda/Glade. I have the
latest version of Ada from AdaCore. I've had no problem getting small
example apps to work with and without Glade. What I am having a
problem with is setting up signals through Glade. I simply want to
set up the "delete" event for the main window so "gtk_main_quit" will
be executed. Exactly how do I do that? I have many years of
programming experience with many languages, but I am fairly new to
Ada... although it should just be a matter of working with it a bit
to get comfortable with it. The same goes for GTK+. I have
experimented with it using C, FreePascal, and FreeBasic... so I am
familiar with the concept if not the practice. I'm just not clear on
how to set up signals with Glade. I know you use the properties panel
under the "signals" tab, but I don't know what to put in the various
fields.
I'm afraid I haven't used Glade recently enough to offer detailed
advice, but I recall studying the generated code when creating this
example:

<http://home.roadrunner.com/~jbmatthews/gtk/lady.html>

In this tutorial,

<http://www.micahcarrick.com/gtk-glade-tutorial-part-1.html>

the window destroy callback shown in C and Pyhton,

<http://www.micahcarrick.com/gtk-glade-tutorial-part-1.html#Specifying_Callback_Functions_for>

corresponds roughly to this line in procedure Init:

Void_Cb.Connect (Win, "destroy", Void_Cb.To_Marshaller (Quit'Access));

Hope this helps.
--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
J-P. Rosen
2011-05-18 11:56:11 UTC
Permalink
Post by Gary
I am evaluating Ada for a GUI app using GtkAda/Glade. I have the
latest version of Ada from AdaCore. I've had no problem getting small
example apps to work with and without Glade. What I am having a
problem with is setting up signals through Glade. I simply want to set
up the "delete" event for the main window so "gtk_main_quit" will be
executed. Exactly how do I do that?
Fairly easy (don't listen to those who will try to explain how to do it
by hand, it is sooo much easier with glade ;-) )

Select the main window
In the "signal" panel, under GtkWidget, select "delete-event"
As the handler, select gtk_main_quit
--
---------------------------------------------------------
J-P. Rosen (***@adalog.fr)
Adalog a déménagé / Adalog has moved:
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
Gary
2011-05-18 13:58:52 UTC
Permalink
Le 18/05/2011 01:58, Gary a écrit :> I am evaluating Ada for a GUI app using GtkAda/Glade. I have the
Post by Gary
latest version of Ada from AdaCore. I've had no problem getting small
example apps to work with and without Glade. What I am having a
problem with is setting up signals through Glade. I simply want to set
up the "delete" event for the main window so "gtk_main_quit" will be
executed. Exactly how do I do that?
Fairly easy (don't listen to those who will try to explain how to do it
by hand, it is sooo much easier with glade ;-) )
Select the main window
In the "signal" panel, under GtkWidget, select "delete-event"
As the handler, select gtk_main_quit
I did that but the process is still running on Windows XP after I
close the app. The code that "Gate" generates does not look right to
me. It generates the following code in the "..._pkg_callbacks.adb"

function Gtk_Main_Quit
(Object : access Gtk_Widget_Record'Class;
Params : Gtk.Arguments.Gtk_Args) return Boolean
is
Arg1 : Gdk_Event := To_Event (Params, 1);
begin
return False;
end Gtk_Main_Quit;

This isn't right is it?
Dmitry A. Kazakov
2011-05-18 17:25:42 UTC
Permalink
Post by Gary
The code that "Gate" generates does not look right to
me.
Having reached the level of understanding to tell if the code looks wrong,
why would anybody use Gate? (:-)) Seriously, sooner you ditch the crutches,
sooner you start walking...
Post by Gary
It generates the following code in the "..._pkg_callbacks.adb"
function Gtk_Main_Quit
(Object : access Gtk_Widget_Record'Class;
Params : Gtk.Arguments.Gtk_Args) return Boolean
is
Arg1 : Gdk_Event := To_Event (Params, 1);
begin
return False;
end Gtk_Main_Quit;
This isn't right is it?
Yes, but seemingly not enough. Somewhere you should respond to "destroy"
with a call to Gtk.Main.Main_Quit.

See here for a minimal GtkAda application:

http://rosettacode.org/wiki/Simple_windowed_application#Ada
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
Gary
2011-05-18 18:24:11 UTC
Permalink
Post by Dmitry A. Kazakov
Having reached the level of understanding to tell if the code looks wrong,
why would anybody use Gate? (:-)) Seriously, sooner you ditch the crutches,
sooner you start walking...
Are you suggesting that I dismiss the use of Glade as well or just
Gate? I know Gate converts the XML file to Ada source code, so are you
saying I should keep the XML file and load it at runtime using
Libglade... or that I should write the GUI code using "raw" GTK?
Post by Dmitry A. Kazakov
http://rosettacode.org/wiki/Simple_windowed_application#Ada
This sample app uses GTK code in the source so I am guessing that you
are not in favor of Glade as well as Gate. Am I making the correct
assumption?

BTW... through experimentation, I have learned that Gate seemingly
does not correctly convert the "delete_event" signal to a complete Ada
function. I had to add the "Gtk.Main.Main_Quit" code manually to get
the app to terminate properly.
Ludovic Brenta
2011-05-18 18:27:18 UTC
Permalink
Post by Gary
BTW... through experimentation, I have learned that Gate seemingly
does not correctly convert the "delete_event" signal to a complete Ada
function. I had to add the "Gtk.Main.Main_Quit" code manually to get
the app to terminate properly.
I don't think you can blame glade or gate for that. Neither knows the
semantics of every signal; they emit only a skeleton implementation for
the signal handler; it is always up to you to make the signal handlers
actually do anything like, in this case, leaving the GTK+ main loop.
--
Ludovic Brenta.
Gary
2011-05-18 18:42:58 UTC
Permalink
Post by Gary
BTW... through experimentation, I have learned that Gate seemingly
does not correctly convert the "delete_event" signal to a complete Ada
function. I had to add the "Gtk.Main.Main_Quit" code manually to get
the app to terminate properly.
I don't think you can blame glade or gate for that.  Neither knows the
semantics of every signal; they emit only a skeleton implementation for
the signal handler; it is always up to you to make the signal handlers
actually do anything like, in this case, leaving the GTK+ main loop.
One of the docs I read stated that a directory named ".gate" is
created when Gate is first executed which maintains a record of the
changes you make to the generated Gate source code. Supposedly, this
allows you to make modifications to the generated source and it will
be re-inserted into the source files each time you modify your Glade
output. However, I can not find such a directory on my Windows XP
machine, and every time I rerun Glade and Gate, my changes are gone.
Any thoughts on that?
Ludovic Brenta
2011-05-18 21:54:10 UTC
Permalink
Post by Gary
Post by Gary
BTW... through experimentation, I have learned that Gate seemingly
does not correctly convert the "delete_event" signal to a complete
Ada function. I had to add the "Gtk.Main.Main_Quit" code manually to
get the app to terminate properly.
I don't think you can blame glade or gate for that.  Neither knows
the semantics of every signal; they emit only a skeleton
implementation for the signal handler; it is always up to you to make
the signal handlers actually do anything like, in this case, leaving
the GTK+ main loop.
One of the docs I read stated that a directory named ".gate" is
created when Gate is first executed which maintains a record of the
changes you make to the generated Gate source code. Supposedly, this
allows you to make modifications to the generated source and it will
be re-inserted into the source files each time you modify your Glade
output. However, I can not find such a directory on my Windows XP
machine, and every time I rerun Glade and Gate, my changes are gone.
Any thoughts on that?
Gate needs diff and patch to do that. Make sure you have them
installed. Normally, the configure script of GtkAda tries to detect the
presence of diff and patch; check the configure log to see what it
found. If not, install diff and patch and re-run configure and the
installation procedure of GtkAda.
--
Ludovic Brenta.
Gary
2011-05-18 22:09:08 UTC
Permalink
Gate needs diff and patch to do that.  Make sure you have them
installed.  Normally, the configure script of GtkAda tries to detect the
presence of diff and patch; check the configure log to see what it
found.  If not, install diff and patch and re-run configure and the
installation procedure of GtkAda.
I have gnudiff3.exe, gnudiff.exe, and gnupatch.exe in the "gnat/
2010.bin" directory on Windows XP and it is referenced in a PATH
environment statement. Is that what I need? If so, it doesn't work.
Ludovic Brenta
2011-05-18 23:15:43 UTC
Permalink
Post by Gary
Gate needs diff and patch to do that.  Make sure you have them
installed.  Normally, the configure script of GtkAda tries to detect the
presence of diff and patch; check the configure log to see what it
found.  If not, install diff and patch and re-run configure and the
installation procedure of GtkAda.
I have gnudiff3.exe, gnudiff.exe, and gnupatch.exe in the "gnat/
2010.bin" directory on Windows XP and it is referenced in a PATH
environment statement. Is that what I need? If so, it doesn't work.
Check the configure log to see what it found. Maybe it is looking for
the programs under other names.
--
Ludovic Brenta.
Gary
2011-05-19 01:52:13 UTC
Permalink
Check the configure log to see what it found.  Maybe it is looking for
the programs under other names.
I'm running Windows XP... I can't find a "configure log".
J-P. Rosen
2011-05-19 05:25:48 UTC
Permalink
Post by Ludovic Brenta
Post by Gary
One of the docs I read stated that a directory named ".gate" is
created when Gate is first executed which maintains a record of the
changes you make to the generated Gate source code. Supposedly, this
allows you to make modifications to the generated source and it will
be re-inserted into the source files each time you modify your Glade
output. However, I can not find such a directory on my Windows XP
machine, and every time I rerun Glade and Gate, my changes are gone.
Any thoughts on that?
Gate needs diff and patch to do that. Make sure you have them
installed. Normally, the configure script of GtkAda tries to detect the
presence of diff and patch; check the configure log to see what it
found. If not, install diff and patch and re-run configure and the
installation procedure of GtkAda.
Unless it changed recently, it is documented somewhere that round-trip
reverse engineering doesn't work on Windows (but works very nicely on
Linux), because there is nothing like a standard diff and patch.

Personnally, I have a laptop under Windows and a desktop under Linux. I
do all GUI work on Linux for that reason, then copy the resulting files
to Windows.
--
---------------------------------------------------------
J-P. Rosen (***@adalog.fr)
Adalog a déménagé / Adalog has moved:
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
Manuel Collado
2011-05-19 09:23:15 UTC
Permalink
Post by J-P. Rosen
Post by Ludovic Brenta
Post by Gary
One of the docs I read stated that a directory named ".gate" is
created when Gate is first executed which maintains a record of the
changes you make to the generated Gate source code. Supposedly, this
allows you to make modifications to the generated source and it will
be re-inserted into the source files each time you modify your Glade
output. However, I can not find such a directory on my Windows XP
machine, and every time I rerun Glade and Gate, my changes are gone.
Any thoughts on that?
Gate needs diff and patch to do that. Make sure you have them
installed. Normally, the configure script of GtkAda tries to detect the
presence of diff and patch; check the configure log to see what it
found. If not, install diff and patch and re-run configure and the
installation procedure of GtkAda.
Unless it changed recently, it is documented somewhere that round-trip
reverse engineering doesn't work on Windows (but works very nicely on
Linux), because there is nothing like a standard diff and patch.
There are several well-known long-standing Windows ports of GNU
utilities. Like Cygwin or Gnuwin32, to name a few.
Post by J-P. Rosen
Personnally, I have a laptop under Windows and a desktop under Linux. I
do all GUI work on Linux for that reason, then copy the resulting files
to Windows.
--
Manuel Collado - http://lml.ls.fi.upm.es/~mcollado
J-P. Rosen
2011-05-19 09:57:02 UTC
Permalink
Post by Manuel Collado
Post by J-P. Rosen
Unless it changed recently, it is documented somewhere that round-trip
reverse engineering doesn't work on Windows (but works very nicely on
Linux), because there is nothing like a standard diff and patch.
There are several well-known long-standing Windows ports of GNU
utilities. Like Cygwin or Gnuwin32, to name a few.
Sure, but they are not "standard", for what it means. I.e., you can
reasonably assume that every Unix installation provides diff and patch.
You cannot assume that any Windows installation has cygwin installed.

I am not defending Glade here - just trying to explain why round-trip is
not implemented under Windows. I definitely would welcome an install
parameter where you could define how your diff is named and where it
resides on your machine. The fact is that the Glade maintainers didn't
do it.

(I'm trying to voice this not too loud, or the guys will tell me: "what
a good idea, please do it and we'll be happy to integrate" - that's how
it happens in the free software world. Well, if there are any takers...)
--
---------------------------------------------------------
J-P. Rosen (***@adalog.fr)
Adalog a déménagé / Adalog has moved:
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
Dmitry A. Kazakov
2011-05-18 20:19:42 UTC
Permalink
Post by Gary
Post by Dmitry A. Kazakov
Having reached the level of understanding to tell if the code looks wrong,
why would anybody use Gate? (:-)) Seriously, sooner you ditch the crutches,
sooner you start walking...
Are you suggesting that I dismiss the use of Glade as well or just
Gate?
I am afraid, both. At some stage you will be forced to dismiss them anyway.
Granted, I never looked at them. That is because I had experience with
other GUI generators before. So when I started to learn Gtk I didn't even
bother to look.
Post by Gary
I know Gate converts the XML file to Ada source code, so are you
saying I should keep the XML file and load it at runtime using
Libglade...
XML is a pest. There is no single case where it might be useful or at least
neutral.

If you want some sort of serialization/persistency, skins, localization of
a Gtk application, these are complicated issues to be carefully planed. In
your place I would first experiment with Gtk, before going into this.
Post by Gary
or that I should write the GUI code using "raw" GTK?
Yes, at least to be able to debug it.
Post by Gary
Post by Dmitry A. Kazakov
http://rosettacode.org/wiki/Simple_windowed_application#Ada
This sample app uses GTK code in the source so I am guessing that you
are not in favor of Glade as well as Gate. Am I making the correct
assumption?
Absolutely. Gtk is a very complex thing. I cannot imagine how a code
generator could be used for TreeView, Gdk, Cairo etc. It has no chance.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
Gary
2011-05-18 20:45:29 UTC
Permalink
Post by Dmitry A. Kazakov
Post by Gary
Are you suggesting that I dismiss the use of Glade as well or just
Gate?
I am afraid, both. At some stage you will be forced to dismiss them anyway.
Granted, I never looked at them. That is because I had experience with
other GUI generators before. So when I started to learn Gtk I didn't even
bother to look.
I believe I share your experience quite fully. I enjoy using GUI
builders, but I have always preferred getting into the nuts and bolts
of the code. GTK is a horse of a different color, however, when
compared to most other GUI libraries, owing to the fact that it's
written entirely in C. Your forced to learn all of the nitty gritty
details. I'm not sure I have the time required to do that, hence my
interest in Glade. At least, Gate produces Ada code that you can then
modify to your specific needs. That creates somewhat of a bridge
between the 2 worlds.
Post by Dmitry A. Kazakov
Post by Gary
This sample app uses GTK code in the source so I am guessing that you
are not in favor of Glade as well as Gate. Am I making the correct
assumption?
Absolutely. Gtk is a very complex thing. I cannot imagine how a code
generator could be used for TreeView, Gdk, Cairo etc. It has no chance.
Thanks for your candor.
Dmitry A. Kazakov
2011-05-19 07:36:07 UTC
Permalink
Post by Gary
Your forced to learn all of the nitty gritty
details. I'm not sure I have the time required to do that, hence my
interest in Glade. At least, Gate produces Ada code that you can then
modify to your specific needs. That creates somewhat of a bridge
between the 2 worlds.
That's the point. If the GUI logic could be separated from the program
logic, which is a Holy Grail, but absolutely unrealistic, then it would be
no matter in which language the stuff was generated, Ada or C. You would
not never look at it.

Unfortunately the reality is that the GUI and the functional part of the
program are tightly interwoven. Therefore you need to be in full control of
both and want to shape the program's structure as you want for the sake of
clear design and maintainability (Ada's strengths). Any automatically
generated code is just an obstacle here.

Sorry for sounding daemon's voice again. (:-))
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
J-P. Rosen
2011-05-19 10:02:55 UTC
Permalink
Post by Dmitry A. Kazakov
That's the point. If the GUI logic could be separated from the program
logic, which is a Holy Grail, but absolutely unrealistic, then it would be
no matter in which language the stuff was generated, Ada or C. You would
not never look at it.
Unfortunately the reality is that the GUI and the functional part of the
program are tightly interwoven. Therefore you need to be in full control of
both and want to shape the program's structure as you want for the sake of
clear design and maintainability (Ada's strengths). Any automatically
generated code is just an obstacle here.
Sorry for sounding daemon's voice again. (:-))
I think you should really give Glade a try (I think you said you
didn't). Creating the various widgets (with appropriate parameters!),
stuffing them into containers, connecting call-backs constitute a really
boring (and error-prone) part of the development. That's what Glade does
for you.

In the end, you get your interface built, and a bunch of empty
procedures that you have to fill to do anything useful. These are nicely
separated, therefore you know precisely the parts that you need to fix,
and those that are generated (although looking at what is generated is
quite instructive, of course).
--
---------------------------------------------------------
J-P. Rosen (***@adalog.fr)
Adalog a déménagé / Adalog has moved:
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
Dmitry A. Kazakov
2011-05-19 10:28:16 UTC
Permalink
Post by J-P. Rosen
Post by Dmitry A. Kazakov
That's the point. If the GUI logic could be separated from the program
logic, which is a Holy Grail, but absolutely unrealistic, then it would be
no matter in which language the stuff was generated, Ada or C. You would
not never look at it.
Unfortunately the reality is that the GUI and the functional part of the
program are tightly interwoven. Therefore you need to be in full control of
both and want to shape the program's structure as you want for the sake of
clear design and maintainability (Ada's strengths). Any automatically
generated code is just an obstacle here.
Sorry for sounding daemon's voice again. (:-))
I think you should really give Glade a try (I think you said you
didn't). Creating the various widgets (with appropriate parameters!),
stuffing them into containers, connecting call-backs constitute a really
boring (and error-prone) part of the development.
(That is because they are generics in GtkAda, should have been primitive
operations, but that would require making GtkAda thick bindings)
Post by J-P. Rosen
That's what Glade does for you.
That is easy, comparing to widget subclassing (adding new signals,
properties, resource properties). Then there are custom non-widget objects
to create, e.g. cell renderers, tree stores, interfaces etc. I just don't
believe that any tool could handle this mess. (Gtk is a mess)

BTW, most boring are not handlers but things like putting a limited
component into the widget (for some reason Gtk_Widget_Record is not
limited).

I am almost sure that even handling signals does not really work with
Glade. I don't mean button click events. What about hard stuff, like events
passing parameters accessible only through GValue? There are lots of. What
about passing closure-parameters in events? That is when the receiver
object may disappear before the sender (the callback must be disconnected
before)
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
J-P. Rosen
2011-05-19 15:53:12 UTC
Permalink
Post by Dmitry A. Kazakov
That is easy, comparing to widget subclassing (adding new signals,
properties, resource properties). Then there are custom non-widget objects
to create, e.g. cell renderers, tree stores, interfaces etc. I just don't
believe that any tool could handle this mess. (Gtk is a mess)
Oh, I see. You are talking about extending the widgets. I am talking
about using existing ones. I never had a need to extend widgets, so I
won't comment about this.
Post by Dmitry A. Kazakov
I am almost sure that even handling signals does not really work with
Glade. I don't mean button click events. What about hard stuff, like events
passing parameters accessible only through GValue? There are lots of. What
about passing closure-parameters in events? That is when the receiver
object may disappear before the sender (the callback must be disconnected
before)
Admitedly, I didn't go that far. And I don't think any beginner would
start with that either. Agreed, Glade might not be sufficient for
sophisticated stuff (but you should give it a try, I'm quite sure it is
more able than you think). And Glade is a great way to /learn/ how
GTK/GTKAda work.
Gary
2011-05-19 22:57:05 UTC
Permalink
Thanks to all of you good people, I'm satisfied that this phase of
GtkAda development should perform quite well. I hope some of you can
help me in the next phase that I must evaluate. That being,
incorporating WebKit into GtkAda. I have created a new post entitled
"Using WebKit with GtkAda" that I hope will interest you enough that
you will offer some helpful hints as to how I may accomplish that task.
Yannick Duchêne (Hibou57)
2011-05-20 00:54:27 UTC
Permalink
Post by J-P. Rosen
I think you should really give Glade a try (I think you said you
didn't). Creating the various widgets (with appropriate parameters!),
stuffing them into containers, connecting call-backs constitute a real=
ly
Post by J-P. Rosen
boring (and error-prone) part of the development. That's what Glade do=
es
Post by J-P. Rosen
for you.
Your are mostly right, but I believe to be more correct, we should say a=
n =

UI is better expressed using a declarative language, and not a procedura=
l =

language. Glade (which I only know for the creation of Python UI, not =

tested with GtkAda), indeed offers this declarative approach... anything=
=

else offering a declarative approach instead of the Ada's traditional =

procedural approach, would be as much good.

-- =

Si les chats miaulent et font autant de vocalises bizarres, c=E2=80=99es=
t pas pour =

les chiens.
=E2=80=9C c++; /* this makes c bigger but returns the old value */ =E2=80=
=9D [Anonymous]
Nasser M. Abbasi
2011-05-20 01:41:50 UTC
Permalink
Post by J-P. Rosen
I think you should really give Glade a try (I think you said you
didn't). Creating the various widgets (with appropriate parameters!),
stuffing them into containers, connecting call-backs constitute a really
boring (and error-prone) part of the development. That's what Glade does
for you.
In the end, you get your interface built, and a bunch of empty
procedures that you have to fill to do anything useful. These are nicely
separated, therefore you know precisely the parts that you need to fix,
and those that are generated (although looking at what is generated is
quite instructive, of course).
The above sounds like how also Matlab GUIDE works. It is the 'Glade' for
Matlab. A GUI builder I use all the time to make GUI's with with matlab.

It also creates all the callback stubs, and I just go fill in the body
of the callbacks with the specific action. Very convenient, and will not
dream of developing GUI in another way. This way I concentrate on design
and layout of the GUI and let GUIDE do all the handwork. I got so good
at this, I can write one small GUI application in 1-2 days with Matlab GUI.

For GtkAda, it will be nice if someone may be at wiki Ada or somewhere
can have a link to collection of applications written in GtkAda, where
one can download them and run them. So far, I know of only 2-3 small apps
written in GTKAda. Where are all the open source apps written in GTKAda?

--Nasser
Dmitry A. Kazakov
2011-05-20 07:19:17 UTC
Permalink
Post by Nasser M. Abbasi
For GtkAda, it will be nice if someone may be at wiki Ada or somewhere
can have a link to collection of applications written in GtkAda, where
one can download them and run them.
I doubt that were useful. Anybody who wanted to learn Gtk should rather
look at the tests.

Real-life applications are too complex and contain too much stuff unrelated
to Gtk. They also used to bend Gtk for their specific needs or designer
preferences. For example I hate standard file selection widget, so I
designed my own. A normal user would prefer to learn the standard one
first.
Post by Nasser M. Abbasi
So far, I know of only 2-3 small apps
written in GTKAda.
Where are all the open source apps written in GTKAda?
What kind of application are you looking for? A relatively large one is
this:

http://www.dmitry-kazakov.de/ada/fuzzy_ml.htm

A middle-sized one:

http://www.dmitry-kazakov.de/ada/gps_installer.htm

A small one (physical measurement units converter):

http://www.dmitry-kazakov.de/ada/units.htm

(I bet, neither could be developed using 100% Glade (:-))
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
Nasser M. Abbasi
2011-05-20 07:34:32 UTC
Permalink
Post by Dmitry A. Kazakov
Post by Nasser M. Abbasi
For GtkAda, it will be nice if someone may be at wiki Ada or somewhere
can have a link to collection of applications written in GtkAda, where
one can download them and run them.
I doubt that were useful. Anybody who wanted to learn Gtk should rather
look at the tests.
Real-life applications are too complex and contain too much stuff unrelated
to Gtk. They also used to bend Gtk for their specific needs or designer
preferences. For example I hate standard file selection widget, so I
designed my own. A normal user would prefer to learn the standard one
first.
Post by Nasser M. Abbasi
So far, I know of only 2-3 small apps
written in GTKAda.
Where are all the open source apps written in GTKAda?
What kind of application are you looking for? A relatively large one is
http://www.dmitry-kazakov.de/ada/fuzzy_ml.htm
http://www.dmitry-kazakov.de/ada/gps_installer.htm
http://www.dmitry-kazakov.de/ada/units.htm
(I bet, neither could be developed using 100% Glade (:-))
Hello Dmitry;

I was looking the other day just for examples of applications
written using Ada and GtkAda that I can download and run on my computer
just to get a feeling for how Ada GUI apps work.

Just like small utilites and such. I could only find very few such apps
some are listed here, but old list and not updated for ages.

http://libre.adacore.com/libre/tools/gtkada/

Speeking of GTK, There is now an ongoing effort to make GTK interface
for Fortran also, Here is the web page

https://github.com/jerryd/gtk-fortran/wiki

I have not tried it. But from the examples shown, it also looks good.

--Nasser
Dmitry A. Kazakov
2011-05-20 07:45:48 UTC
Permalink
Post by Nasser M. Abbasi
I was looking the other day just for examples of applications
written using Ada and GtkAda that I can download and run on my computer
just to get a feeling for how Ada GUI apps work.
Just like small utilites and such. I could only find very few such apps
some are listed here, but old list and not updated for ages.
http://libre.adacore.com/libre/tools/gtkada/
Speeking of GTK, There is now an ongoing effort to make GTK interface
for Fortran also, Here is the web page
https://github.com/jerryd/gtk-fortran/wiki
I have not tried it. But from the examples shown, it also looks good.
Just go to the Rosetta Code:

http://rosettacode.org/wiki/Welcome_to_Rosetta_Code

It has such examples straight in GtkAda:

http://rosettacode.org/wiki/Hello_world/Graphical#Ada
http://rosettacode.org/wiki/Simple_windowed_application#Ada
http://rosettacode.org/wiki/GUI_component_interaction#Ada
http://rosettacode.org/wiki/User_input/Graphical#Ada
http://rosettacode.org/wiki/Animation#Ada

etc. All samples in Rosetta Code are required to be complete and working.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
Gautier write-only
2011-05-20 00:26:56 UTC
Permalink
Post by Dmitry A. Kazakov
That's the point. If the GUI logic could be separated from the program
logic, which is a Holy Grail, but absolutely unrealistic, then it would be
no matter in which language the stuff was generated, Ada or C. You would
not never look at it.
Unfortunately the reality is that the GUI and the functional part of the
program are tightly interwoven. Therefore you need to be in full control of
both and want to shape the program's structure as you want for the sake of
clear design and maintainability (Ada's strengths). Any automatically
generated code is just an obstacle here.
Sorry for sounding daemon's voice again. (:-))
I hope the smiley also applies to the last paragraph as well, and that
you are joking by saying "any automatically generated code is just an
obstacle here"...
______________________________________________________________________________
Gautier's Ada programming -- http://gautiersblog.blogspot.com/search/label/Ada
NB: follow the above link for a valid e-mail address
Dmitry A. Kazakov
2011-05-20 07:25:15 UTC
Permalink
Post by Gautier write-only
Post by Dmitry A. Kazakov
Unfortunately the reality is that the GUI and the functional part of the
program are tightly interwoven. Therefore you need to be in full control of
both and want to shape the program's structure as you want for the sake of
clear design and maintainability (Ada's strengths). Any automatically
generated code is just an obstacle here.
Sorry for sounding daemon's voice again. (:-))
I hope the smiley also applies to the last paragraph as well, and that
you are joking by saying "any automatically generated code is just an
obstacle here"...
I am not. BTW, this is one of the arguments against Ada generics. They
wandered to far into the realm of "generated" code.

The point is simple. If the meta language is good, the object language is
irrelevant. Switch to the former. If you cannot, no reason to use it at
all.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
Yannick Duchêne (Hibou57)
2011-05-20 09:50:34 UTC
Permalink
Le Fri, 20 May 2011 09:25:15 +0200, Dmitry A. Kazakov =
Unfortunately the reality is that the GUI and the functional part of=
=
the
program are tightly interwoven. Therefore you need to be in full =
control of
both and want to shape the program's structure as you want for the =
sake of
clear design and maintainability (Ada's strengths). Any automaticall=
y
generated code is just an obstacle here.
Sorry for sounding daemon's voice again. (:-))
I hope the smiley also applies to the last paragraph as well, and tha=
t
you are joking by saying "any automatically generated code is just an=
obstacle here"...
I am not. BTW, this is one of the arguments against Ada generics. They=
wandered to far into the realm of "generated" code.
The point is simple. If the meta language is good, the object language=
is
irrelevant. Switch to the former. If you cannot, no reason to use it a=
t
all.
You could publish an online paper, where you could list and explain all =
=

the grievances your suggest against Ada's generics. May be you already d=
id =

? If so, I would welcome a link.


-- =

Si les chats miaulent et font autant de vocalises bizarres, c=E2=80=99es=
t pas pour =

les chiens.
=E2=80=9C c++; /* this makes c bigger but returns the old value */ =E2=80=
=9D [Anonymous]
Gautier write-only
2011-05-22 06:22:54 UTC
Permalink
Post by Dmitry A. Kazakov
Post by Gautier write-only
I hope the smiley also applies to the last paragraph as well, and that
you are joking by saying "any automatically generated code is just an
obstacle here"...
I am not. BTW, this is one of the arguments against Ada generics. They
wandered to far into the realm of "generated" code.
The point is simple. If the meta language is good, the object language is
irrelevant. Switch to the former. If you cannot, no reason to use it at
all.
I'm afraid that there is some confusion here. The code generated by a
GUI code generator has nothing to do with generics, even
coincidentally. At least the code provided by GWenerator (GWindows),
doesn't use generics. If you mean rather that generated GUI code looks
like instanciated code from Ada generics, yes it looks like, but so
what ? It doesn't go beyond that. And from a pragmatical point of
view, generated code saves lots of time, so it far from being an
obstacle. You make basic, graphical things with the GUI builder, and
with the generated code you get types you can use directly or create
classes and subclasses of GUI objects with additional functionalities,
even fully new widgets. No limitation, just a net gain in time!
G.
Gautier write-only
2011-05-22 07:04:18 UTC
Permalink
Post by Dmitry A. Kazakov
I am not. BTW, this is one of the arguments against Ada generics. They
wandered to far into the realm of "generated" code.
The point is simple. If the meta language is good, the object language is
irrelevant. Switch to the former. If you cannot, no reason to use it at
all.
Mmmh perhaps I guess you.
You may be disturbed by GUI builders that read and write the GUI info
in one kind of language (like a .rc script) and write generated Ada
code from that information, which is a one-way process. It is so
disturbing for a purist that you call it an obstacle. You'd like to
have it all in Ada: i.e. a GUI builder that is able to understand the
Ada code, display the objects, allow the user to modify them and add
other, or even create a class tree, and whenever you press save, you
have the Ada code (eventually several packages) updated ? Sure it is
possible, based on ASIS of course. Certainly a couple of full years of
programming.
Cheers
______________________________________________________________________________
Gautier's Ada programming -- http://gautiersblog.blogspot.com/search/label/Ada
NB: follow the above link for a valid e-mail address
Dmitry A. Kazakov
2011-05-22 08:16:35 UTC
Permalink
Post by Gautier write-only
Post by Dmitry A. Kazakov
I am not. BTW, this is one of the arguments against Ada generics. They
wandered to far into the realm of "generated" code.
The point is simple. If the meta language is good, the object language is
irrelevant. Switch to the former. If you cannot, no reason to use it at
all.
Mmmh perhaps I guess you.
You may be disturbed by GUI builders that read and write the GUI info
in one kind of language (like a .rc script) and write generated Ada
code from that information, which is a one-way process.
Yes that is the problem. GUI builder translates from a language X
(graphical, declarative whatever) into Ada.
Post by Gautier write-only
It is so disturbing for a purist that you call it an obstacle.
If X is so good, why bother about Ada? If not, why do about X?

[There is a possibility of coexistence if applications are separable.]

I am not a purist, I am a practitioner, who has to fight this and similar
mess daily. Any declarative layer (builders, generics/macros, object
models, protocol description languages, DB languages, source control/make
scripts etc) add an immense amount of complexity. It simply does not pay
off.
Post by Gautier write-only
You'd like to
have it all in Ada: i.e. a GUI builder that is able to understand the
Ada code, display the objects, allow the user to modify them and add
other, or even create a class tree, and whenever you press save, you
have the Ada code (eventually several packages) updated ? Sure it is
possible, based on ASIS of course. Certainly a couple of full years of
programming.
You are predicting the death of Ada programming. I am not so optimistic or
pessimistic, depending on what you like. What you describe is will not
happen. [GUI builders exist for more than 20 years.]
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
Yannick Duchêne (Hibou57)
2011-05-20 00:49:09 UTC
Permalink
Le Thu, 19 May 2011 09:36:07 +0200, Dmitry A. Kazakov =
That's the point. If the GUI logic could be separated from the program=
logic, which is a Holy Grail, but absolutely unrealistic, then it woul=
d =
be
no matter in which language the stuff was generated, Ada or C. You wou=
ld
not never look at it.
Unfortunately the reality is that the GUI and the functional part of t=
he
program are tightly interwoven.
Real separation could be achieved if there was a standard protocol for t=
he =

communication between both. Because, to achieve a real separation, there=
=

is the need for the program to communicate with the UI as if it was an =

external entity, not an entity which is part of its own (as it is suppos=
ed =

to be in this thread).

In that matter, the paradigm of the web page (as already noticed in =

another thread) could help to learn to do things this way.

-- =

Si les chats miaulent et font autant de vocalises bizarres, c=E2=80=99es=
t pas pour =

les chiens.
=E2=80=9C c++; /* this makes c bigger but returns the old value */ =E2=80=
=9D [Anonymous]
Dmitry A. Kazakov
2011-05-20 07:36:16 UTC
Permalink
Post by Yannick Duchêne (Hibou57)
Le Thu, 19 May 2011 09:36:07 +0200, Dmitry A. Kazakov
Post by Dmitry A. Kazakov
That's the point. If the GUI logic could be separated from the program
logic, which is a Holy Grail, but absolutely unrealistic, then it would be
no matter in which language the stuff was generated, Ada or C. You would
not never look at it.
Unfortunately the reality is that the GUI and the functional part of the
program are tightly interwoven.
Real separation could be achieved if there was a standard protocol for the
communication between both. Because, to achieve a real separation, there
is the need for the program to communicate with the UI as if it was an
external entity, not an entity which is part of its own (as it is supposed
to be in this thread).
No, take X11 as a counter example.

The problem is not in the physical decoupling, it is in the logical one, as
reflected in the program structure.
Post by Yannick Duchêne (Hibou57)
In that matter, the paradigm of the web page (as already noticed in
another thread) could help to learn to do things this way.
Same as with X11. You have some rendering "hard-/software" VERY
uncomfortable to use. That necessarily leads to creation of a layer to ease
usage of this mess. After that you are back to the square one (things are
coupled again). Gtk is just such a layer.

The whole "progress" of GUI software was about piling such protocols upon
layers and new protocols on them. The result is applications of 1GB size
doing same things 1MB applications did 10 years ago and 100KB ones did 20
years ago.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
Georg Bauhaus
2011-05-20 08:01:29 UTC
Permalink
Post by Yannick Duchêne (Hibou57)
Le Thu, 19 May 2011 09:36:07 +0200, Dmitry A. Kazakov
Post by Dmitry A. Kazakov
Unfortunately the reality is that the GUI and the functional part of the
program are tightly interwoven.
Real separation could be achieved if there was a standard protocol for the
communication between both. Because, to achieve a real separation, there
is the need for the program to communicate with the UI as if it was an
external entity, not an entity which is part of its own (as it is supposed
to be in this thread).
In that matter, the paradigm of the web page (as already noticed in
another thread) could help to learn to do things this way.
Indeed, a web page that does not control another application
programmatically is an interesting comparison.

But I imagine that the new world's operating system, HTML5,
is perfect for obfuscation again: it is about at which end you keep
status information and then, about how the ends of a web program
use it later. For example, you can store status in both
browser local storage and in server side storage. Then,
distribute the whole program's status dependent control
both across web pages and server side programs:
Write source text, e.g. JavaScript functions, that has effects
at the server side, knowing that a later JavaScript function
will then work as intended. Written in such a way, studying the source
of the client side will not reveal anything about the logic of why
the first function controls the second, indirectly.
And neither will studying the server side source reveal
how the web end logic depends on the interaction.
Reminiscent of the PHP case, isn't it?

In fact, according to Douglas Crockford speaking on stage
(URL was posted here recently), vendors are trying to push
for a change to JavaScript that would make it a better object
code language. They are selling tools that reuse their existing
language offerings and will produce Javascript output.
Yannick Duchêne (Hibou57)
2011-05-20 10:00:12 UTC
Permalink
Le Fri, 20 May 2011 10:01:29 +0200, Georg Bauhaus =
Post by Georg Bauhaus
In fact, according to Douglas Crockford speaking on stage
(URL was posted here recently),
A search in the Usenet messages gave me nothing. Do you know the link ?


-- =

Si les chats miaulent et font autant de vocalises bizarres, c=E2=80=99es=
t pas pour =

les chiens.
=E2=80=9C c++; /* this makes c bigger but returns the old value */ =E2=80=
=9D [Anonymous]
Georg Bauhaus
2011-05-20 12:55:40 UTC
Permalink
Post by Yannick Duchêne (Hibou57)
Le Fri, 20 May 2011 10:01:29 +0200, Georg Bauhaus
Post by Georg Bauhaus
In fact, according to Douglas Crockford speaking on stage
(URL was posted here recently),
A search in the Usenet messages gave me nothing. Do you know the link ?
I think I got it from here:
http://www.infoq.com/presentations/Future-of-Programming-Languages
J-P. Rosen
2011-05-19 05:18:41 UTC
Permalink
Post by Gary
Are you suggesting that I dismiss the use of Glade as well or just
Gate? I know Gate converts the XML file to Ada source code, so are you
saying I should keep the XML file and load it at runtime using
Libglade... or that I should write the GUI code using "raw" GTK?
I told you not to listen to daemons ;-) ...

Personnaly, I see no benefit in generating by hand, with lots of trial
and error, what can be generated automatically. Yes, the code generated
by Gate is a skeleton that you have to beef up. But it saves you a lot
of errors; attaching signals f.e. is complicated enough... Moreover,
looking at the generated code is very instructive.

Now, it depends if you want to have your GUI ok rapidly, or want to play
(or learn) more. YMMV.
--
---------------------------------------------------------
J-P. Rosen (***@adalog.fr)
Adalog a déménagé / Adalog has moved:
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
J-P. Rosen
2011-05-19 05:12:07 UTC
Permalink
Post by Gary
I did that but the process is still running on Windows XP after I
close the app. The code that "Gate" generates does not look right to
me. It generates the following code in the "..._pkg_callbacks.adb"
function Gtk_Main_Quit
(Object : access Gtk_Widget_Record'Class;
Params : Gtk.Arguments.Gtk_Args) return Boolean
is
Arg1 : Gdk_Event := To_Event (Params, 1);
begin
return False;
end Gtk_Main_Quit;
This isn't right is it?
Hmmm, looking at my code, where I ask for confirmation to quit:

function Gtk_Main_Quit (Object : access Gtk_Widget_Record'Class;
Params : Gtk.Arguments.Gtk_Args) return Boolean
is
use Gtkada.Dialogs;
begin
if Message_Dialog ("Really quit?",
Confirmation,
Button_OK or Button_Cancel) = Button_OK
then
Gtk.Main.Main_Quit;
return False;
else
return True;
end if;
end Gtk_Main_Quit;

So, you have to call Gtk.Main.Main_Quit explicitely
Rick
2011-05-18 23:31:26 UTC
Permalink
Post by Gary
I am evaluating Ada for a GUI app using GtkAda/Glade. I have the
latest version of Ada from AdaCore.
It may be a problem with your setup/platform. Go to:
http://adasafehouse.webs.com/gtkada.html#Getting Going
and click on GettingGtkAdaGoing.pdf

That might help.

Have a look around while you are there.
Gary
2011-05-19 01:52:51 UTC
Permalink
It may be a problem with your setup/platform.  Go to:http://adasafehouse.webs.com/gtkada.html#GettingGoing
and click on GettingGtkAdaGoing.pdf
Nice site... I've been there before.
Loading...