Commit Graph

72 Commits

Author SHA1 Message Date
Emmanuele Bassi
f952fdf3fc Drop trailing semi-colon from G_DEFINE_ macro
It's unnecessary, and only adds visual noise; we have been fairly
inconsistent in the past, but the semi-colon-less version clearly
dominates in the code base.

https://bugzilla.gnome.org/show_bug.cgi?id=669355
2017-04-10 10:38:31 +01:00
Christian Hergert
18a33f72db introspection: use (nullable) or (optional) instead of (allow-none)
If we have an input parameter (or return value) we need to use (nullable).
However, if it is an (inout) or (out) parameter, (optional) is sufficient.

It looks like (nullable) could be used for everything according to the
Annotation documentation, but (optional) is more specific.
2016-11-22 14:14:37 -08:00
Philip Withnall
25a7c817d3 glib: Add missing (nullable) and (optional) annotations
Add various (nullable) and (optional) annotations which were missing
from a variety of functions. Also port a couple of existing (allow-none)
annotations in the same files to use (nullable) and (optional) as
appropriate instead.

Secondly, add various (not nullable) annotations as needed by the new
default in gobject-introspection of marking gpointers as (nullable). See
https://bugzilla.gnome.org/show_bug.cgi?id=729660.

This includes adding some stub documentation comments for the
assertion macro error functions, which weren’t previously documented.
The new comments are purely to allow for annotations, and hence are
marked as (skip) to prevent the symbols appearing in the GIR file.

https://bugzilla.gnome.org/show_bug.cgi?id=719966
2015-11-07 10:48:32 +01:00
Bastien Nocera
43df97ab86 goption: Add boxed type for GOptionGroup
This would allow bindings to use _get_option_group() functions, which
would then allow them to use GOption parsing.

This also adds introspection annotations to
g_option_context_add_group(), g_option_context_set_main_group() and
g_option_context_get_main_group().

https://bugzilla.gnome.org/show_bug.cgi?id=743349
2015-02-11 15:32:00 +01:00
Xavier Claessens
6a97275c45 docs: fix many documentation issues in gobject/ 2015-02-05 16:01:17 +01:00
Ryan Lortie
78ec35f7ab gobject: box GVariantDict
We will want to use this in GApplication for a signal and a property.

https://bugzilla.gnome.org/show_bug.cgi?id=625408
2014-02-04 12:24:19 +00:00
Daniel Mustieles
078dbda148 Updated FSF's address 2014-01-31 14:31:55 +01:00
Rico Tzschichholz
ee38a1af80 gobject: Add missing transfer annotation to g_boxed_copy 2014-01-23 17:22:19 +01:00
Ray Strode
cfc8215fc1 gobject: Box GMappedFile
GMappedFile is current unintrospectable, because it's not a registered
box type.  It already has reference counting functions, so there's
little reason not to box it.

This commit adds GMappedFile to the hoard of other boxes types handled
by gboxed.c

https://bugzilla.gnome.org/show_bug.cgi?id=712393
2013-11-15 15:56:26 -05:00
Dan Winship
4b94c0831e Use 'dumb quotes' rather than `really dumb quotes'
Back in the far-off twentieth century, it was normal on unix
workstations for U+0060 GRAVE ACCENT to be drawn as "‛" and for U+0027
APOSTROPHE to be drawn as "’". This led to the convention of using
them as poor-man's ‛smart quotes’ in ASCII-only text.

However, "'" is now universally drawn as a vertical line, and "`" at a
45-degree angle, making them an `odd couple' when used together.

Unfortunately, there are lots of very old strings in glib, and also
lots of new strings in which people have kept up the old tradition,
perhaps entirely unaware that it used to not look stupid.

Fix this by just using 'dumb quotes' everywhere.

https://bugzilla.gnome.org/show_bug.cgi?id=700746
2013-05-21 11:23:22 -03:00
Jasper St. Pierre
5e62827efd gmarkup: Make GMarkupParseContext a boxed type
At the same time, add a refcount and public ref/unref methods.
This makes it usable from introspectable.

https://bugzilla.gnome.org/show_bug.cgi?id=690084
2013-01-01 11:03:19 -05:00
Colin Walters
bf1e63c2aa Make GChecksum more fully introspectable
In 2.34, g_compute_checksum_for_bytes() was added, but this patch
allows binding users to use the incremental update API; this is
significantly more efficient than reading entire files into memory.

https://bugzilla.gnome.org/show_bug.cgi?id=689982
2012-12-10 20:08:09 -05:00
Sebastian Dröge
46a92a760b Add boxed GType for GThread
https://bugzilla.gnome.org/show_bug.cgi?id=688704
2012-11-20 15:03:06 +01:00
Martin Pitt
1af1b2b2bb Box GPollFD to make it introspectable
https://bugzilla.gnome.org/show_bug.cgi?id=686797
2012-11-05 14:41:31 +01:00
Martin Pitt
a5c5730085 Revert "Box GPollFD to make it introspectable"
This reverts commit 932f4250b8.

This got pushed accidentally and has not been accepted yet. It's also not clear
whether we want this in the first place.

https://bugzilla.gnome.org/show_bug.cgi?id=686797
2012-10-25 11:27:39 +02:00
Martin Pitt
932f4250b8 Box GPollFD to make it introspectable
https://bugzilla.gnome.org/show_bug.cgi?id=686797
2012-10-25 07:58:09 +02:00
Martin Pitt
02f143c2d9 Box GTimeZone to make it introspectable
https://bugzilla.gnome.org/show_bug.cgi?id=683167
2012-09-06 06:18:42 +02:00
Christian Persch
d70634526d regex: Remove --disable-regex option
https://bugzilla.gnome.org/show_bug.cgi?id=622149
2012-02-26 22:22:56 -05:00
Emmanuele Bassi
0ac9ab4e27 Deprecate GValueArray
The GValueArray type was added in a time, during the Jurassic era or so,
when GArray did not have a representable GType. The GValueArray API has
various issues as well:

  - it doesn't match the other GLib array types;
  - it is not reference counted;
  - the structure is fully exposed on the stack, so it cannot be
    extended to add reference counting;
  - it cannot be forcibly resized.

The nice thing is that now we have a GArray type that can replace in
full GValueArray, so we can deprecate the latter, and reduce the
complexity in GLib, application code, and bindings.

https://bugzilla.gnome.org/show_bug.cgi?id=667228
2012-01-24 23:37:24 -05:00
Nicola Fontana
f24d8247b3 Do not use static GTypeInfo and GInterfaceInfo
Either g_type_register_static_simple (used by G_DEFINE_TYPE_EXTENDED)
and G_IMPLEMENT_INTERFACE use automatic variables for GTypeInfo and
GInterfaceInfo structs, while tutorials and source code often use
static variables. This commit consistently adopts the former method.

https://bugzilla.gnome.org/show_bug.cgi?id=600161
2011-11-29 22:03:25 -05:00
Stef Walter
fcc69fd318 GBytes: A new type for an immutable set of bytes.
* Represents an immutable reference counted block of memory.
 * This is basically the internal glib GBuffer structure exposed,
   renamed, and with some additional capabilities.
 * The GBytes name comes from python3's immutable 'bytes' type
 * GBytes can be safely used as keys in hash tables, and have
   functions for doing so: g_bytes_hash, g_bytes_equal
 * GByteArray is a mutable form of GBytes, and vice versa. There
   are functions for converting from one to the other efficiently:
   g_bytes_unref_to_array() and g_byte_array_free_to_bytes()
 * Adds g_byte_array_new_take() to support above functions

https://bugzilla.gnome.org/show_bug.cgi?id=663291
2011-11-24 08:58:38 +01:00
Giovanni Campagna
96817746d9 Turn GKeyFile into a boxed for introspection
Using the new refcounting API, introduce a boxed type wrapping
GKeyFile and expose it introspection bindings in glib-types.h.
2011-10-15 17:51:25 -04:00
Pavel Holejsovsky
fe4fc3e8b5 Make GMainLoop, GMainContext and GSource boxed types
Also add some annotations for better usage of these types in bindings.

https://bugzilla.gnome.org/show_bug.cgi?id=657725
2011-08-31 09:37:51 +02:00
Matthias Clasen
1b28408b8b Spelling fixes
Spelling fixes in comments and docs, provided by
Kjartan Maraas in bug 657336.
2011-08-29 14:49:32 -04:00
Pavel Holejsovsky
d4c5e3b156 Add (allow-none) annotation for GValue setters.
Assorted g_value_set_xxx() and g_value_take_xxx() functions actually
allow NULL in source parameter.
2011-08-17 12:55:12 +02:00
Christian Persch
316efa1b5d Add boxed GType for GMatchInfo 2011-06-24 01:03:50 +02:00
Colin Walters
3bd3067ffc gobject: Use _ prefixing in private headers over G_GNUC_INTERNAL in public headers
This helps out gtk-doc and g-ir-scanner, and also makes much clearer
what's private versus public.

https://bugzilla.gnome.org/show_bug.cgi?id=651745
2011-06-03 12:40:01 -04:00
Colin Walters
a06863de60 Add a boxed type for GVariantBuilder, mark GVariantIter as (skip)
Based on a patch by Giovanni Campagna <gcampagna@src.gnome.org>

From discussion, GVariantIter is not useful for bindings, but
GVariantBuilder may be.

https://bugzilla.gnome.org/show_bug.cgi?id=646635
2011-05-31 13:37:14 -04:00
Pavel Holejsovsky
ea577d60d4 Add GI annotations to GValue and GValueArray. 2010-12-19 10:39:36 +01:00
Thiago Santos
e35ed21f43 datetime: Add GDateTime to the GType system
As with other GLib data types, use a GBoxed.
2010-08-24 23:41:21 +01:00
Christian Persch
71e73ffdfb Use G_DEFINE_[BOXED|POINTER]_TYPE instead of handwritten code
Now that we have convenience macros to implement boxed and pointer
types, use them.
2010-08-18 00:12:28 +02:00
Ryan Lortie
0fc50fa5f7 gobject/: fully remove gobjectalias hacks 2010-07-07 19:40:48 -04:00
Christian Persch
4708b8ecc3 Add fundamental type and pspec for GVariant
Make G_TYPE_VARIANT a fundamental type instead of boxed, and add
g_variant_{set,get,dup}_variant.

Add GParamSpecVariant.

Bug #610863.
2010-06-17 21:00:54 +02:00
Matthias Clasen
b440cc1546 Add a boxed type for GError
Patch by Sebastian Dröge, bug 614541
2010-04-22 20:10:56 -04:00
Ryan Lortie
1e655eb02c merge GVariant 2010-02-10 11:35:01 -05:00
Benjamin Otte
11d4e59712 Move the boxed private type data to TypeNode
This way we don't need to keep a custom array that we bsearch on (and
that isn't threadsafe) but can use the gtype.c machinery that is
threadsafe. And fast, too!

https://bugzilla.gnome.org/show_bug.cgi?id=554887
2010-01-25 15:30:38 +01:00
Benjamin Otte
ac666d2ae3 Put calls to registered copy/free functions into separate functions
This eases cleaning up these functions.

One optimization in value_set_internal() was lost in the process. It
shouldn't cause too many issues when all is said and done.

https://bugzilla.gnome.org/show_bug.cgi?id=554887
2010-01-25 15:30:38 +01:00
David Zeuthen
402847c887 Bug 580450 – Reference counting and boxed types for arrays
Add reference counting and boxed types for GArray, GByteArray and GPtrArray.

Signed-off-by: Matthias Clasen <mclasen@redhat.com>
2009-04-29 11:17:23 -04:00
Matthias Clasen
a5fd60a8ac Define an ENABLE_REGEX macro
* configure.in: Define an ENABLE_REGEX macro

        * gobject/gboxed.c: Don't refer to g_regex_ref if ENABLE_REGEX
        is not defined.


svn path=/trunk/; revision=7815
2009-01-18 06:53:44 +00:00
Matthias Clasen
d6d221911d Fix up section comments
svn path=/trunk/; revision=7137
2008-07-02 03:43:13 +00:00
Michael Natterer
6347be5fb6 remove trailing whitespace from newly added gtk-doc comments and
2008-06-22  Michael Natterer  <mitch@imendio.com>

	* *.c: remove trailing whitespace from newly added gtk-doc
	comments and reformatted some where they contained overly long or
	ill-formatted lines.


svn path=/trunk/; revision=7090
2008-06-22 14:53:09 +00:00
Michael Natterer
5602b7e275 moved includes back to the top of the files (before gtk-doc SECTION
2008-06-22  Michael Natterer  <mitch@imendio.com>

	* *.c: moved includes back to the top of the files (before gtk-doc
	SECTION comments). Add "config.h" in all files and move system
	included before glib includes. Remove trailing whitespace from
	SECTION comments and did some reformatting where lines were overly
	long, no documentation content was changed.


svn path=/trunk/; revision=7089
2008-06-22 14:29:25 +00:00
Stefan Kost
fca3fb5818 Migrating docs.
* docs/reference/gobject/tmpl/param_value_types.sgml:
	* gobject/gboxed.c:
	* gobject/gboxed.h:
	* gobject/genums.c:
	* gobject/genums.h:
	* gobject/gobject.c:
	* gobject/gobject.h:
	* gobject/gparam.c:
	* gobject/gparam.h:
	* gobject/gparamspecs.c:
	* gobject/gparamspecs.h:
	* gobject/gvaluetypes.c:
	* gobject/gvaluetypes.h:
	  Migrating docs.


svn path=/trunk/; revision=7081
2008-06-21 22:16:14 +00:00
Stefan Kost
bce5ebd421 Add titles back from tmpl.
* gobject/gboxed.c:
	* gobject/gclosure.c:
	* gobject/genums.c:
	* gobject/gparam.c:
	* gobject/gvalue.c:
	  Add titles back from tmpl.


svn path=/trunk/; revision=7076
2008-06-21 16:24:52 +00:00
Stefan Kost
d5f1c71fde Use file-names from the section file for SECTION: comments.
* gobject/gboxed.c:
	* gobject/gclosure.c:
	* gobject/genums.c:
	* gobject/gvalue.c:
	  Use file-names from the section file for SECTION: comments.


svn path=/trunk/; revision=7072
2008-06-21 12:57:06 +00:00
Stefan Kost
86a0f779f6 Migrating docs.
* docs/reference/gobject/tmpl/gboxed.sgml:
	* gobject/gboxed.c:
	* gobject/gboxed.h:
	* gobject/gvaluetypes.c:
	  Migrating docs.


svn path=/trunk/; revision=7065
2008-06-21 10:19:58 +00:00
Cody Russell
49f802b83e Added GRegex boxed type. (#445065, Carlos Garnacho)
2007-06-15  Cody Russell  <bratsche@gnome.org>

	* docs/reference/gobject/tmpl/gboxed.sgml:
	* docs/reference/gobject/gobject-sections.txt:
	* glib/gregex.c:
	* gobject/gboxed.[ch]:
	* gobject/gobject.symbols: Added GRegex boxed type.
	(#445065, Carlos Garnacho)


svn path=/trunk/; revision=5566
2007-06-15 16:31:21 +00:00
Tim Janik
02b62d08cc minor cleanups, implemented G_TYPE_HASH_TABLE.
Wed Nov 23 13:36:02 2005  Tim Janik  <timj@gtk.org>

        * gboxed.[hc]: minor cleanups, implemented G_TYPE_HASH_TABLE.
2005-11-23 12:37:01 +00:00
Matthias Clasen
63b1b0c187 More string interning 2005-08-31 17:56:49 +00:00
Matthias Clasen
07c4d80d55 Intern type names before registering the type to avoid unnecessary copies.
2005-08-31  Matthias Clasen  <mclasen@redhat.com>

	* gvaluetypes.c (g_value_types_init):
	* gtypeplugin.c (g_type_plugin_get_type):
	* gtypemodule.c (g_type_module_get_type):
	* gparam.c (g_param_type_init):
	* gobject.c (g_object_type_init):
	* genums.c (g_enum_types_init):
	* gboxed.c (g_boxed_type_init): Intern type names
	before registering the type to avoid unnecessary
	copies.
2005-08-31 14:38:18 +00:00