summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Walthinsen <omega@temple-baptist.org>2001-06-25 00:07:55 +0000
committerErik Walthinsen <omega@temple-baptist.org>2001-06-25 00:07:55 +0000
commit764caf771728e9ba2aba86245b1ca18263c6e31b (patch)
treeedb9fa13fffca623345a26c2c2a7c47a2a882fcc
parent01e05ff187cfef34caaf73aa4ec96efa063aa983 (diff)
added shim for g_object_class_list_properties and converted -inspect and -compprep to use itGOBJECT1-200106241-ROOTBRANCH-GOBJECT1
Original commit message from CVS: added shim for g_object_class_list_properties and converted -inspect and -compprep to use it
-rw-r--r--gst/gobject2gtk.c22
-rw-r--r--gst/gobject2gtk.h1
-rw-r--r--tools/gstreamer-compprep.c18
-rw-r--r--tools/gstreamer-inspect.c18
4 files changed, 25 insertions, 34 deletions
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;i<num_args;i++) {
+ params[i] = g_new0(GParamSpec,1);
+ params[i]->name = 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;i<num_properties;i++) {
-#ifdef USE_GLIB2
GParamSpec *param = property_specs[i];
-#else
- // gtk doesn't have a paramspec, so we create one here
- GParamSpec rparm, *param = &rparm;
- GtkArg *args = (GtkArg *)property_specs; // ugly typecast here
-
- param->value_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;i<num_properties;i++) {
GValue value = { 0, };
-#ifdef USE_GLIB2
GParamSpec *param = property_specs[i];
-#else
- // gtk doesn't have a paramspec, so we create one here
- GParamSpec rparm, *param = &rparm;
- GtkArg *args = (GtkArg *)property_specs; // ugly typecast here
-
- param->value_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);