use g_signal_newc

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
This commit is contained in:
Havoc Pennington 2000-12-15 07:05:10 +00:00 committed by Havoc Pennington
parent 71a6ca2542
commit b3c410dee1
4 changed files with 81 additions and 41 deletions

View File

@ -1,3 +1,12 @@
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

View File

@ -299,25 +299,23 @@ g_object_do_class_init (GObjectClass *class)
"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

View File

@ -883,31 +883,26 @@ g_signal_list_ids (GType itype,
}
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;
@ -920,6 +915,35 @@ g_signal_new (const gchar *signal_name,
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,

View File

@ -87,15 +87,6 @@ struct _GSignalQuery
/* --- signals --- */
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,
...);
guint g_signal_newv (const gchar *signal_name,
GType itype,
GSignalFlags signal_flags,
@ -105,6 +96,24 @@ guint g_signal_newv (const gchar *signal_name,
GType return_type,
guint n_params,
GType *param_types);
guint 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);
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,