comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: GtkAda question
Date: Wed, 14 Apr 2021 08:11:39 +0200	[thread overview]
Message-ID: <s5612r$1c9l$1@gioia.aioe.org> (raw)
In-Reply-To: 60760ecb$0$3674$426a74cc@news.free.fr

On 2021-04-13 23:36, DrPi wrote:
> Le 13/04/2021 à 13:55, Dmitry A. Kazakov a écrit :
>> On 2021-04-13 13:07, DrPi wrote:
>>
>>> That's what I've written (and use).
>>> However, I think the use of Error is incorrect in all Key_File 
>>> functions.
>>> I will investigate further.
>>
>> Handling GError is tricky. You must call Error_Free on it if returned 
>> not null.
>>
> Yes, I've read this in the Gtk documentation.
> 
> Is there a good GtkAda documentation (with examples) somewhere ?

No that I know. BTW, that would not be documentation, rather tutorial, 
book etc. GtkAda is only bindings. You would not expect it to cover Gtk 
topics.

> I've found a french tutorial. Very instructive but incomplete and a 
> little bit outdated.
> I also read Test code in GtkAda repository. Again, useful but very 
> incomplete.

Use Gtk tutorials and then translate that knowledge back to GtkAda, it 
is more or less straightforward.

>> Why on Earth you even use Key_File? It is much simpler to parse 
>> manually in Ada.
> When I need a functionality I start to look at what already exists.
> Key_File is what I need. Why rewrite it myself ?

I doubt anybody needs g_key_file. For start, it loads all file into the 
memory. Surely you do not want that if there are lots of parameters and 
settings. Or, put it this way, if you can load/store your parameters 
object, then there are better means than *.ini files.

If you cannot then you need some cashing infrastructure to avoid massive 
I/O (and potential data loss). A typical solution for the latter would 
be a persistent storage, maybe, backed by a DB, like SQLite or a custom 
written storage. Or things like GtkRecentManager [*] and Windows registry.

> And I currently don't have the knowledge to write it myself.

You do not know Ada text I/O or Ada stream attributes?

> I'm learning Ada at home, on my spare time. And lazy I am. For sure ;)

Even more reasons to write it yourself all in Ada [**].

----
* Note that GtkRecentManager suffers the potential problems I mentioned. 
You may experience corruption of *.xbel files (the equivalent to *.ini, 
but in XML) because it is poorly designed.

** I see in another response that it is already done in Ada. Though I 
never used it, I am certain it is better designed and written than 
g_key_file.

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

  reply	other threads:[~2021-04-14  6:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-12 21:45 GtkAda question DrPi
2021-04-13  9:53 ` Blady
2021-04-13 11:07   ` DrPi
2021-04-13 11:55     ` Dmitry A. Kazakov
2021-04-13 21:36       ` DrPi
2021-04-14  6:11         ` Dmitry A. Kazakov [this message]
2021-04-14 10:21           ` Emmanuel Briot
2021-04-14 19:28             ` DrPi
2021-04-14 20:23           ` DrPi
2021-04-14 21:05             ` Dmitry A. Kazakov
2021-04-17 19:56               ` DrPi
2021-04-13 22:00 ` Gautier write-only address
2021-04-14 19:27   ` DrPi
2021-04-14 20:40     ` Dmitry A. Kazakov
2021-04-17 19:58       ` DrPi
2021-04-18  9:34 ` DrPi
replies disabled

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