+Fri Dec 15 04:40:23 2000 Tim Janik <timj@gtk.org>
+
+ * gparam.[hc]: add an instance member value_type so the default
+ value of the pspec class can be overridden.
+
2000-12-14 Tor Lillqvist <tml@iki.fi>
* makefile.mingw.in: Update, include parts from Makefile.am to
static void g_param_spec_class_base_finalize (GParamSpecClass *class);
static void g_param_spec_class_init (GParamSpecClass *class,
gpointer class_data);
-static void g_param_spec_init (GParamSpec *pspec);
+static void g_param_spec_init (GParamSpec *pspec,
+ GParamSpecClass *class);
static void g_param_spec_finalize (GParamSpec *pspec);
static void value_param_init (GValue *value);
static void value_param_free_value (GValue *value);
}
static void
-g_param_spec_init (GParamSpec *pspec)
+g_param_spec_init (GParamSpec *pspec,
+ GParamSpecClass *class)
{
pspec->name = NULL;
pspec->nick = NULL;
pspec->blurb = NULL;
pspec->flags = 0;
+ pspec->value_type = class->value_type;
pspec->owner_type = 0;
pspec->qdata = NULL;
pspec->ref_count = 1;
#define G_PARAM_SPEC(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM, GParamSpec))
#define G_IS_PARAM_SPEC(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM))
#define G_PARAM_SPEC_GET_CLASS(pspec) (G_TYPE_INSTANCE_GET_CLASS ((pspec), G_TYPE_PARAM, GParamSpecClass))
-#define G_PARAM_SPEC_VALUE_TYPE(pspec) (G_PARAM_SPEC_GET_CLASS (pspec)->value_type)
+#define G_PARAM_SPEC_VALUE_TYPE(pspec) (G_PARAM_SPEC (pspec)->value_type)
#define G_IS_VALUE_PARAM(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_PARAM))
gchar *nick;
gchar *blurb;
GParamFlags flags;
+ GType value_type;
/*< private >*/
GType owner_type;
static void
param_spec_param_init (GParamSpec *pspec)
{
- GParamSpecParam *spec = G_PARAM_SPEC_PARAM (pspec);
-
- spec->param_type = G_TYPE_PARAM;
+ /* GParamSpecParam *spec = G_PARAM_SPEC_PARAM (pspec); */
}
static void
param_param_validate (GParamSpec *pspec,
GValue *value)
{
- GParamSpecParam *spec = G_PARAM_SPEC_PARAM (pspec);
+ /* GParamSpecParam *spec = G_PARAM_SPEC_PARAM (pspec); */
GParamSpec *param = value->data[0].v_pointer;
guint changed = 0;
- if (param && !g_type_is_a (G_PARAM_SPEC_TYPE (param), spec->param_type))
+ if (param && !g_type_is_a (G_PARAM_SPEC_TYPE (param), G_PARAM_SPEC_VALUE_TYPE (pspec)))
{
g_param_spec_unref (param);
value->data[0].v_pointer = NULL;
static void
param_spec_boxed_init (GParamSpec *pspec)
{
- GParamSpecBoxed *bspec = G_PARAM_SPEC_BOXED (pspec);
-
- bspec->boxed_type = G_TYPE_BOXED;
+ /* GParamSpecBoxed *bspec = G_PARAM_SPEC_BOXED (pspec); */
}
static void
static void
param_spec_object_init (GParamSpec *pspec)
{
- GParamSpecObject *ospec = G_PARAM_SPEC_OBJECT (pspec);
-
- ospec->object_type = G_TYPE_OBJECT;
+ /* GParamSpecObject *ospec = G_PARAM_SPEC_OBJECT (pspec); */
}
static void
GObject *object = value->data[0].v_pointer;
guint changed = 0;
- if (object && !g_type_is_a (G_OBJECT_TYPE (object), ospec->object_type))
+ if (object && !g_type_is_a (G_OBJECT_TYPE (object), G_PARAM_SPEC_VALUE_TYPE (ospec)))
{
g_object_unref (object);
value->data[0].v_pointer = NULL;
nick,
blurb,
flags);
- pspec->param_type = param_type;
+ G_PARAM_SPEC (pspec)->value_type = param_type;
return G_PARAM_SPEC (pspec);
}
GParamSpecBoxed *bspec;
g_return_val_if_fail (G_TYPE_IS_BOXED (boxed_type), NULL);
+ g_return_val_if_fail (G_TYPE_IS_DERIVED (boxed_type), NULL);
bspec = g_param_spec_internal (G_TYPE_PARAM_BOXED,
name,
nick,
blurb,
flags);
- bspec->boxed_type = boxed_type;
+ G_PARAM_SPEC (bspec)->value_type = boxed_type;
return G_PARAM_SPEC (bspec);
}
nick,
blurb,
flags);
- ospec->object_type = object_type;
+ G_PARAM_SPEC (ospec)->value_type = object_type;
return G_PARAM_SPEC (ospec);
}
struct _GParamSpecParam
{
GParamSpec parent_instance;
-
- GType param_type;
};
struct _GParamSpecPointer
{
struct _GParamSpecBoxed
{
GParamSpec parent_instance;
-
- GType boxed_type;
};
struct _GParamSpecObject
{
GParamSpec parent_instance;
-
- GType object_type;
};
GClosure *closure,
gpointer func,
gpointer data);
-
-
-/*< private >*/
gboolean g_signal_parse_name (const gchar *detailed_signal,
GType itype,
guint *signal_id_p,
GQuark *detail_p,
gboolean force_detail_quark);
+
+
+/*< private >*/
void g_signal_handlers_destroy (gpointer instance);
void _g_signals_destroy (GType itype);
/* Type Checking Macros
*/
#define G_TYPE_IS_FUNDAMENTAL(type) (G_TYPE_BRANCH_SEQNO (type) == 0)
+#define G_TYPE_IS_DERIVED(type) (G_TYPE_BRANCH_SEQNO (type) > 0)
#define G_TYPE_IS_INTERFACE(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_INTERFACE)
#define G_TYPE_IS_CLASSED(type) (g_type_check_flags ((type), G_TYPE_FLAG_CLASSED))
#define G_TYPE_IS_INSTANTIATABLE(type) (g_type_check_flags ((type), G_TYPE_FLAG_INSTANTIATABLE))