Commit Graph

106 Commits

Author SHA1 Message Date
Ryan Lortie
0156092a42 various: add GLIB_AVAILABLE_IN_ALL everywhere else
Add the GLIB_AVAILABLE_IN_ALL annotation to all old functions (that
haven't already been annotated with the GLIB_AVAILABLE_IN_* macros or a
deprecation macro).

If we discover in the future that we cannot use only one macro on
Windows, it will be an easy sed patch to fix that.

https://bugzilla.gnome.org/show_bug.cgi?id=688681
2013-01-13 13:11:57 -05:00
Matthias Clasen
e1b99b2ddc Move single-include guards inside include guards
gcc has optimizations for include guards that only work
if they are outermost in the the header.
https://bugzilla.gnome.org/show_bug.cgi?id=689810
2012-12-27 23:43:14 -05:00
Alexander Larsson
e218b96a6b Add g_type_get_type_registration_serial()
This lets you cache type lookup information and then know when
the cache information is out of date. In particular, we want this
in order to be able to cache g_type_from_name() lookups in the Gtk+
theme machinery.

https://bugzilla.gnome.org/show_bug.cgi?id=689847
2012-12-10 12:55:28 +01:00
Ryan Lortie
df02fa1e4c Properly deprecate g_type_init()
Now that all internal users of it are gone.

https://bugzilla.gnome.org/show_bug.cgi?id=686161
2012-10-16 09:39:24 -04:00
Ryan Lortie
7c42ab23b5 Convert g_type_init() to a ctor
Move the guts of g_type_init() into a ctor and turn g_type_init() itself
into a do-nothing function.

g_type_init_with_debug_flags() now ignores its arguments, but it has
always been possible to achieve the same effect via environment
variables.

https://bugzilla.gnome.org/show_bug.cgi?id=686161
2012-10-16 09:39:24 -04:00
Emmanuele Bassi
2a87010831 Constify collect and lcopy strings in GTypeValueTable
This avoids warnings when creating idiomatic value tables, like:

  static const GTypeValueTable _clutter_shader_float_value_table = {
    clutter_value_init_shader_float,
    clutter_value_free_shader_float,
    clutter_value_copy_shader_float,
    clutter_value_peek_pointer,
    "ip",
    clutter_value_collect_shader_float,
    "pp",
    clutter_value_lcopy_shader_float
  };

Because the strings are literals. And, really: nobody should be using
allocated values for the collection and lcopy strings.

https://bugzilla.gnome.org/show_bug.cgi?id=671545
2012-07-05 23:27:35 -04:00
Dan Winship
e011d2c921 Add g_type_ensure() and use it rather than playing games with volatile
https://bugzilla.gnome.org/show_bug.cgi?id=605976
2012-05-15 13:46:38 -04: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
Ryan Lortie
9829d04be8 GObject docs: resolve broken links
Some links were broken due to typos, because functionality was removed
in GLib 2.0 or for various other reasons.  Fix up as many of them as is
reasonable.
2011-09-05 18:46:59 -04:00
Behdad Esfahbod
ea6e2968bf [gobject] Fix G_DEFINE_BOXED_TYPE compilation with C++ 2011-08-11 19:03:02 +02:00
Ryan Lortie
8073759f8c Remove all uses of G_CONST_RETURN
Just use 'const'.

https://bugzilla.gnome.org/show_bug.cgi?id=644611
2011-06-09 11:15:40 -04: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
Murray Cumming
30fdc1a799 Docs: Changed can not to cannot. 2011-03-24 09:33:55 +01:00
Emmanuele Bassi
08f0a31289 Revert "Remove all uses of G_CONST_RETURN"
This reverts commit 36741245cc.

The removal has not been discussed, except on Bugzilla:

https://bugzilla.gnome.org/show_bug.cgi?id=644611
2011-03-15 09:03:28 +00:00
Ryan Lortie
36741245cc Remove all uses of G_CONST_RETURN
Just use 'const'.
2011-03-15 01:32:22 -04:00
Matthias Clasen
9dd1f75a41 Document G_VALUE_NOCOPY_CONTENTS
https://bugzilla.gnome.org/show_bug.cgi?id=624943
2011-02-18 22:42:24 -05:00
Christian Persch
dc1999316d Add G_DEFINE_{BOXED,POINTER}_TYPE[_WITH_CODE]
Add convenience type definition macros for boxed and pointer types
similar to G_DEFINE_TYPE for object types. Bug #449565.
2010-08-18 00:12:22 +02:00
Christian Persch
db68f8203a Add g_value_take_variant
Turns out we do need g_value_take_variant(), so we can correctly
implement VARIANT:* marshalers.

Bug #621947.
2010-06-19 19:07:36 +02: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
Sebastian Dröge
41383b303c Bug 612502 - Add support for class private data
This adds the two new functions g_type_add_class_private()
and g_type_class_get_private() and a convenience macro
for the getter G_TYPE_CLASS_GET_PRIVATE().
2010-03-17 15:11:00 +01:00
Javier Jardón
dba6cef3c9 [docs] Fix G_DEFINE_INTERFACE "Since" tag
This symbol is available since Glib 2.24, not 2.20.
2009-12-21 23:07:13 +01:00
Javier Jardón
9917024949 G_DEFINE_INTERFACE_* documentation is not generated
Fix the documentation: Replace "@Since:" with "Since:"

https://bugzilla.gnome.org/show_bug.cgi?id=604645
2009-12-19 02:17:33 +01:00
Dan Winship
91d96350a7 Add G_DEFINE_INTERFACE
This is a macro similar to G_DEFINE_TYPE but it lets you define
interfaces rather than classes.

For discussion, see bug #320482
2009-12-01 10:44:42 +01:00
Edward Hervey
68b1ca0443 gobject/gtype.h: Fix _G_TYPE_CVH macro. Fixes #597194
If __val doesn't exist, we shouldn't do any other checks.
2009-10-03 16:17:17 +02:00
Matthias Clasen
8b3853b8a1 Reduce false positives in static analysis
Tools like clang fail to recognize that stanzas like
g_return_if_fail (GTK_IS_FOO (w)) guarantee w != NULL. By minimally
rewriting the type-checking macros, we can avoid these false positives.
2009-09-18 19:20:06 -04:00
Matthias Clasen
e68a35689f Fix G_DEFINE_TYPE_EXTENDED docs
Make the docs for G_DEFINE_TYPE_EXTENDED match the actual
definition of the macro.  (#577985)
2009-04-09 14:56:49 -04:00
Tor Lillqvist
e5e4f8bca3 gtype.h Revert my change from 2008-07-24. No G_TYPE_FORMAT is needed. Just
2008-07-27  Tor Lillqvist  <tml@novell.com>

	* gtype.h
	* gtype.c: Revert my change from 2008-07-24. No G_TYPE_FORMAT is
	needed. Just use G_GSIZE_FORMAT always when printing GType values.


svn path=/trunk/; revision=7256
2008-07-27 15:58:48 +00:00
Tor Lillqvist
b46641eab2 Define G_TYPE_FORMAT as the printf format for a GType value. Either
2008-07-24  Tor Lillqvist  <tml@novell.com>

	* gtype.h: Define G_TYPE_FORMAT as the printf format for a GType
	value. Either G_GSIZE_FORMAT or "lu".

	* gtype.c: Use it instead of the C99 zu.


svn path=/trunk/; revision=7250
2008-07-24 01:11:52 +00:00
Matthias Clasen
7df58dc393 Fix a typo
svn path=/trunk/; revision=7244
2008-07-23 17:04:36 +00:00
Stefan Kost
ac94781e28 Move some content for gobject-unused.sgml and cleared empty entries. The
* docs/reference/gobject/tmpl/gobject-unused.sgml:
	* gobject/gobject.h:
	* gobject/gtype.c:
	* gobject/gtype.h:
	  Move some content for gobject-unused.sgml and cleared empty entries.
	  The remaining 4 ones should be checked by some else. If they are not
	  needed. The file can be removed.


svn path=/trunk/; revision=7087
2008-06-22 10:10:59 +00:00
Stefan Kost
f22d19fc34 Add --sgml-mode to allow sgml in doc-fragments (which somehow works before
* docs/reference/gobject/Makefile.am:
	  Add --sgml-mode to allow sgml in doc-fragments (which somehow works
	  before already).
	* gobject/gboxed.h:
	* gobject/gclosure.c:
	* gobject/gparam.c:
	* gobject/gparam.h:
	* gobject/gtype.h:
	  Convert character entities back. FIx some broken sgml.


svn path=/trunk/; revision=7078
2008-06-21 17:25:17 +00:00
Stefan Kost
005be9980a Migrating docs.
* docs/reference/gobject/tmpl/gtype.sgml:
	* gobject/gtype.c:
	* gobject/gtype.h:
	* gobject/gvaluetypes.h:
	  Migrating docs.


svn path=/trunk/; revision=7075
2008-06-21 16:14:18 +00:00
Stefan Kost
0b9bf79ec2 Migrating docs.
* docs/reference/gobject/tmpl/generic_values.sgml:
	* gobject/gboxed.h:
	* gobject/gtype.h:
	* gobject/gvalue.c:
	* gobject/gvalue.h:
	* gobject/gvaluetypes.c:
	  Migrating docs.


svn path=/trunk/; revision=7071
2008-06-21 12:45:49 +00:00
Tim Janik
3bdefad44a use g_once_init_enter/g_once_init_leave to guard critical initialization
Tue Jul 10 12:31:50 2007  Tim Janik  <timj@imendio.com>

        * gtype.h: use g_once_init_enter/g_once_init_leave to guard critical
        initialization section of *_get_type implementations in G_DEFINE_TYPE,
        bug #65041.



svn path=/trunk/; revision=5618
2007-07-10 10:33:03 +00:00
Tim Janik
ea4efd7bba reintroduce typedef gulong GType; for C++, to avoid C++ specific ABI
Fri Jun 22 11:31:27 2007  Tim Janik  <timj@gtk.org>

        * gtype.h: reintroduce typedef gulong GType; for C++, to avoid
        C++ specific ABI breakage.



svn path=/trunk/; revision=5582
2007-06-22 09:34:33 +00:00
Tim Janik
71a9fa9879 always define GType unconditionally in terms of gsize, there's no need to
Thu Jun 14 23:32:00 2007  Tim Janik  <timj@gtk.org>

        * gtype.h: always define GType unconditionally in terms of gsize,
        there's no need to jump through a glong hoop ever and this fixes
        the printf modifier to %zu.



svn path=/trunk/; revision=5560
2007-06-14 21:55:41 +00:00
Matthias Clasen
793da74d00 Move the compiler-dependency in the G_GNUC_INTERNAL definition from
2007-05-17  Matthias Clasen  <mclasen@redhat.com>

        * configure.in: Move the compiler-dependency in the G_GNUC_INTERNAL
        definition from configure-time to runtime (of the compiler).
        (#438869, Damien Carbery)

        * glib/gdebug.h:
        * glib/gmessages.h:
        * glib/gunicodeprivate.h:
        * glib/gthreadprivate.h: Move G_GNUC_INTERNAL before function
        declarations to fix compilation with sun studio.  (#438873,
        Damien Carbery)


svn path=/trunk/; revision=5497
2007-05-17 16:36:53 +00:00
Tim Janik
add62500f7 marked purely functional g_type accessors as PURE or CONST, closes
Mon Mar 12 13:30:20 2007  Tim Janik  <timj@gtk.org>

        * gtype.h: marked purely functional g_type accessors as PURE or CONST,
        closes #305100.



svn path=/trunk/; revision=5400
2007-03-12 12:28:56 +00:00
Tim Janik
b6a3cd8039 applied patch from Behdad with slight optimization, fixes #356175.
Fri Sep 22 13:41:02 2006  Tim Janik  <timj@imendio.com>

        * gtype.h: applied patch from Behdad with slight optimization,
        fixes #356175.

        * gobjectnotifyqueue.c: fixed include-guard macro name.
2006-09-22 12:06:28 +00:00
Tim Janik
4c6e514add turn off compiler warnings, #337129.
Tue May 16 14:01:43 2006  Tim Janik  <timj@imendio.com>

        * gtype.h (G_IMPLEMENT_INTERFACE): turn off compiler warnings, #337129.
2006-05-16 12:02:29 +00:00
Tim Janik
f2649abe84 split up G_DEFINE_*TYPE macro definitions so C CODE arguments are not
Tue May  2 14:51:03 2006  Tim Janik  <timj@gtk.org>

        * gtype.h: split up G_DEFINE_*TYPE macro definitions so C CODE arguments
        are not passed on to nested macro calls. patch mostly courtesy of Behdad
        Esfahbod, fixes #337128.
2006-05-02 13:00:52 +00:00
Matthias Clasen
68eaeb69cb Fix some problems with my last commit 2006-04-23 04:21:08 +00:00
Matthias Clasen
2e57b11a94 Add g_type_register_static_simple 2006-04-21 16:53:02 +00:00
Michael Natterer
e02b163efd revert last change, it breaks all users of G_IMPLEMENT_INTERFACE() inside
2005-09-28  Michael Natterer  <mitch@gimp.org>

	* gtype.h (G_IMPLEMENT_INTERFACE): revert last change, it breaks
	all users of G_IMPLEMENT_INTERFACE() inside
	G_DEFINE_TYPE_WITH_CODE(), since apparently GCC doesn't like
	commas enclosed in {}, not (), in nested macro calls.
2005-09-27 23:19:16 +00:00
David Odin
31659726ea initialize all the fields of GInterfaceInfo in the G_IMPLEMENT_INTERFACE
* gobject/gtype.h: initialize all the fields of GInterfaceInfo in the
  G_IMPLEMENT_INTERFACE macro, to shut up a warning when compiling at -W
2005-09-26 18:35:32 +00:00
Matthias Clasen
3a151501cc Intern type name before registering the type.
2005-08-31  Matthias Clasen  <mclasen@redhat.com>

	* gtype.h (G_DEFINE_TYPE_EXTENDED): Intern type name
	before registering the type.
2005-08-31 14:49:20 +00:00
Matthias Clasen
481fe81c06 Rename first parameter to check_data, since apparently the system headers
2004-10-23  Matthias Clasen  <mclasen@redhat.com>

	* gtype.h (GTypeInterfaceCheckFunc): Rename first parameter to
	check_data, since apparently the system headers on AIX leak a
	macro named func_data.  (#155178, Andrea Campi)
2004-10-24 01:22:30 +00:00
Matthias Clasen
88e7569e65 Add ABI control using the same technique that is used in GTK+.
2004-09-16  Matthias Clasen  <mclasen@redhat.com>

	Add ABI control using the same technique that is used in GTK+.

	* gobject.symbols: Master list of symbols.

	* gobject.def: Removed. It is now generated from gobject.symbols.

	* Makefile.am (gobject.def): Generate from gobject.symbols.
	(TESTS): Add abicheck.sh
	(EXTRA_DIST): Add abicheck.sh
	(export_symbols): Don't export _-prefixed symbols.

	* gtype.h:
	* gtype.c: Move the declarations of the various _init() functions
	to the header, and mark them as G_GNUC_INTERNAL.
2004-09-16 18:33:02 +00:00
Matthias Clasen
ef9a178b8e Add an initializer for the g_define_type_info.value_table.
Wed Jun 23 12:55:34 2004  Matthias Clasen  <maclas@gmx.de>

	* gtype.h (G_DEFINE_TYPE_EXTENDED): Add an initializer for
	the g_define_type_info.value_table.  (#144678,Mariano
	Suárez-Alvarez)
2004-06-23 16:56:48 +00:00
Tim Janik
b183ffc5ed added (GTypeFlags) cast needed by C++.
Fri Feb 20 02:44:54 2004  Tim Janik  <timj@gtk.org>

        * gtype.h (G_DEFINE_TYPE_EXTENDED): added (GTypeFlags) cast needed by C++.
2004-02-20 01:47:26 +00:00