After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 748806 - GVariant: Better introduction to the concepts and its uses
GVariant: Better introduction to the concepts and its uses
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: docs
2.45.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2015-05-02 17:58 UTC by Bastian Ilsø
Modified: 2016-04-13 11:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gvariant.c: Elaborate on GVariant concept and its use (2.06 KB, patch)
2015-05-02 17:58 UTC, Bastian Ilsø
committed Details | Review
docs: Clean up the GVariant introduction (2.48 KB, patch)
2016-04-12 10:05 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review

Description Bastian Ilsø 2015-05-02 17:58:50 UTC
Created attachment 302764 [details] [review]
gvariant.c: Elaborate on GVariant concept and its use

From a newcomer-to-glib's point of view, the current documentation on GVariant[0] could be more elaborate on what GVariant is and how it can be possibly be used.

Attached patch is a proposal which adds some text briefly explaining the concept of GVariance and its uses.

[0]: https://developer.gnome.org/glib/unstable/glib-GVariant.html
Comment 1 Matthias Clasen 2016-04-12 03:29:41 UTC
Attachment 302764 [details] pushed as 985ae37 - gvariant.c: Elaborate on GVariant concept and its use
Comment 2 Jan Alexander Steffens (heftig) 2016-04-12 08:38:55 UTC
+ * When declaring a new GVariant, you parse the data you want to store in it
+ * along with a string representing the type of data you wish to parse to it.
+ * If you, for example, want to make a GVariant holding a string:
+ * |[<!-- language="C" -->
+ * g_variant_new('u','40');
+ * ]|
+ * The string 'u' tells GVariant that the data parsed to it (40) is an integer.

This seems completely wrong, and the code would create, if the compiler accepts it, a variant that holds the uint32 value of the multichar constant '40', probably 13360.
Comment 3 Emmanuele Bassi (:ebassi) 2016-04-12 10:05:06 UTC
Created attachment 325781 [details] [review]
docs: Clean up the GVariant introduction

Fix the example, as well as the consistency in the terms.
Comment 4 Colin Walters 2016-04-12 12:58:53 UTC
Review of attachment 325781 [details] [review]:

LGTM
Comment 5 Emmanuele Bassi (:ebassi) 2016-04-13 08:53:37 UTC
Attachment 325781 [details] pushed as a772c28 - docs: Clean up the GVariant introduction
Comment 6 Krzesimir Nowak 2016-04-13 11:09:56 UTC
The compiler should not accept this code [g_variant_new('u', 40)], because 'u' is not a string.