GObject: warn on use of deprecated properties
[platform/upstream/glib.git] / gobject / gparamspecs.c
index 86d5699..c48ae0c 100644 (file)
@@ -13,9 +13,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
 
 #include <string.h>
 
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
 #include "gparamspecs.h"
 #include "gtype-private.h"
 #include "gvaluecollector.h"
+
 #include "gvaluearray.h"
 
 
@@ -1592,7 +1593,7 @@ _g_param_spec_types_init (void)
 /* --- GParamSpec initialization --- */
 
 /**
- * g_param_spec_char: (skip)
+ * g_param_spec_char:
  * @name: canonical name of the property specified
  * @nick: nick name for the property specified
  * @blurb: description of the property specified
@@ -1603,7 +1604,7 @@ _g_param_spec_types_init (void)
  *
  * Creates a new #GParamSpecChar instance specifying a %G_TYPE_CHAR property.
  *
- * Returns: a newly created parameter specification
+ * Returns: (transfer full): a newly created parameter specification
  */
 GParamSpec*
 g_param_spec_char (const gchar *name,
@@ -1623,6 +1624,8 @@ g_param_spec_char (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
+  if (cspec == NULL)
+    return NULL;
   
   cspec->minimum = minimum;
   cspec->maximum = maximum;
@@ -1632,7 +1635,7 @@ g_param_spec_char (const gchar *name,
 }
 
 /**
- * g_param_spec_uchar: (skip)
+ * g_param_spec_uchar:
  * @name: canonical name of the property specified
  * @nick: nick name for the property specified
  * @blurb: description of the property specified
@@ -1643,7 +1646,7 @@ g_param_spec_char (const gchar *name,
  *
  * Creates a new #GParamSpecUChar instance specifying a %G_TYPE_UCHAR property.
  *
- * Returns: a newly created parameter specification
+ * Returns: (transfer full): a newly created parameter specification
  */
 GParamSpec*
 g_param_spec_uchar (const gchar *name,
@@ -1663,6 +1666,8 @@ g_param_spec_uchar (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
+  if (uspec == NULL)
+    return NULL;
   
   uspec->minimum = minimum;
   uspec->maximum = maximum;
@@ -1672,7 +1677,7 @@ g_param_spec_uchar (const gchar *name,
 }
 
 /**
- * g_param_spec_boolean: (skip)
+ * g_param_spec_boolean:
  * @name: canonical name of the property specified
  * @nick: nick name for the property specified
  * @blurb: description of the property specified
@@ -1684,7 +1689,7 @@ g_param_spec_uchar (const gchar *name,
  *
  * See g_param_spec_internal() for details on property names.
  *
- * Returns: a newly created parameter specification
+ * Returns: (transfer full): a newly created parameter specification
  */
 GParamSpec*
 g_param_spec_boolean (const gchar *name,
@@ -1702,6 +1707,8 @@ g_param_spec_boolean (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
+  if (bspec == NULL)
+    return NULL;
   
   bspec->default_value = default_value;
   
@@ -1709,7 +1716,7 @@ g_param_spec_boolean (const gchar *name,
 }
 
 /**
- * g_param_spec_int: (skip)
+ * g_param_spec_int:
  * @name: canonical name of the property specified
  * @nick: nick name for the property specified
  * @blurb: description of the property specified
@@ -1722,7 +1729,7 @@ g_param_spec_boolean (const gchar *name,
  *
  * See g_param_spec_internal() for details on property names.
  *
- * Returns: a newly created parameter specification
+ * Returns: (transfer full): a newly created parameter specification
  */
 GParamSpec*
 g_param_spec_int (const gchar *name,
@@ -1742,6 +1749,8 @@ g_param_spec_int (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
+  if (ispec == NULL)
+    return NULL;
   
   ispec->minimum = minimum;
   ispec->maximum = maximum;
@@ -1751,7 +1760,7 @@ g_param_spec_int (const gchar *name,
 }
 
 /**
- * g_param_spec_uint: (skip)
+ * g_param_spec_uint:
  * @name: canonical name of the property specified
  * @nick: nick name for the property specified
  * @blurb: description of the property specified
@@ -1764,7 +1773,7 @@ g_param_spec_int (const gchar *name,
  *
  * See g_param_spec_internal() for details on property names.
  *
- * Returns: a newly created parameter specification
+ * Returns: (transfer full): a newly created parameter specification
  */
 GParamSpec*
 g_param_spec_uint (const gchar *name,
@@ -1784,6 +1793,8 @@ g_param_spec_uint (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
+  if (uspec == NULL)
+    return NULL;
   
   uspec->minimum = minimum;
   uspec->maximum = maximum;
@@ -1793,7 +1804,7 @@ g_param_spec_uint (const gchar *name,
 }
 
 /**
- * g_param_spec_long: (skip)
+ * g_param_spec_long:
  * @name: canonical name of the property specified
  * @nick: nick name for the property specified
  * @blurb: description of the property specified
@@ -1806,7 +1817,7 @@ g_param_spec_uint (const gchar *name,
  *
  * See g_param_spec_internal() for details on property names.
  *
- * Returns: a newly created parameter specification
+ * Returns: (transfer full): a newly created parameter specification
  */
 GParamSpec*
 g_param_spec_long (const gchar *name,
@@ -1826,6 +1837,8 @@ g_param_spec_long (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
+  if (lspec == NULL)
+    return NULL;
   
   lspec->minimum = minimum;
   lspec->maximum = maximum;
@@ -1835,7 +1848,7 @@ g_param_spec_long (const gchar *name,
 }
 
 /**
- * g_param_spec_ulong: (skip)
+ * g_param_spec_ulong:
  * @name: canonical name of the property specified
  * @nick: nick name for the property specified
  * @blurb: description of the property specified
@@ -1849,7 +1862,7 @@ g_param_spec_long (const gchar *name,
  *
  * See g_param_spec_internal() for details on property names.
  *
- * Returns: a newly created parameter specification
+ * Returns: (transfer full): a newly created parameter specification
  */
 GParamSpec*
 g_param_spec_ulong (const gchar *name,
@@ -1869,6 +1882,8 @@ g_param_spec_ulong (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
+  if (uspec == NULL)
+    return NULL;
   
   uspec->minimum = minimum;
   uspec->maximum = maximum;
@@ -1878,7 +1893,7 @@ g_param_spec_ulong (const gchar *name,
 }
 
 /**
- * g_param_spec_int64: (skip)
+ * g_param_spec_int64:
  * @name: canonical name of the property specified
  * @nick: nick name for the property specified
  * @blurb: description of the property specified
@@ -1891,7 +1906,7 @@ g_param_spec_ulong (const gchar *name,
  *
  * See g_param_spec_internal() for details on property names.
  *
- * Returns: a newly created parameter specification
+ * Returns: (transfer full): a newly created parameter specification
  */
 GParamSpec*
 g_param_spec_int64 (const gchar *name,
@@ -1911,6 +1926,8 @@ g_param_spec_int64 (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
+  if (lspec == NULL)
+    return NULL;
   
   lspec->minimum = minimum;
   lspec->maximum = maximum;
@@ -1920,7 +1937,7 @@ g_param_spec_int64 (const gchar *name,
 }
 
 /**
- * g_param_spec_uint64: (skip)
+ * g_param_spec_uint64:
  * @name: canonical name of the property specified
  * @nick: nick name for the property specified
  * @blurb: description of the property specified
@@ -1934,7 +1951,7 @@ g_param_spec_int64 (const gchar *name,
  *
  * See g_param_spec_internal() for details on property names.
  *
- * Returns: a newly created parameter specification
+ * Returns: (transfer full): a newly created parameter specification
  */
 GParamSpec*
 g_param_spec_uint64 (const gchar *name,
@@ -1954,6 +1971,8 @@ g_param_spec_uint64 (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
+  if (uspec == NULL)
+    return NULL;
   
   uspec->minimum = minimum;
   uspec->maximum = maximum;
@@ -1963,7 +1982,7 @@ g_param_spec_uint64 (const gchar *name,
 }
 
 /**
- * g_param_spec_unichar: (skip)
+ * g_param_spec_unichar:
  * @name: canonical name of the property specified
  * @nick: nick name for the property specified
  * @blurb: description of the property specified
@@ -1976,7 +1995,7 @@ g_param_spec_uint64 (const gchar *name,
  *
  * See g_param_spec_internal() for details on property names.
  *
- * Returns: a newly created parameter specification
+ * Returns: (transfer full): a newly created parameter specification
  */
 GParamSpec*
 g_param_spec_unichar (const gchar *name,
@@ -1992,6 +2011,8 @@ g_param_spec_unichar (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
+  if (uspec == NULL)
+    return NULL;
   
   uspec->default_value = default_value;
   
@@ -1999,7 +2020,7 @@ g_param_spec_unichar (const gchar *name,
 }
 
 /**
- * g_param_spec_enum: (skip)
+ * g_param_spec_enum:
  * @name: canonical name of the property specified
  * @nick: nick name for the property specified
  * @blurb: description of the property specified
@@ -2012,7 +2033,7 @@ g_param_spec_unichar (const gchar *name,
  *
  * See g_param_spec_internal() for details on property names.
  *
- * Returns: a newly created parameter specification
+ * Returns: (transfer full): a newly created parameter specification
  */
 GParamSpec*
 g_param_spec_enum (const gchar *name,
@@ -2036,6 +2057,8 @@ g_param_spec_enum (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
+  if (espec == NULL)
+    return NULL;
   
   espec->enum_class = enum_class;
   espec->default_value = default_value;
@@ -2045,7 +2068,7 @@ g_param_spec_enum (const gchar *name,
 }
 
 /**
- * g_param_spec_flags: (skip)
+ * g_param_spec_flags:
  * @name: canonical name of the property specified
  * @nick: nick name for the property specified
  * @blurb: description of the property specified
@@ -2058,7 +2081,7 @@ g_param_spec_enum (const gchar *name,
  *
  * See g_param_spec_internal() for details on property names.
  *
- * Returns: a newly created parameter specification
+ * Returns: (transfer full): a newly created parameter specification
  */
 GParamSpec*
 g_param_spec_flags (const gchar *name,
@@ -2082,6 +2105,8 @@ g_param_spec_flags (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
+  if (fspec == NULL)
+    return NULL;
   
   fspec->flags_class = flags_class;
   fspec->default_value = default_value;
@@ -2091,7 +2116,7 @@ g_param_spec_flags (const gchar *name,
 }
 
 /**
- * g_param_spec_float: (skip)
+ * g_param_spec_float:
  * @name: canonical name of the property specified
  * @nick: nick name for the property specified
  * @blurb: description of the property specified
@@ -2104,7 +2129,7 @@ g_param_spec_flags (const gchar *name,
  *
  * See g_param_spec_internal() for details on property names.
  *
- * Returns: a newly created parameter specification
+ * Returns: (transfer full): a newly created parameter specification
  */
 GParamSpec*
 g_param_spec_float (const gchar *name,
@@ -2124,6 +2149,8 @@ g_param_spec_float (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
+  if (fspec == NULL)
+    return NULL;
   
   fspec->minimum = minimum;
   fspec->maximum = maximum;
@@ -2133,7 +2160,7 @@ g_param_spec_float (const gchar *name,
 }
 
 /**
- * g_param_spec_double: (skip)
+ * g_param_spec_double:
  * @name: canonical name of the property specified
  * @nick: nick name for the property specified
  * @blurb: description of the property specified
@@ -2147,7 +2174,7 @@ g_param_spec_float (const gchar *name,
  *
  * See g_param_spec_internal() for details on property names.
  *
- * Returns: a newly created parameter specification
+ * Returns: (transfer full): a newly created parameter specification
  */
 GParamSpec*
 g_param_spec_double (const gchar *name,
@@ -2167,6 +2194,8 @@ g_param_spec_double (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
+  if (dspec == NULL)
+    return NULL;
   
   dspec->minimum = minimum;
   dspec->maximum = maximum;
@@ -2176,7 +2205,7 @@ g_param_spec_double (const gchar *name,
 }
 
 /**
- * g_param_spec_string: (skip)
+ * g_param_spec_string:
  * @name: canonical name of the property specified
  * @nick: nick name for the property specified
  * @blurb: description of the property specified
@@ -2187,7 +2216,7 @@ g_param_spec_double (const gchar *name,
  *
  * See g_param_spec_internal() for details on property names.
  *
- * Returns: a newly created parameter specification
+ * Returns: (transfer full): a newly created parameter specification
  */
 GParamSpec*
 g_param_spec_string (const gchar *name,
@@ -2201,6 +2230,9 @@ g_param_spec_string (const gchar *name,
                                                   nick,
                                                   blurb,
                                                   flags);
+  if (sspec == NULL)
+    return NULL;
+
   g_free (sspec->default_value);
   sspec->default_value = g_strdup (default_value);
   
@@ -2208,7 +2240,7 @@ g_param_spec_string (const gchar *name,
 }
 
 /**
- * g_param_spec_param: (skip)
+ * g_param_spec_param:
  * @name: canonical name of the property specified
  * @nick: nick name for the property specified
  * @blurb: description of the property specified
@@ -2220,7 +2252,7 @@ g_param_spec_string (const gchar *name,
  *
  * See g_param_spec_internal() for details on property names.
  *
- * Returns: a newly created parameter specification
+ * Returns: (transfer full): a newly created parameter specification
  */
 GParamSpec*
 g_param_spec_param (const gchar *name,
@@ -2238,13 +2270,16 @@ g_param_spec_param (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
+  if (pspec == NULL)
+    return NULL;
+
   G_PARAM_SPEC (pspec)->value_type = param_type;
   
   return G_PARAM_SPEC (pspec);
 }
 
 /**
- * g_param_spec_boxed: (skip)
+ * g_param_spec_boxed:
  * @name: canonical name of the property specified
  * @nick: nick name for the property specified
  * @blurb: description of the property specified
@@ -2256,7 +2291,7 @@ g_param_spec_param (const gchar *name,
  *
  * See g_param_spec_internal() for details on property names.
  *
- * Returns: a newly created parameter specification
+ * Returns: (transfer full): a newly created parameter specification
  */
 GParamSpec*
 g_param_spec_boxed (const gchar *name,
@@ -2275,13 +2310,16 @@ g_param_spec_boxed (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
+  if (bspec == NULL)
+    return NULL;
+
   G_PARAM_SPEC (bspec)->value_type = boxed_type;
   
   return G_PARAM_SPEC (bspec);
 }
 
 /**
- * g_param_spec_pointer: (skip)
+ * g_param_spec_pointer:
  * @name: canonical name of the property specified
  * @nick: nick name for the property specified
  * @blurb: description of the property specified
@@ -2291,7 +2329,7 @@ g_param_spec_boxed (const gchar *name,
  *
  * See g_param_spec_internal() for details on property names.
  *
- * Returns: a newly created parameter specification
+ * Returns: (transfer full): a newly created parameter specification
  */
 GParamSpec*
 g_param_spec_pointer (const gchar *name,
@@ -2306,11 +2344,14 @@ g_param_spec_pointer (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
+  if (pspec == NULL)
+    return NULL;
+
   return G_PARAM_SPEC (pspec);
 }
 
 /**
- * g_param_spec_gtype: (skip)
+ * g_param_spec_gtype:
  * @name: canonical name of the property specified
  * @nick: nick name for the property specified
  * @blurb: description of the property specified
@@ -2325,7 +2366,7 @@ g_param_spec_pointer (const gchar *name,
  *
  * Since: 2.10
  *
- * Returns: a newly created parameter specification
+ * Returns: (transfer full): a newly created parameter specification
  */
 GParamSpec*
 g_param_spec_gtype (const gchar *name,
@@ -2341,6 +2382,8 @@ g_param_spec_gtype (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
+  if (tspec == NULL)
+    return NULL;
 
   tspec->is_a_type = is_a_type;
 
@@ -2382,6 +2425,9 @@ g_param_spec_value_array (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
+  if (aspec == NULL)
+    return NULL;
+
   if (element_spec)
     {
       aspec->element_spec = g_param_spec_ref (element_spec);
@@ -2392,7 +2438,7 @@ g_param_spec_value_array (const gchar *name,
 }
 
 /**
- * g_param_spec_object: (skip)
+ * g_param_spec_object:
  * @name: canonical name of the property specified
  * @nick: nick name for the property specified
  * @blurb: description of the property specified
@@ -2404,7 +2450,7 @@ g_param_spec_value_array (const gchar *name,
  *
  * See g_param_spec_internal() for details on property names.
  *
- * Returns: a newly created parameter specification
+ * Returns: (transfer full): a newly created parameter specification
  */
 GParamSpec*
 g_param_spec_object (const gchar *name,
@@ -2422,6 +2468,9 @@ g_param_spec_object (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
+  if (ospec == NULL)
+    return NULL;
+
   G_PARAM_SPEC (ospec)->value_type = object_type;
   
   return G_PARAM_SPEC (ospec);
@@ -2463,6 +2512,8 @@ g_param_spec_override (const gchar *name,
   pspec = g_param_spec_internal (G_TYPE_PARAM_OVERRIDE,
                                 name, NULL, NULL,
                                 overridden->flags);
+  if (pspec == NULL)
+    return NULL;
   
   pspec->value_type = G_PARAM_SPEC_VALUE_TYPE (overridden);
   G_PARAM_SPEC_OVERRIDE (pspec)->overridden = g_param_spec_ref (overridden);
@@ -2471,13 +2522,13 @@ g_param_spec_override (const gchar *name,
 }
 
 /**
- * g_param_spec_variant: (skip)
+ * g_param_spec_variant:
  * @name: canonical name of the property specified
  * @nick: nick name for the property specified
  * @blurb: description of the property specified
  * @type: a #GVariantType
- * @default_value: (allow-none): a #GVariant of type @type to use as the
- *                 default value, or %NULL
+ * @default_value: (allow-none) (transfer full): a #GVariant of type @type to
+ *                 use as the default value, or %NULL
  * @flags: flags for the property specified
  *
  * Creates a new #GParamSpecVariant instance specifying a #GVariant
@@ -2487,7 +2538,7 @@ g_param_spec_override (const gchar *name,
  *
  * See g_param_spec_internal() for details on property names.
  *
- * Returns: the newly created #GParamSpec
+ * Returns: (transfer full): the newly created #GParamSpec
  *
  * Since: 2.26
  */
@@ -2510,6 +2561,8 @@ g_param_spec_variant (const gchar        *name,
                                  nick,
                                  blurb,
                                  flags);
+  if (vspec == NULL)
+    return NULL;
 
   vspec->type = g_variant_type_copy (type);
   if (default_value)