Re: GTK4 documentation



Emmanuele,

On Tue, Dec 12, 2017 at 4:46 PM, Emmanuele Bassi <ebassi gmail com> wrote:
On 12 December 2017 at 20:19, Igor Korot <ikorot01 gmail com> wrote:
Hi, Emmanuelle,

On Tue, Dec 12, 2017 at 1:29 PM, Emmanuele Bassi <ebassi gmail com> wrote:
On 12 December 2017 at 18:19, Igor Korot <ikorot01 gmail com> wrote:
 Hi, ALL,
On the page https://developer.gnome.org/gtk4/stable/gtk4-General.html
in the "Description"
part in the sample code it is referencing the "gtk_init( &argc, &argv );".
However, if you look at the actual function -
https://developer.gnome.org/gtk4/stable/gtk4-General.html#gtk-init -
it is documented as "void gtk_init(void);", i.e. it does not take any
arguments.

I am not sure which one is correct - just wanted to report this to you guys.

The reference hasn't been updated, as we're still releasing developers
snapshots and we're churning on the API. By the time 4.0 is released,
the API reference will be updated.

This probably means that you are aware of that, right?
However you decision is not that good - for people who will want to port early
at least.
I don't know if I'm the only one or not, but...

Porting this early without actually talking to the GTK team, looking
at the headers, compiler warnings, and at the toolkit code, is not
entirely a good plan. We are heavily refactoring rendering, event
handling, and soon layout. We're also documenting as we go along, but
not everything is kept up to date, given the churn rate.

So when do you think you will have something usable?
And approximately, going from GTK3 to GTK4 will be a huge task?

Like I said - it looks like all those deprecated functions will be
removed in the GTK+4,
and therefore we will need to find a replacements or re-write that code.



Moreover, if the function is documented correctly, then there is no
way to pass command-line
arguments to the program. Or is there?

First of all, the arguments vector you passed to gtk_init() were for
GDK and GTK *only*, not for your application; gtk_init() has always
removed the arguments it interpreted, and then gave the arguments
vector back to you, to do with it as you pleased. Historically, you
typically should have gotten the GOptionGroup from GDK and GTK, added
it to your GOptionContext, and then parsed the arguments vector using
g_option_context_parse().

Does this mean this will be changed?
And I will have to rewrite this piece of code completely?

I don't know what you'll have to change, because I don't know what you're doing.

You should *already* be using the GTK and GDK option groups with GTK+
2.x and 3.x, if you're using GOptionContext; it's definitely easier
than calling gtk_init() to parse the arguments vector, and then
calling g_option_context_parse() to parse the arguments vector again.

In GTK+ 4.x, we removed the command line arguments for GDK and GTK, in
favour of settings and environment variables — the same ones we
already used, like DISPLAY, or G_DEBUG. This simplifies the
initialisation process, and it ensures that your application is in
charge of parsing the command line, not the library (or libraries) you
happen to use.


So there will be no more GOptionGroup/Context?

That's a radical interpretation of what I wrote — in other words:
that's not what I said.

In GTK+ 4.0, the toolkit won't add any command line argument on top of
the ones you have; the way you parse your own command line arguments
is entirely your own.

Ok, yes, this simplifies things.
So command line arguments will not be changed - whatever I pass in
I will need to parse and that is all.

Thank you.


Ciao,
 Emmanuele.

--
https://www.bassi.io
[@] ebassi [@gmail.com]


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