[glib] Use a generic marshaller if one is not specified



commit fa2861e3b6109e002b68aa105b5ecbcba88724c1
Author: Johan Dahlin <johan gnome org>
Date:   Tue Jul 12 13:39:45 2011 -0300

    Use a generic marshaller if one is not specified
    
    Since g_cclosure_marshal_generic is always enabled, it makes
    sense to always use that instead of using generated ones.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=654917

 gobject/gsignal.c |   31 +++++++++++++++++++++++--------
 1 files changed, 23 insertions(+), 8 deletions(-)
---
diff --git a/gobject/gsignal.c b/gobject/gsignal.c
index c8cd4be..59b9c9e 100644
--- a/gobject/gsignal.c
+++ b/gobject/gsignal.c
@@ -1288,8 +1288,8 @@ g_signal_query (guint         signal_id,
  *  not associate a class method slot with this signal.
  * @accumulator: the accumulator for this signal; may be %NULL.
  * @accu_data: user data for the @accumulator.
- * @c_marshaller: the function to translate arrays of parameter values to
- *  signal emissions into C language callback invocations.
+ * @c_marshaller: (allow-none): the function to translate arrays of parameter
+ *  values to signal emissions into C language callback invocations or %NULL.
  * @return_type: the type of return value, or #G_TYPE_NONE for a signal
  *  without a return value.
  * @n_params: the number of parameter types to follow.
@@ -1310,6 +1310,9 @@ g_signal_query (guint         signal_id,
  * <code>super_class->signal_handler = my_signal_handler</code>. Instead they
  * will have to use g_signal_override_class_handler().
  *
+ * If c_marshaller is %NULL @g_cclosure_marshal_generic will be used as
+ * the marshaller for this signal.
+ *
  * Returns: the signal id
  */
 guint
@@ -1367,8 +1370,8 @@ g_signal_new (const gchar	 *signal_name,
  *  not associate a class method with this signal.
  * @accumulator: the accumulator for this signal; may be %NULL.
  * @accu_data: user data for the @accumulator.
- * @c_marshaller: the function to translate arrays of parameter values to
- *  signal emissions into C language callback invocations.
+ * @c_marshaller: (allow-none): the function to translate arrays of parameter
+ *  values to signal emissions into C language callback invocations or %NULL.
  * @return_type: the type of return value, or #G_TYPE_NONE for a signal
  *  without a return value.
  * @n_params: the number of parameter types to follow.
@@ -1388,6 +1391,9 @@ g_signal_new (const gchar	 *signal_name,
  *
  * See g_signal_new() for information about signal names.
  *
+ * If c_marshaller is %NULL @g_cclosure_marshal_generic will be used as
+ * the marshaller for this signal.
+ *
  * Returns: the signal id
  *
  * Since: 2.18
@@ -1496,8 +1502,9 @@ signal_add_class_closure (SignalNode *node,
  * @class_closure: The closure to invoke on signal emission; may be %NULL
  * @accumulator: the accumulator for this signal; may be %NULL
  * @accu_data: user data for the @accumulator
- * @c_marshaller: the function to translate arrays of parameter values to
- *     signal emissions into C language callback invocations
+ * @c_marshaller: (allow-none): the function to translate arrays of
+ *     parameter values to signal emissions into C language callback
+ *     invocations or %NULL
  * @return_type: the type of return value, or #G_TYPE_NONE for a signal
  *     without a return value
  * @n_params: the length of @param_types
@@ -1507,6 +1514,9 @@ signal_add_class_closure (SignalNode *node,
  *
  * See g_signal_new() for details on allowed signal names.
  *
+ * If c_marshaller is %NULL @g_cclosure_marshal_generic will be used as
+ * the marshaller for this signal.
+ *
  * Returns: the signal id
  */
 guint
@@ -1629,6 +1639,8 @@ g_signal_newv (const gchar       *signal_name,
     }
   else
     node->accumulator = NULL;
+  if (c_marshaller == NULL)
+      c_marshaller = g_cclosure_marshal_generic;
   node->c_marshaller = c_marshaller;
   node->emission_hooks = NULL;
   if (class_closure)
@@ -1658,8 +1670,8 @@ g_signal_newv (const gchar       *signal_name,
  * @class_closure: The closure to invoke on signal emission; may be %NULL.
  * @accumulator: the accumulator for this signal; may be %NULL.
  * @accu_data: user data for the @accumulator.
- * @c_marshaller: the function to translate arrays of parameter values to
- *  signal emissions into C language callback invocations.
+ * @c_marshaller: (allow-none): the function to translate arrays of parameter
+ *  values to signal emissions into C language callback invocations or %NULL.
  * @return_type: the type of return value, or #G_TYPE_NONE for a signal
  *  without a return value.
  * @n_params: the number of parameter types in @args.
@@ -1669,6 +1681,9 @@ g_signal_newv (const gchar       *signal_name,
  *
  * See g_signal_new() for details on allowed signal names.
  *
+ * If c_marshaller is %NULL @g_cclosure_marshal_generic will be used as
+ * the marshaller for this signal.
+ *
  * Returns: the signal id
  */
 guint



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]