Re: GTK4 documentation

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: GTK4 documentation

Igor Korot
Hi, Emmanuelle,

On Tue, Dec 12, 2017 at 1:29 PM, Emmanuele Bassi <[hidden email]> wrote:

> On 12 December 2017 at 18:19, Igor Korot <[hidden email]> 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...

>
>> 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?

>
> 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?

Thank you.

> Finally, you should not be using gtk_init()/gtk_main() in newly
> written code even with GTK+ 3.x; use GtkApplication instead, as it's
> the preferred way to create an application with modern GTK.
>
> Ciao,
>  Emmanuele.
>
> --
> https://www.bassi.io
> [@] ebassi [@gmail.com]
_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
LRN
Reply | Threaded
Open this post in threaded view
|

Re: GTK4 documentation

LRN
On 12/12/2017 10:29 PM, Emmanuele Bassi wrote:

> On 12 December 2017 at 18:19, Igor Korot <[hidden email]> 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.
Ironic, since the documentation URL has the word "stable" in it...


_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list

signature.asc (875 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: GTK4 documentation

Emmanuele Bassi
On 12 December 2017 at 20:34,  <[hidden email]> wrote:

> On 12/12/2017 10:29 PM, Emmanuele Bassi wrote:
>> On 12 December 2017 at 18:19, Igor Korot <[hidden email]> 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.
>
> Ironic, since the documentation URL has the word "stable" in it...

That's an issue of the developer.gnome.org website.

The API series is going to be 4.x, thus stable, but we're releasing
snapshots, thus unstable. We need to release something that is already
namespaced with "4", otherwise we'd overwrite the 3.x documentation,
introspection, and development files.

Ciao,
 Emmanuele.

--
https://www.bassi.io
[@] ebassi [@gmail.com]
_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re: GTK4 documentation

Emmanuele Bassi
In reply to this post by Igor Korot
On 12 December 2017 at 20:19, Igor Korot <[hidden email]> wrote:

> Hi, Emmanuelle,
>
> On Tue, Dec 12, 2017 at 1:29 PM, Emmanuele Bassi <[hidden email]> wrote:
>> On 12 December 2017 at 18:19, Igor Korot <[hidden email]> 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.

>>
>>> 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.

Ciao,
 Emmanuele.

--
https://www.bassi.io
[@] ebassi [@gmail.com]
_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list