Fixed the utils for getting properties.

Original commit message from CVS:
Fixed the utils for getting properties.
Added come const directives to the arguments.
This commit is contained in:
Wim Taymans 2001-06-17 02:47:57 +00:00
parent 1210758674
commit 704c3be21f
2 changed files with 25 additions and 18 deletions

View file

@ -37,10 +37,11 @@
* Returns: the property of the object * Returns: the property of the object
*/ */
gint gint
gst_util_get_int_arg (GObject *object,gchar *argname) gst_util_get_int_arg (GObject *object, const gchar *argname)
{ {
GValue value; GValue value;
g_value_init (&value, G_TYPE_INT);
g_object_get_property(G_OBJECT(object),argname,&value); g_object_get_property(G_OBJECT(object),argname,&value);
return g_value_get_int(&value); return g_value_get_int(&value);
} }
@ -55,10 +56,11 @@ gst_util_get_int_arg (GObject *object,gchar *argname)
* Returns: the property of the object * Returns: the property of the object
*/ */
gint gint
gst_util_get_bool_arg (GObject *object,gchar *argname) gst_util_get_bool_arg (GObject *object, const gchar *argname)
{ {
GValue value; GValue value;
g_value_init (&value, G_TYPE_BOOLEAN);
g_object_get_property(G_OBJECT(object),argname,&value); g_object_get_property(G_OBJECT(object),argname,&value);
return g_value_get_boolean(&value); return g_value_get_boolean(&value);
} }
@ -73,10 +75,11 @@ gst_util_get_bool_arg (GObject *object,gchar *argname)
* Returns: the property of the object * Returns: the property of the object
*/ */
glong glong
gst_util_get_long_arg (GObject *object,gchar *argname) gst_util_get_long_arg (GObject *object, const gchar *argname)
{ {
GValue value; GValue value;
g_value_init (&value, G_TYPE_LONG);
g_object_get_property(G_OBJECT(object),argname,&value); g_object_get_property(G_OBJECT(object),argname,&value);
return g_value_get_long(&value); return g_value_get_long(&value);
} }
@ -91,10 +94,11 @@ gst_util_get_long_arg (GObject *object,gchar *argname)
* Returns: the property of the object * Returns: the property of the object
*/ */
gfloat gfloat
gst_util_get_float_arg (GObject *object,gchar *argname) gst_util_get_float_arg (GObject *object, const gchar *argname)
{ {
GValue value; GValue value;
g_value_init (&value, G_TYPE_FLOAT);
g_object_get_property(G_OBJECT(object),argname,&value); g_object_get_property(G_OBJECT(object),argname,&value);
return g_value_get_float(&value); return g_value_get_float(&value);
} }
@ -109,10 +113,11 @@ gst_util_get_float_arg (GObject *object,gchar *argname)
* Returns: the property of the object * Returns: the property of the object
*/ */
gdouble gdouble
gst_util_get_double_arg (GObject *object,gchar *argname) gst_util_get_double_arg (GObject *object, const gchar *argname)
{ {
GValue value; GValue value;
g_value_init (&value, G_TYPE_DOUBLE);
g_object_get_property(G_OBJECT(object),argname,&value); g_object_get_property(G_OBJECT(object),argname,&value);
return g_value_get_double(&value); return g_value_get_double(&value);
} }
@ -126,11 +131,12 @@ gst_util_get_double_arg (GObject *object,gchar *argname)
* *
* Returns: the property of the object * Returns: the property of the object
*/ */
gchar* const gchar*
gst_util_get_string_arg (GObject *object,gchar *argname) gst_util_get_string_arg (GObject *object, const gchar *argname)
{ {
GValue value; GValue value;
g_value_init (&value, G_TYPE_STRING);
g_object_get_property(G_OBJECT(object),argname,&value); g_object_get_property(G_OBJECT(object),argname,&value);
return g_value_get_string(&value); return g_value_get_string(&value);
} }
@ -145,10 +151,11 @@ gst_util_get_string_arg (GObject *object,gchar *argname)
* Returns: the property of the object * Returns: the property of the object
*/ */
gpointer gpointer
gst_util_get_pointer_arg (GObject *object,gchar *argname) gst_util_get_pointer_arg (GObject *object, const gchar *argname)
{ {
GValue value; GValue value;
g_value_init (&value, G_TYPE_POINTER);
g_object_get_property(G_OBJECT(object),argname,&value); g_object_get_property(G_OBJECT(object),argname,&value);
return g_value_get_pointer(&value); return g_value_get_pointer(&value);
} }
@ -164,7 +171,7 @@ gst_util_get_pointer_arg (GObject *object,gchar *argname)
*/ */
/* COMMENTED OUT BECAUSE WE HAVE NO MORE gtk.h /* COMMENTED OUT BECAUSE WE HAVE NO MORE gtk.h
GtkWidget* GtkWidget*
gst_util_get_widget_property (GObject *object,gchar *argname) gst_util_get_widget_property (GObject *object, const gchar *argname)
{ {
GtkArg arg; GtkArg arg;
@ -212,7 +219,7 @@ gst_util_dump_mem (guchar *mem, guint size)
* sets the argument with it. * sets the argument with it.
*/ */
void void
gst_util_set_object_arg (GObject *object, gchar *name, gchar *value) gst_util_set_object_arg (GObject *object, const gchar *name, const gchar *value)
{ {
if (name && value) { if (name && value) {
GParamSpec *paramspec; GParamSpec *paramspec;

View file

@ -30,16 +30,16 @@
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
gint gst_util_get_int_arg (GObject *object, gchar *argname); gint gst_util_get_int_arg (GObject *object, const gchar *argname);
gboolean gst_util_get_bool_arg (GObject *object, gchar *argname); gboolean gst_util_get_bool_arg (GObject *object, const gchar *argname);
glong gst_util_get_long_arg (GObject *object, gchar *argname); glong gst_util_get_long_arg (GObject *object, const gchar *argname);
gfloat gst_util_get_float_arg (GObject *object, gchar *argname); gfloat gst_util_get_float_arg (GObject *object, const gchar *argname);
gdouble gst_util_get_double_arg (GObject *object, gchar *argname); gdouble gst_util_get_double_arg (GObject *object, const gchar *argname);
gchar* gst_util_get_string_arg (GObject *object, gchar *argname); const gchar* gst_util_get_string_arg (GObject *object, const gchar *argname);
gpointer gst_util_get_pointer_arg (GObject *object, gchar *argname); gpointer gst_util_get_pointer_arg (GObject *object, const gchar *argname);
//GtkWidget* gst_util_get_widget_property (GObject *object, gchar *argname); //GtkWidget* gst_util_get_widget_property (GObject *object, gchar *argname);
void gst_util_set_object_arg (GObject *object, gchar *name, gchar *value); void gst_util_set_object_arg (GObject *object, const gchar *name, const gchar *value);
void gst_util_dump_mem (guchar *mem, guint size); void gst_util_dump_mem (guchar *mem, guint size);