+2000-12-15 Havoc Pennington <hp@pobox.com>
+
+ * gobject.c (g_object_do_class_init): use g_signal_newc
+
+ * gsignal.c (g_signal_newc): convenience function for signals
+ created from C
+ (g_signal_new_valist): added
+ (g_signal_new): removed
+
Fri Dec 15 04:40:23 2000 Tim Janik <timj@gtk.org>
* gparam.[hc]: add an instance member value_type so the default
"and a data pointer",
G_PARAM_WRITABLE));
gobject_signals[PROPERTIES_CHANGED] =
- g_signal_new ("properties_changed",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
- g_signal_type_cclosure_new (G_TYPE_FROM_CLASS (class),
- G_STRUCT_OFFSET (GObjectClass, properties_changed)),
- NULL, /* accumulator */
- g_cclosure_marshal_VOID__UINT_POINTER,
- G_TYPE_NONE,
- 2, G_TYPE_UINT, G_TYPE_POINTER);
+ g_signal_newc ("properties_changed",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET (GObjectClass, properties_changed),
+ NULL, /* accumulator */
+ g_cclosure_marshal_VOID__UINT_POINTER,
+ G_TYPE_NONE,
+ 2, G_TYPE_UINT, G_TYPE_POINTER);
gobject_signals[NOTIFY] =
- g_signal_new ("notify",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE | G_SIGNAL_DETAILED | G_SIGNAL_NO_HOOKS,
- g_signal_type_cclosure_new (G_TYPE_FROM_CLASS (class),
- G_STRUCT_OFFSET (GObjectClass, notify)),
- NULL, /* accumulator */
- g_cclosure_marshal_VOID__PARAM,
- G_TYPE_NONE,
- 1, G_TYPE_PARAM);
+ g_signal_newc ("notify",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE | G_SIGNAL_DETAILED | G_SIGNAL_NO_HOOKS,
+ G_STRUCT_OFFSET (GObjectClass, notify),
+ NULL, /* accumulator */
+ g_cclosure_marshal_VOID__PARAM,
+ G_TYPE_NONE,
+ 1, G_TYPE_PARAM);
}
void
}
guint
-g_signal_new (const gchar *signal_name,
- GType itype,
- GSignalFlags signal_flags,
- GClosure *class_closure,
- GSignalAccumulator accumulator,
- GSignalCMarshaller c_marshaller,
- GType return_type,
- guint n_params,
- ...)
+g_signal_new_valist (const gchar *signal_name,
+ GType itype,
+ GSignalFlags signal_flags,
+ GClosure *class_closure,
+ GSignalAccumulator accumulator,
+ GSignalCMarshaller c_marshaller,
+ GType return_type,
+ guint n_params,
+ va_list args)
{
GType *param_types;
guint i;
- va_list args;
guint signal_id;
if (n_params > 0)
{
param_types = g_new (GType, n_params);
- va_start (args, n_params);
-
for (i = 0; i < n_params; i++)
param_types[i] = va_arg (args, GType);
-
- va_end (args);
}
else
param_types = NULL;
return signal_id;
}
+guint
+g_signal_newc (const gchar *signal_name,
+ GType itype,
+ GSignalFlags signal_flags,
+ guint class_offset,
+ GSignalAccumulator accumulator,
+ GSignalCMarshaller c_marshaller,
+ GType return_type,
+ guint n_params,
+ ...)
+{
+ va_list args;
+ guint signal_id;
+
+ g_return_val_if_fail (signal_name != NULL, 0);
+
+ va_start (args, n_params);
+
+ signal_id = g_signal_new_valist (signal_name, itype, signal_flags,
+ g_signal_type_cclosure_new (itype,
+ class_offset),
+ accumulator, c_marshaller,
+ return_type, n_params, args);
+
+ va_end (args);
+
+ return signal_id;
+}
+
guint
g_signal_newv (const gchar *signal_name,
GType itype,
/* --- signals --- */
-guint g_signal_new (const gchar *signal_name,
+guint g_signal_newv (const gchar *signal_name,
GType itype,
GSignalFlags signal_flags,
GClosure *class_closure,
GSignalCMarshaller c_marshaller,
GType return_type,
guint n_params,
- ...);
-guint g_signal_newv (const gchar *signal_name,
+ GType *param_types);
+guint g_signal_new_valist (const gchar *signal_name,
GType itype,
GSignalFlags signal_flags,
GClosure *class_closure,
GSignalCMarshaller c_marshaller,
GType return_type,
guint n_params,
- GType *param_types);
+ va_list args);
+guint g_signal_newc (const gchar *signal_name,
+ GType itype,
+ GSignalFlags signal_flags,
+ guint class_offset,
+ GSignalAccumulator accumulator,
+ GSignalCMarshaller c_marshaller,
+ GType return_type,
+ guint n_params,
+ ...);
void g_signal_emitv (const GValue *instance_and_params,
guint signal_id,
GQuark detail,