summaryrefslogtreecommitdiff
path: root/gobject/gparamspecs.c
Commit message (Collapse)AuthorAgeFilesLines
* Empty values are not valid GParamSpecEmmanuele Bassi2022-09-251-0/+3
| | | | | | | | | | The validate() vfunc for GParamSpecParam returns FALSE for empty GValue, which means the is_valid() vfunc should do the same. This avoids a segfault when calling g_param_value_is_valid() on a GParamSpecParam. Fixes: #2770
* gparamspec: mark nick/blurb as nullableAndy Holmes2022-08-211-44/+44
| | | | | | | | | GParamSpec nicks and blurbs are effectively a deprecated feature, or at least unused by most libraries these days. Since a number of C libraries (i.e. GTK4) have started to null these out, annotate them as `(nullable)` so bindings can do the same. Closes #2719
* Add SPDX license headers for LGPL-2.1-or-later to various filesPhilip Withnall2022-06-011-0/+2
| | | | | | | | | | | | | These have all been added manually, as I’ve finished all the files which I can automatically detect. All the license headers in this commit are for LGPL-2.1-or-later, and all have been double-checked against the license paragraph in the file header. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Helps: #1415
* gparamspecs: Tidy up a preconditionPhilip Withnall2022-05-251-2/+1
| | | | | | | Move the `if` into the precondition assertion, eliminating one line of code and making the function preconditions clearer to static analysers. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
* gparamspecs: Remove redundant NULL checksPhilip Withnall2022-05-251-53/+1
| | | | | | `g_param_spec_internal()` can never return `NULL`. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
* param: Add a value_is_valid vfuncMatthias Clasen2022-05-231-11/+239
| | | | | | | | In constrast to value_validate, this one does not modify the passed-in value, so we can avoid the cost of copying the GValue beforehand. It is optional, but we set it for most of the builtin pspec types.
* param: Drop a pointless functionMatthias Clasen2022-05-201-13/+1
| | | | | | There is nothing to validate for boxed parameters, so we don't need a validate function for these.
* Clarify GValue documentationDarkTrick2021-07-121-0/+3
|
* glib: Avoid redefining GLIB_DISABLE_DEPRECATION_WARNINGSPhilip Withnall2020-07-271-0/+2
| | | | | | | | It may be defined by the environment (we document that as being allowed) — if so, individual files should not try to redefine it, as that causes a preprocessor warning. Signed-off-by: Philip Withnall <withnall@endlessm.com>
* Merge branch 'param-value-default' into 'master'Philip Withnall2019-10-311-2/+5
|\ | | | | | | | | Allow using an empty GValue with g_param_value_set_default() See merge request GNOME/glib!1186
| * Do not validate a GValue initialized with the defaultEmmanuele Bassi2019-10-261-2/+5
| | | | | | | | | | There's really no point in going through validation, if we know the value we're validating is coming straight from the GParamSpec.
* | gparamspecs: Fix type class leaks on error handling pathsPhilip Withnall2019-10-281-2/+8
|/ | | | | | Signed-off-by: Philip Withnall <withnall@endlessm.com> Helps: #1911
* gobject: Fix various compiler warnings when compiling with G_DISABLE_ASSERTPhilip Withnall2019-03-081-1/+6
| | | | | | | | | Mostly unused variables which are only used in a g_assert() call otherwise. Signed-off-by: Philip Withnall <withnall@endlessm.com> Helps: #1708
* gobject: Reimplement g_param_values_cmp() for GParamSpecVariantPhilip Withnall2018-05-041-1/+27
| | | | | | | | | | | | | | | | The existing implementation was completely incorrect (despite the fix in commit 566e64a66) — it always compared GVariants by pointer, rather than by value. Reimplement it to compare them by value where possible, depending on their type. The core of this implementation is g_variant_compare(). See the documentation and tests for further details of the new sort order. This adds documentation and tests. Signed-off-by: Philip Withnall <withnall@endlessm.com> https://bugzilla.gnome.org/show_bug.cgi?id=795735
* Revert "Fix the cmp implementation for variant values"Philip Withnall2018-05-041-1/+1
| | | | | | | | | This reverts commit 566e64a660549cd49741f244f6362af47eae3757. This fix went from one broken state to another. The real fix is to use g_variant_compare(), which is pending review. See bug #795735. https://bugzilla.gnome.org/show_bug.cgi?id=795735
* Fix the cmp implementation for variant valuesMatthias Clasen2018-05-021-1/+1
| | | | | | | | | | This was causing g_param_value_defaults to return 1 for GVariant values even when the value is clearly different from the default. This was showing up as gtk-builder-tool stripping non-default values for GtkActionable::action-target from ui files.
* gobject/: LGPLv2+ -> LGPLv2.1+Sébastien Wilmet2017-05-241-1/+1
| | | | | | | | All gobject/*.{c,h} files have been processed. gmarshal.c and gmarshal.h don't have a license header. https://bugzilla.gnome.org/show_bug.cgi?id=776504
* introspection: use (nullable) or (optional) instead of (allow-none)Christian Hergert2016-11-221-1/+1
| | | | | | | | 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.
* gparamspecs: GTypes are stored in v_pointer, not v_longSebastian Dröge2016-04-271-5/+5
| | | | | | | v_long is 32 bits on Win64, v_pointer is 64 bits. On most other platforms the size of long and pointer is the same, so it's usually not a problem. https://bugzilla.gnome.org/show_bug.cgi?id=758738
* gparamspecs: Mark g_param_spec_string()’s default value as (nullable)Philip Withnall2015-10-081-1/+1
|
* GParamSpec: do not use static GParamSpecTypeInfoNicola Fontana2015-09-131-21/+21
| | | | | | | g_param_type_register_static() has read-only access the pspec_info argument: no need to keep the original struct around. https://bugzilla.gnome.org/show_bug.cgi?id=696426
* gparamspecs: Recommend use of most specific GParamSpec typesPhilip Withnall2015-03-031-1/+6
| | | | | | | | | | | | | | | | | | It’s quite common to see a g_param_spec_pointer() used for GObject or boxed types which, while not incorrect, does make memory management unsafe, since no copying or reference counting can be performed automatically. Similarly, people often use g_param_spec_boolean() when an enum would be more appropriate, cf. http://blog.ometer.com/2011/01/20/boolean-parameters-are-wrong/ Using enums also means that the set of allowable values can be extended in future if needed. In the hope that people who write code like that read the documentation, mention the more specific types in the documentation. https://bugzilla.gnome.org/show_bug.cgi?id=741779
* Updated FSF's addressDaniel Mustieles2014-01-311-3/+1
|
* Fix crashes in various GParamSpec creation functionsSimon Feltman2013-10-011-0/+52
| | | | | | | | Add NULL check and return after calls to g_param_spec_internal in GParamSpec creation functions. This avoids glib crashing due to things like badly named properties. https://bugzilla.gnome.org/show_bug.cgi?id=707887
* GParamSpec: Make constructors introspectableMartin Pitt2013-01-141-44/+44
| | | | | | | | Commit 282366c3262 unnecessarily (skip)ed all the GParamSpec constructors like g_param_spec_bool(). Make those introspectable by dropping the (skip) and adding proper transfer annotations. Keep g_param_spec_value_array() skipped as GValueArray is deprecated.
* Deprecate GValueArrayEmmanuele Bassi2012-01-241-0/+3
| | | | | | | | | | | | | | | | | | 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
* GObject docs: resolve broken linksRyan Lortie2011-09-051-1/+1
| | | | | | 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.
* gobject: Use _ prefixing in private headers over G_GNUC_INTERNAL in public ↵Colin Walters2011-06-031-1/+2
| | | | | | | | | 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
* Add GI annotations to GParamSpecPavel Holejsovsky2010-12-271-23/+23
|
* gobject/: fully remove gobjectalias hacksRyan Lortie2010-07-071-4/+0
|
* Add fundamental type and pspec for GVariantChristian Persch2010-06-171-1/+126
| | | | | | | | | Make G_TYPE_VARIANT a fundamental type instead of boxed, and add g_variant_{set,get,dup}_variant. Add GParamSpecVariant. Bug #610863.
* Fix up section commentsMatthias Clasen2008-07-021-6/+3
| | | | svn path=/trunk/; revision=7137
* remove trailing whitespace from newly added gtk-doc comments andMichael Natterer2008-06-221-84/+91
| | | | | | | | | | | 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
* moved includes back to the top of the files (before gtk-doc SECTIONMichael Natterer2008-06-221-13/+17
| | | | | | | | | | | | | 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
* Migrating docs.Stefan Kost2008-06-211-1/+357
| | | | | | | | | | | | | | | | | | | | * 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
* make GParamGType require the set type during construction instead of usingBenjamin Otte2008-02-061-2/+4
| | | | | | | | | * gparamspecs.c: (param_gtype_set_default), (param_gtype_validate): make GParamGType require the set type during construction instead of using G_TYPE_NONE, which causes issues when setting. Bug 513073 - g_param_spec_gtype breaks with G_PARAM_CONSTRUCT svn path=/trunk/; revision=6457
* work around SGI IDO cc, fixes #363986.Tim Janik2007-06-141-2/+2
| | | | | | | | | | | Thu Jun 14 22:33:11 2007 Tim Janik <timj@imendio.com> * gparamspecs.c (g_param_spec_types_init): work around SGI IDO cc, fixes #363986. svn path=/trunk/; revision=5559
* also clear the NOCOPY_CONTENTS flag when replacing NULL with the emptyMichael Natterer2007-04-251-1/+2
| | | | | | | | | | 2007-04-25 Michael Natterer <mitch@imendio.com> * gparamspecs.c (param_string_validate): also clear the NOCOPY_CONTENTS flag when replacing NULL with the empty string. svn path=/trunk/; revision=5458
* don't free or modify static strings, dup them when needed and clear theMichael Natterer2007-04-241-1/+17
| | | | | | | | | | | | | | 2007-04-24 Michael Natterer <mitch@imendio.com> * gobject/gparamspecs.c (param_string_validate): don't free or modify static strings, dup them when needed and clear the G_VALUE_NOCOPY_CONTENTS flag. Fixes bug #432895. * tests/gobject/paramspec-test.c: test all GParamSpecString validations with static and allocated strings. svn path=/trunk/; revision=5454
* Don't initialize struct members with function calls. (#349952)Matthias Clasen2006-08-061-1/+2
| | | | | | | 2006-08-05 Matthias Clasen <mclasen@redhat.com> * gparamspecs.c (g_param_spec_types_init): Don't initialize struct members with function calls. (#349952)
* implemented G_TYPE_GTPYE. applied patch from matthias which implementsTim Janik2005-12-221-1/+81
| | | | | | | | | | | | | | | Thu Dec 22 14:59:24 2005 Tim Janik <timj@imendio.com> * gvaluetypes.[hc]: implemented G_TYPE_GTPYE. applied patch from matthias which implements GType accessors for GValue. * gparamspecs.[hc]: applied patch from matthias which implements G_TYPE_PARAM_GTYPE. * gobject.[hc]: GUnowned: introduced a new object type that has an initially floating reference. g_object_compat_control(): allow setting of a floating flag handler.
* More string interningMatthias Clasen2005-08-311-21/+21
|
* Make work again.Matthias Clasen2005-03-141-1/+4
| | | | | | | | | | | | | | | | | | | | | | 2005-03-14 Matthias Clasen <mclasen@redhat.com> * abicheck.sh: Make work again. * gsourceclosure.c: Fix a typo. Make PLT-reduction work with gcc4, and don't include everything in gobjectalias.h: * gobject.symbols: Group symbols by header and source file. * makegobjectalias.pl: Protect definitions by the same preprocessor symbols used to guard the headers. Move the alias declarations to a separate file which is produced when calling makegalias.pl -def * Makefile.am (gobjectaliasdef.c): Add a rule to build this file. * *.c: Include gobjectalias.h after the other i GLib headers, include gobjectaliasdef.c at the bottom.
* Implement the same PLT reduction technique used in GTK+:Matthias Clasen2004-09-161-1/+2
| | | | | | | | | | | | | 2004-09-16 Matthias Clasen <mclasen@redhat.com> Implement the same PLT reduction technique used in GTK+: * Makefile.am: Generate gobjectalias.h from gobject.symbols. (BUILT_SOURCES): Add gobjectalias.h. * makegobjectalias.pl: Script to generate gobjectalias.h. * *.c: Include gobjectalias.h
* Correct the initial minimal value to be -G_MAXFLOAT. The initial valuesMatthias Clasen2004-04-151-2/+2
| | | | | | | | | | | | | | 2004-04-15 Matthias Clasen <mclasen@redhat.com> * gparamspecs.c (param_float_init): Correct the initial minimal value to be -G_MAXFLOAT. The initial values were inconsistant before, with the initial default being smaller than the inital minimum. (param_double_init): Correct the initial minimal value to be -G_MAXDOUBLE. * glib/tmpl/types.sgml: Correct the description of the gfloat and gdouble ranges.
* Add a new GParamSpecOverride type that is a pointer to a differentOwen Taylor2003-10-211-1/+97
| | | | | | | | | | | | | | | | | | | | | Tue Oct 14 17:40:19 2003 Owen Taylor <otaylor@redhat.com> * gparamspecs.[ch]: Add a new GParamSpecOverride type that is a pointer to a different paramspec in a parent class or interface. * gparam.[ch]: Add g_paramspec_get_redirect_target() which follows GParamSpecOverride to the real property. Make g_param_spec_pool_list() hand redirections, properties on interfaces. * gobject.[ch] gobjectnotifyqueue.c: Add g_object_interface_install_property, g_object_interface_find_property, g_object_interface_list_properties(). Redirect virtually all publically exposed GParamSpec's to the redirect target if any. (->constructor is the exception.) (#105894)
* Remove all docs from gobject at Tims request. Documentation is only forMatthias Clasen2003-02-071-226/+0
| | | | | | | | | | | | | 2003-02-07 Matthias Clasen <maclas@gmx.de> * gtypemodule.c: * gtype.c: * gsourceclosure.c: * gparamspecs.c: * gparam.c: * gobject.c: * gsignal.c: Remove all docs from gobject at Tims request. Documentation is only for weenies anyway...
* Move some docs inline.Matthias Clasen2002-12-151-1/+227
| | | | | | | | | | * gobject/tmpl/param_value_types.sgml: Move some docs inline. * gsignal.c (g_signal_new): Typo fix. * gparamspecs.c: * gparam.c (g_param_spec_internal): * gobject.c (g_object_class_install_property): Add docs.
* 1.3.14GLIB_1_3_14Owen Taylor2002-02-171-1/+2
| | | | | | | | | | | | | | | Sun Feb 17 11:37:06 2002 Owen Taylor <otaylor@redhat.com> * 1.3.14 * glib/glibintl.h: Error out of config.h wasn't included rather than including it, since config.h must be the first thing included. * glib/gconvert.c glib/gmarkup.c glib/gshell.c glib/gspawn.c glib/gunibreak.c glib/gunidecomp.c glib/guniprop.c: Include config.h as the first thing. (#71704, Morten Welinder)
* fixed param_value_array_values_cmp(), param_value_array_validate() andTim Janik2002-01-111-27/+35
| | | | | | | | | Fri Jan 11 12:26:36 2002 Tim Janik <timj@gtk.org> * gparamspecs.c: fixed param_value_array_values_cmp(), param_value_array_validate() and param_value_array_set_default() to deal with NULL value arrays.