hook gvariant vectors up to kdbus
[platform/upstream/glib.git] / gobject / gbinding.c
index 6fc8474..2237e5e 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/>.
  *
  * Author: Emmanuele Bassi <ebassi@linux.intel.com>
  */
  * value is applied to the target property; for instance, the following
  * binding:
  *
- * |[
+ * |[<!-- language="C" --> 
  *   g_object_bind_property (object1, "property-a",
  *                           object2, "property-b",
  *                           G_BINDING_DEFAULT);
  * ]|
  *
- * will cause <emphasis>object2:property-b</emphasis> to be updated every
- * time g_object_set() or the specific accessor changes the value of
- * <emphasis>object1:property-a</emphasis>.
+ * will cause the property named "property-b" of @object2 to be updated
+ * every time g_object_set() or the specific accessor changes the value of
+ * the property "property-a" of @object1.
  *
  * It is possible to create a bidirectional binding between two properties
  * of two #GObject instances, so that if either property changes, the
  * other is updated as well, for instance:
  *
- * |[
+ * |[<!-- language="C" --> 
  *   g_object_bind_property (object1, "property-a",
  *                           object2, "property-b",
  *                           G_BINDING_BIDIRECTIONAL);
@@ -58,7 +56,7 @@
  * transformation from the source value to the target value before
  * applying it; for instance, the following binding:
  *
- * |[
+ * |[<!-- language="C" --> 
  *   g_object_bind_property_full (adjustment1, "value",
  *                                adjustment2, "value",
  *                                G_BINDING_BIDIRECTIONAL,
  *                                NULL, NULL);
  * ]|
  *
- * will keep the <emphasis>value</emphasis> property of the two adjustments
- * in sync; the <function>celsius_to_fahrenheit</function> function will be
- * called whenever the <emphasis>adjustment1:value</emphasis> property changes
- * and will transform the current value of the property before applying it
- * to the <emphasis>adjustment2:value</emphasis> property; vice versa, the
- * <function>fahrenheit_to_celsius</function> function will be called whenever
- * the <emphasis>adjustment2:value</emphasis> property changes, and will
- * transform the current value of the property before applying it to the
- * <emphasis>adjustment1:value</emphasis>.
+ * will keep the "value" property of the two adjustments in sync; the
+ * @celsius_to_fahrenheit function will be called whenever the "value"
+ * property of @adjustment1 changes and will transform the current value
+ * of the property before applying it to the "value" property of @adjustment2.
+ *
+ * Vice versa, the @fahrenheit_to_celsius function will be called whenever
+ * the "value" property of @adjustment2 changes, and will transform the
+ * current value of the property before applying it to the "value" property
+ * of @adjustment1.
  *
  * Note that #GBinding does not resolve cycles by itself; a cycle like
  *
  * either one of the #GObject instances it refers to are finalized, or when
  * the #GBinding instance loses its last reference.
  *
- * <note><para>Bindings for languages with garbage collection can use
+ * Bindings for languages with garbage collection can use
  * g_binding_unbind() to explicitly release a binding between the source
  * and target properties, instead of relying on the last reference on the
- * binding, source, and target instances to drop.</para></note>
+ * binding, source, and target instances to drop.
  *
  * #GBinding is available since GObject 2.26
  */
@@ -296,15 +294,15 @@ default_transform (const GValue *value_a,
         {
           if (g_value_transform (value_a, value_b))
             goto done;
+        }
 
-          g_warning ("%s: Unable to convert a value of type %s to a "
-                     "value of type %s",
-                     G_STRLOC,
-                     g_type_name (G_VALUE_TYPE (value_a)),
-                     g_type_name (G_VALUE_TYPE (value_b)));
+      g_warning ("%s: Unable to convert a value of type %s to a "
+                 "value of type %s",
+                 G_STRLOC,
+                 g_type_name (G_VALUE_TYPE (value_a)),
+                 g_type_name (G_VALUE_TYPE (value_b)));
 
-          return FALSE;
-        }
+      return FALSE;
     }
   else
     g_value_copy (value_a, value_b);
@@ -360,8 +358,8 @@ on_source_notify (GObject    *gobject,
                   GBinding   *binding)
 {
   const gchar *p_name;
-  GValue source_value = G_VALUE_INIT;
-  GValue target_value = G_VALUE_INIT;
+  GValue from_value = G_VALUE_INIT;
+  GValue to_value = G_VALUE_INIT;
   gboolean res;
 
   if (binding->is_frozen)
@@ -372,27 +370,27 @@ on_source_notify (GObject    *gobject,
   if (p_name != binding->source_property)
     return;
 
-  g_value_init (&source_value, G_PARAM_SPEC_VALUE_TYPE (binding->source_pspec));
-  g_value_init (&target_value, G_PARAM_SPEC_VALUE_TYPE (binding->target_pspec));
+  g_value_init (&from_value, G_PARAM_SPEC_VALUE_TYPE (binding->source_pspec));
+  g_value_init (&to_value, G_PARAM_SPEC_VALUE_TYPE (binding->target_pspec));
 
-  g_object_get_property (binding->source, binding->source_pspec->name, &source_value);
+  g_object_get_property (binding->source, binding->source_pspec->name, &from_value);
 
   res = binding->transform_s2t (binding,
-                                &source_value,
-                                &target_value,
+                                &from_value,
+                                &to_value,
                                 binding->transform_data);
   if (res)
     {
       binding->is_frozen = TRUE;
 
-      g_param_value_validate (binding->target_pspec, &target_value);
-      g_object_set_property (binding->target, binding->target_pspec->name, &target_value);
+      g_param_value_validate (binding->target_pspec, &to_value);
+      g_object_set_property (binding->target, binding->target_pspec->name, &to_value);
 
       binding->is_frozen = FALSE;
     }
 
-  g_value_unset (&source_value);
-  g_value_unset (&target_value);
+  g_value_unset (&from_value);
+  g_value_unset (&to_value);
 }
 
 static void
@@ -401,8 +399,8 @@ on_target_notify (GObject    *gobject,
                   GBinding   *binding)
 {
   const gchar *p_name;
-  GValue source_value = G_VALUE_INIT;
-  GValue target_value = G_VALUE_INIT;
+  GValue from_value = G_VALUE_INIT;
+  GValue to_value = G_VALUE_INIT;
   gboolean res;
 
   if (binding->is_frozen)
@@ -413,27 +411,27 @@ on_target_notify (GObject    *gobject,
   if (p_name != binding->target_property)
     return;
 
-  g_value_init (&source_value, G_PARAM_SPEC_VALUE_TYPE (binding->target_pspec));
-  g_value_init (&target_value, G_PARAM_SPEC_VALUE_TYPE (binding->source_pspec));
+  g_value_init (&from_value, G_PARAM_SPEC_VALUE_TYPE (binding->target_pspec));
+  g_value_init (&to_value, G_PARAM_SPEC_VALUE_TYPE (binding->source_pspec));
 
-  g_object_get_property (binding->target, binding->target_pspec->name, &source_value);
+  g_object_get_property (binding->target, binding->target_pspec->name, &from_value);
 
   res = binding->transform_t2s (binding,
-                                &source_value,
-                                &target_value,
+                                &from_value,
+                                &to_value,
                                 binding->transform_data);
   if (res)
     {
       binding->is_frozen = TRUE;
 
-      g_param_value_validate (binding->source_pspec, &target_value);
-      g_object_set_property (binding->source, binding->source_pspec->name, &target_value);
+      g_param_value_validate (binding->source_pspec, &to_value);
+      g_object_set_property (binding->source, binding->source_pspec->name, &to_value);
 
       binding->is_frozen = FALSE;
     }
 
-  g_value_unset (&source_value);
-  g_value_unset (&target_value);
+  g_value_unset (&from_value);
+  g_value_unset (&to_value);
 }
 
 static inline void
@@ -706,9 +704,9 @@ g_binding_init (GBinding *binding)
  * g_binding_get_flags:
  * @binding: a #GBinding
  *
- * Retrieves the flags passed when constructing the #GBinding
+ * Retrieves the flags passed when constructing the #GBinding.
  *
- * Return value: the #GBindingFlags used by the #GBinding
+ * Returns: the #GBindingFlags used by the #GBinding
  *
  * Since: 2.26
  */
@@ -724,9 +722,9 @@ g_binding_get_flags (GBinding *binding)
  * g_binding_get_source:
  * @binding: a #GBinding
  *
- * Retrieves the #GObject instance used as the source of the binding
+ * Retrieves the #GObject instance used as the source of the binding.
  *
- * Return value: (transfer none): the source #GObject
+ * Returns: (transfer none): the source #GObject
  *
  * Since: 2.26
  */
@@ -742,9 +740,9 @@ g_binding_get_source (GBinding *binding)
  * g_binding_get_target:
  * @binding: a #GBinding
  *
- * Retrieves the #GObject instance used as the target of the binding
+ * Retrieves the #GObject instance used as the target of the binding.
  *
- * Return value: (transfer none): the target #GObject
+ * Returns: (transfer none): the target #GObject
  *
  * Since: 2.26
  */
@@ -761,9 +759,9 @@ g_binding_get_target (GBinding *binding)
  * @binding: a #GBinding
  *
  * Retrieves the name of the property of #GBinding:source used as the source
- * of the binding
+ * of the binding.
  *
- * Return value: the name of the source property
+ * Returns: the name of the source property
  *
  * Since: 2.26
  */
@@ -780,9 +778,9 @@ g_binding_get_source_property (GBinding *binding)
  * @binding: a #GBinding
  *
  * Retrieves the name of the property of #GBinding:target used as the target
- * of the binding
+ * of the binding.
  *
- * Return value: the name of the target property
+ * Returns: the name of the target property
  *
  * Since: 2.26
  */
@@ -801,10 +799,10 @@ g_binding_get_target_property (GBinding *binding)
  * Explicitly releases the binding between the source and the target
  * property expressed by @binding.
  *
- * <note>This function will release the reference that is being held on
+ * This function will release the reference that is being held on
  * the @binding instance; if you want to hold on to the #GBinding instance
  * after calling g_binding_unbind(), you will need to hold a reference
- * to it.</note>
+ * to it.
  *
  * Since: 2.38
  */
@@ -824,13 +822,13 @@ g_binding_unbind (GBinding *binding)
  * @target_property: the property on @target to bind
  * @flags: flags to pass to #GBinding
  * @transform_to: (scope notified) (allow-none): the transformation function
- *   from the @source to the @target, or %NULL to use the default
+ *     from the @source to the @target, or %NULL to use the default
  * @transform_from: (scope notified) (allow-none): the transformation function
- *   from the @target to the @source, or %NULL to use the default
+ *     from the @target to the @source, or %NULL to use the default
  * @user_data: custom data to be passed to the transformation functions,
- *   or %NULL
+ *     or %NULL
  * @notify: function to be called when disposing the binding, to free the
- *   resources used by the transformation functions
+ *     resources used by the transformation functions
  *
  * Complete version of g_object_bind_property().
  *
@@ -850,15 +848,15 @@ g_binding_unbind (GBinding *binding)
  *
  * A #GObject can have multiple bindings.
  *
- * <note>The same @user_data parameter will be used for both @transform_to
+ * The same @user_data parameter will be used for both @transform_to
  * and @transform_from transformation functions; the @notify function will
  * be called once, when the binding is removed. If you need different data
  * for each transformation function, please use
- * g_object_bind_property_with_closures() instead.</note>
+ * g_object_bind_property_with_closures() instead.
  *
- * Return value: (transfer none): the #GBinding instance representing the
- *   binding between the two #GObject instances. The binding is released
- *   whenever the #GBinding reference count reaches zero.
+ * Returns: (transfer none): the #GBinding instance representing the
+ *     binding between the two #GObject instances. The binding is released
+ *     whenever the #GBinding reference count reaches zero.
  *
  * Since: 2.26
  */
@@ -1037,9 +1035,9 @@ g_object_bind_property_full (gpointer               source,
  *
  * A #GObject can have multiple bindings.
  *
- * Return value: (transfer none): the #GBinding instance representing the
- *   binding between the two #GObject instances. The binding is released
- *   whenever the #GBinding reference count reaches zero.
+ * Returns: (transfer none): the #GBinding instance representing the
+ *     binding between the two #GObject instances. The binding is released
+ *     whenever the #GBinding reference count reaches zero.
  *
  * Since: 2.26
  */
@@ -1174,23 +1172,23 @@ bind_with_closures_free_func (gpointer data)
  * @target_property: the property on @target to bind
  * @flags: flags to pass to #GBinding
  * @transform_to: a #GClosure wrapping the transformation function
- *   from the @source to the @target, or %NULL to use the default
+ *     from the @source to the @target, or %NULL to use the default
  * @transform_from: a #GClosure wrapping the transformation function
- *   from the @target to the @source, or %NULL to use the default
+ *     from the @target to the @source, or %NULL to use the default
  *
  * Creates a binding between @source_property on @source and @target_property
  * on @target, allowing you to set the transformation functions to be used by
  * the binding.
  *
  * This function is the language bindings friendly version of
- * g_object_bind_property_full(), using #GClosure<!-- -->s instead of
+ * g_object_bind_property_full(), using #GClosures instead of
  * function pointers.
  *
  * Rename to: g_object_bind_property_full
  *
- * Return value: (transfer none): the #GBinding instance representing the
- *   binding between the two #GObject instances. The binding is released
- *   whenever the #GBinding reference count reaches zero.
+ * Returns: (transfer none): the #GBinding instance representing the
+ *     binding between the two #GObject instances. The binding is released
+ *     whenever the #GBinding reference count reaches zero.
  *
  * Since: 2.26
  */