diff --git a/gst/gobject2gtk.c b/gst/gobject2gtk.c index 6948261866..7e37aea641 100644 --- a/gst/gobject2gtk.c +++ b/gst/gobject2gtk.c @@ -108,6 +108,28 @@ g_object_class_find_property(GtkObjectClass *class,gchar *name) return spec; } +GParamSpec ** +g_object_class_list_properties(GtkObjectClass *oclass,guint *n_properties) { + GType type = G_OBJECT_CLASS_TYPE (oclass); + guint32 *flags; + GtkArg *args; + gint num_args; + GParamSpec **params; + int i; + + args = gtk_object_query_args (type, &flags, &num_args); + + params = g_new0(GParamSpec *,num_args); + for (i=0;iname = args[i].name; + params[i]->value_type = args[i].type; + params[i]->flags = flags[i]; + } + + return params; +} + GParamSpec * g_param_spec_boolean(gchar *name,gchar *nick,gchar *blurb,gboolean def,gint flags) { GParamSpec *spec = g_new(GParamSpec,1); diff --git a/gst/gobject2gtk.h b/gst/gobject2gtk.h index 63ac87295a..b80f9fc110 100644 --- a/gst/gobject2gtk.h +++ b/gst/gobject2gtk.h @@ -189,6 +189,7 @@ struct _GParamSpec { void g_object_class_install_property(GtkObjectClass *oclass,guint property_id,GParamSpec *pspec); GParamSpec *g_object_class_find_property(GtkObjectClass *oclass,gchar *name); +GParamSpec **g_object_class_list_properties(GtkObjectClass *oclass,guint *n_properties); #define G_IS_PARAM_SPEC_ENUM(pspec) (GTK_FUNDAMENTAL_TYPE(pspec->value_type) == GTK_TYPE_ENUM) diff --git a/tools/gstreamer-compprep.c b/tools/gstreamer-compprep.c index 97cf461764..40492ad169 100644 --- a/tools/gstreamer-compprep.c +++ b/tools/gstreamer-compprep.c @@ -11,7 +11,6 @@ int main(int argc,char *argv[]) { GstPad *pad; GstPadTemplate *padtemplate; GParamSpec **property_specs; - guint32 *flags; gint num_properties,i; gst_debug_set_categories(0); @@ -64,24 +63,9 @@ int main(int argc,char *argv[]) { } // write out the args -#ifdef USE_GLIB2 - // FIXME accessing private data of GObjectClass !!! - num_properties = G_OBJECT_GET_CLASS (element)->n_property_specs; - property_specs = G_OBJECT_GET_CLASS (element)->property_specs; -#else - property_specs = (GParamSpec **)gtk_object_query_args (GTK_OBJECT_TYPE (element), &flags, &num_properties); -#endif + property_specs = g_object_class_list_properties(G_OBJECT_GET_CLASS (element), &num_properties); for (i=0;ivalue_type = args[i].type; - param->name = args[i].name; -#endif argnode = xmlNewChild (factorynode, NULL, "argument", param->name); if (param->value_type == GST_TYPE_FILENAME) { xmlNewChild (argnode, NULL, "filename", NULL); diff --git a/tools/gstreamer-inspect.c b/tools/gstreamer-inspect.c index 4e34cc2328..6dd5b32335 100644 --- a/tools/gstreamer-inspect.c +++ b/tools/gstreamer-inspect.c @@ -80,7 +80,6 @@ print_element_info (GstElementFactory *factory) GstPad *pad; GstRealPad *realpad; GstPadTemplate *padtemplate; - guint32 *flags; gint num_properties,i; GParamSpec **property_specs; GList *children; @@ -254,27 +253,12 @@ print_element_info (GstElementFactory *factory) } else printf(" none\n"); -#ifdef USE_GLIB2 - // FIXME accessing private data of GObjectClass !!! - num_properties = G_OBJECT_GET_CLASS (element)->n_property_specs; - property_specs = G_OBJECT_GET_CLASS (element)->property_specs; -#else - property_specs = (GParamSpec **)gtk_object_query_args (GTK_OBJECT_TYPE (element), &flags, &num_properties); -#endif + property_specs = g_object_class_list_properties(G_OBJECT_GET_CLASS (element), &num_properties); printf("\nElement Arguments:\n"); for (i=0;ivalue_type = args[i].type; - param->name = args[i].name; -#endif g_value_init (&value, param->value_type); g_object_get_property (G_OBJECT (element), param->name, &value);