From 5e2aec58550dc5c19a4f03438432613d42bb879e Mon Sep 17 00:00:00 2001 From: Erik Walthinsen Date: Tue, 19 Jun 2001 23:17:26 +0000 Subject: [PATCH] fixed signal registration problem in gobject2gtk shim Original commit message from CVS: fixed signal registration problem in gobject2gtk shim --- gst/elements/gstfakesrc.c | 4 ++- gst/gobject2gtk.c | 52 +++++++++++++++++++++++++++++++++++ gst/gobject2gtk.h | 14 ++++++++-- plugins/elements/gstfakesrc.c | 4 ++- 4 files changed, 69 insertions(+), 5 deletions(-) diff --git a/gst/elements/gstfakesrc.c b/gst/elements/gstfakesrc.c index ff908c156e..a8496a5cb8 100644 --- a/gst/elements/gstfakesrc.c +++ b/gst/elements/gstfakesrc.c @@ -93,7 +93,9 @@ gst_fakesrc_get_type (void) if (!fakesrc_type) { static const GTypeInfo fakesrc_info = { - sizeof(GstFakeSrcClass), NULL, NULL, + sizeof(GstFakeSrcClass), + NULL, + NULL, (GClassInitFunc)gst_fakesrc_class_init, NULL, NULL, diff --git a/gst/gobject2gtk.c b/gst/gobject2gtk.c index 275005edea..90138fca9e 100644 --- a/gst/gobject2gtk.c +++ b/gst/gobject2gtk.c @@ -218,3 +218,55 @@ g_param_spec_string(gchar *name,gchar *nick,gchar *blurb,gchar *def,gint flags) return spec; } + + +guint +g_signal_newc (const gchar *name, + GtkType object_type, + GtkSignalRunType signal_flags, + guint function_offset, + gpointer accumulator, // GSignalAccumulator + gpointer accu_data, + GtkSignalMarshaller marshaller, + GType return_val, + guint nparams, + ...) +{ + GtkType *params; + guint i; + va_list args; + guint signal_id; + +#define MAX_SIGNAL_PARAMS (31) // from gtksignal.c + g_return_val_if_fail (nparams < MAX_SIGNAL_PARAMS, 0); + + if (nparams > 0) + { + params = g_new (GtkType, nparams); + + va_start (args, nparams); + + for (i = 0; i < nparams; i++) + params[i] = va_arg (args, GtkType); + + va_end (args); + } + else + params = NULL; + + signal_id = gtk_signal_newv (name, + signal_flags, + object_type, + function_offset, + marshaller, + return_val, + nparams, + params); + + g_free (params); + + // now register it. + gtk_object_class_add_signals(gtk_type_class(object_type), &signal_id, 1); + + return signal_id; +} diff --git a/gst/gobject2gtk.h b/gst/gobject2gtk.h index 2dd02c97da..74f8888045 100644 --- a/gst/gobject2gtk.h +++ b/gst/gobject2gtk.h @@ -117,9 +117,17 @@ gpointer g_object_new(GtkType type,gpointer blah_varargs_stuff); #define GCallback gpointer // FIXME? #define G_CALLBACK(f) ((gpointer)(f)) -#define \ -g_signal_newc(name,type,location,offset,null1,null2,marshal,ret,count,args...) \ -gtk_signal_new(name,location,type,offset,marshal,ret,count, ## args ) +guint +g_signal_newc (const gchar *signal_name, + GtkType object_type, + GtkSignalRunType signal_flags, + guint function_offset, + gpointer accumulator, // GSignalAccumulator + gpointer accu_data, + GtkSignalMarshaller marshaller, + GType return_type, + guint nparams, + ...); #define \ g_signal_emit(object,signal,detail,args...) \ diff --git a/plugins/elements/gstfakesrc.c b/plugins/elements/gstfakesrc.c index ff908c156e..a8496a5cb8 100644 --- a/plugins/elements/gstfakesrc.c +++ b/plugins/elements/gstfakesrc.c @@ -93,7 +93,9 @@ gst_fakesrc_get_type (void) if (!fakesrc_type) { static const GTypeInfo fakesrc_info = { - sizeof(GstFakeSrcClass), NULL, NULL, + sizeof(GstFakeSrcClass), + NULL, + NULL, (GClassInitFunc)gst_fakesrc_class_init, NULL, NULL,