Re: GTK4 documentation

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

 



On 12 December 2017 at 20:19, Igor Korot <ikorot01@xxxxxxxxx> wrote:
> Hi, Emmanuelle,
>
> On Tue, Dec 12, 2017 at 1:29 PM, Emmanuele Bassi <ebassi@xxxxxxxxx> wrote:
>> On 12 December 2017 at 18:19, Igor Korot <ikorot01@xxxxxxxxx> 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
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list




[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux