mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 15:51:11 +00:00
f0c9187f69
Original commit message from CVS: Added gobject to gtkobject bridge (gobject2gtk.[ch]) and configure-time support for selecting between glib and gtk (--enable-glib2 to build with gobject).
199 lines
4.3 KiB
C
199 lines
4.3 KiB
C
#include <stdio.h>
|
|
#include "gobject2gtk.h"
|
|
|
|
|
|
|
|
// GObject dummy implementation
|
|
static void
|
|
g_object_set_arg(GtkObject *object, GtkArg *arg, guint id)
|
|
{
|
|
((GObjectClass *)object->klass)->set_property((GObject *)object,id,arg,NULL);
|
|
}
|
|
|
|
static void
|
|
g_object_get_arg(GtkObject *object, GtkArg *arg, guint id)
|
|
{
|
|
((GObjectClass *)object->klass)->get_property((GObject *)object,id,arg,NULL);
|
|
}
|
|
|
|
static void
|
|
g_object_base_class_init (GObjectClass *klass)
|
|
{
|
|
GtkObjectClass *gtkobject_class;
|
|
|
|
gtkobject_class = (GtkObjectClass*) klass;
|
|
|
|
gtkobject_class->set_arg = g_object_set_arg;
|
|
gtkobject_class->get_arg = g_object_get_arg;
|
|
}
|
|
|
|
GType
|
|
g_object_get_type (void)
|
|
{
|
|
static GType object_type = 0;
|
|
|
|
if (!object_type) {
|
|
static const GtkTypeInfo object_info = {
|
|
"GObject",
|
|
sizeof(GObject),
|
|
sizeof(GObjectClass),
|
|
(GtkClassInitFunc)NULL,
|
|
(GtkObjectInitFunc)NULL,
|
|
(GtkArgSetFunc)NULL,
|
|
(GtkArgGetFunc)NULL,
|
|
(GtkClassInitFunc)g_object_base_class_init,
|
|
};
|
|
object_type = gtk_type_unique(gtk_object_get_type(),&object_info);
|
|
}
|
|
return object_type;
|
|
}
|
|
|
|
|
|
|
|
|
|
guint
|
|
g_type_register_static (GtkType parent_type, gchar *type_name,
|
|
const GTypeInfo *info, guint flags)
|
|
{
|
|
GtkTypeInfo gtkinfo = {
|
|
type_name,
|
|
info->instance_size,
|
|
info->class_size,
|
|
info->class_init,
|
|
info->instance_init,
|
|
NULL,
|
|
NULL,
|
|
info->base_init,
|
|
};
|
|
return gtk_type_unique(parent_type,>kinfo);
|
|
}
|
|
|
|
|
|
gpointer
|
|
g_object_new(GtkType type,gpointer blah_varargs_stuff) {
|
|
return gtk_type_new(type);
|
|
}
|
|
|
|
|
|
void
|
|
g_object_class_install_property(GtkObjectClass *oclass,guint property_id,GParamSpec *pspec)
|
|
{
|
|
gchar *arg_fullname;
|
|
|
|
arg_fullname = g_strdup_printf("%s::%s",gtk_type_name(oclass->type),pspec->shortname);
|
|
fprintf(stderr,"installing arg \"%s\" into class \"%s\"\n",arg_fullname,"");
|
|
gtk_object_add_arg_type(arg_fullname,pspec->value_type,pspec->flags,property_id);
|
|
g_free(pspec);
|
|
}
|
|
|
|
GParamSpec *
|
|
g_object_class_find_property(GtkObjectClass *class,const gchar *name)
|
|
{
|
|
GtkArgInfo *info;
|
|
gchar *result;
|
|
GParamSpec *spec;
|
|
|
|
fprintf(stderr,"class name is %s\n",gtk_type_name(class->type));
|
|
|
|
gtk_object_arg_get_info(class->type,name,&info);
|
|
spec = g_new0(GParamSpec,1);
|
|
|
|
if (info) {
|
|
spec->shortname = name;
|
|
spec->value_type = info->type;
|
|
spec->flags = info->arg_flags;
|
|
} else {
|
|
spec->value_type = GTK_TYPE_NONE;
|
|
}
|
|
|
|
return spec;
|
|
}
|
|
|
|
GParamSpec *
|
|
g_param_spec_boolean(gchar *name,gchar *nick,gchar *blurb,gboolean def,gint flags) {
|
|
GParamSpec *spec = g_new(GParamSpec,1);
|
|
|
|
spec->shortname = name;
|
|
spec->value_type = GTK_TYPE_BOOL;
|
|
spec->flags = flags;
|
|
|
|
return spec;
|
|
}
|
|
|
|
GParamSpec *
|
|
g_param_spec_enum(gchar *name,gchar *nick,gchar *blurb,GtkType e,guint def,gint flags) {
|
|
GParamSpec *spec = g_new(GParamSpec,1);
|
|
|
|
spec->shortname = name;
|
|
spec->value_type = e;
|
|
spec->flags = flags;
|
|
|
|
return spec;
|
|
}
|
|
|
|
GParamSpec *
|
|
g_param_spec_int(gchar *name,gchar *nick,gchar *blurb,gint min,gint max,gint def,gint flags) {
|
|
GParamSpec *spec = g_new(GParamSpec,1);
|
|
|
|
spec->shortname = name;
|
|
spec->value_type = GTK_TYPE_INT;
|
|
spec->flags = flags;
|
|
|
|
return spec;
|
|
}
|
|
|
|
GParamSpec *
|
|
g_param_spec_uint(gchar *name,gchar *nick,gchar *blurb,guint min,guint max,guint def,gint flags) {
|
|
GParamSpec *spec = g_new(GParamSpec,1);
|
|
|
|
spec->shortname = name;
|
|
spec->value_type = GTK_TYPE_UINT;
|
|
spec->flags = flags;
|
|
|
|
return spec;
|
|
}
|
|
|
|
GParamSpec *
|
|
g_param_spec_long(gchar *name,gchar *nick,gchar *blurb,glong min,glong max,glong def,gint flags) {
|
|
GParamSpec *spec = g_new(GParamSpec,1);
|
|
|
|
spec->shortname = name;
|
|
spec->value_type = GTK_TYPE_LONG;
|
|
spec->flags = flags;
|
|
|
|
return spec;
|
|
}
|
|
|
|
GParamSpec *
|
|
g_param_spec_ulong(gchar *name,gchar *nick,gchar *blurb,gulong min,gulong max,gulong def,gint flags) {
|
|
GParamSpec *spec = g_new(GParamSpec,1);
|
|
|
|
spec->shortname = name;
|
|
spec->value_type = GTK_TYPE_ULONG;
|
|
spec->flags = flags;
|
|
|
|
return spec;
|
|
}
|
|
|
|
GParamSpec *
|
|
g_param_spec_pointer(gchar *name,gchar *nick,gchar *blurb,gint flags) {
|
|
GParamSpec *spec = g_new(GParamSpec,1);
|
|
|
|
spec->shortname = name;
|
|
spec->value_type = GTK_TYPE_POINTER;
|
|
spec->flags = flags;
|
|
|
|
return spec;
|
|
}
|
|
|
|
GParamSpec *
|
|
g_param_spec_string(gchar *name,gchar *nick,gchar *blurb,gchar *def,gint flags) {
|
|
GParamSpec *spec = g_new(GParamSpec,1);
|
|
|
|
spec->shortname = name;
|
|
spec->value_type = GTK_TYPE_STRING;
|
|
spec->flags = flags;
|
|
|
|
return spec;
|
|
}
|
|
|