mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01:00
add an instance member value_type so the default value of the pspec class
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.
This commit is contained in:
parent
1fa6aaca4f
commit
71a6ca2542
@ -1,3 +1,8 @@
|
|||||||
|
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>
|
2000-12-14 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* makefile.mingw.in: Update, include parts from Makefile.am to
|
* makefile.mingw.in: Update, include parts from Makefile.am to
|
||||||
|
@ -34,7 +34,8 @@ static void g_param_spec_class_base_init (GParamSpecClass *class);
|
|||||||
static void g_param_spec_class_base_finalize (GParamSpecClass *class);
|
static void g_param_spec_class_base_finalize (GParamSpecClass *class);
|
||||||
static void g_param_spec_class_init (GParamSpecClass *class,
|
static void g_param_spec_class_init (GParamSpecClass *class,
|
||||||
gpointer class_data);
|
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 g_param_spec_finalize (GParamSpec *pspec);
|
||||||
static void value_param_init (GValue *value);
|
static void value_param_init (GValue *value);
|
||||||
static void value_param_free_value (GValue *value);
|
static void value_param_free_value (GValue *value);
|
||||||
@ -120,12 +121,14 @@ g_param_spec_class_init (GParamSpecClass *class,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_param_spec_init (GParamSpec *pspec)
|
g_param_spec_init (GParamSpec *pspec,
|
||||||
|
GParamSpecClass *class)
|
||||||
{
|
{
|
||||||
pspec->name = NULL;
|
pspec->name = NULL;
|
||||||
pspec->nick = NULL;
|
pspec->nick = NULL;
|
||||||
pspec->blurb = NULL;
|
pspec->blurb = NULL;
|
||||||
pspec->flags = 0;
|
pspec->flags = 0;
|
||||||
|
pspec->value_type = class->value_type;
|
||||||
pspec->owner_type = 0;
|
pspec->owner_type = 0;
|
||||||
pspec->qdata = NULL;
|
pspec->qdata = NULL;
|
||||||
pspec->ref_count = 1;
|
pspec->ref_count = 1;
|
||||||
|
@ -37,7 +37,7 @@ extern "C" {
|
|||||||
#define G_PARAM_SPEC(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM, GParamSpec))
|
#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_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_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))
|
#define G_IS_VALUE_PARAM(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_PARAM))
|
||||||
|
|
||||||
|
|
||||||
@ -67,6 +67,7 @@ struct _GParamSpec
|
|||||||
gchar *nick;
|
gchar *nick;
|
||||||
gchar *blurb;
|
gchar *blurb;
|
||||||
GParamFlags flags;
|
GParamFlags flags;
|
||||||
|
GType value_type;
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
GType owner_type;
|
GType owner_type;
|
||||||
|
@ -543,9 +543,7 @@ param_string_values_cmp (GParamSpec *pspec,
|
|||||||
static void
|
static void
|
||||||
param_spec_param_init (GParamSpec *pspec)
|
param_spec_param_init (GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GParamSpecParam *spec = G_PARAM_SPEC_PARAM (pspec);
|
/* GParamSpecParam *spec = G_PARAM_SPEC_PARAM (pspec); */
|
||||||
|
|
||||||
spec->param_type = G_TYPE_PARAM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -559,11 +557,11 @@ static gboolean
|
|||||||
param_param_validate (GParamSpec *pspec,
|
param_param_validate (GParamSpec *pspec,
|
||||||
GValue *value)
|
GValue *value)
|
||||||
{
|
{
|
||||||
GParamSpecParam *spec = G_PARAM_SPEC_PARAM (pspec);
|
/* GParamSpecParam *spec = G_PARAM_SPEC_PARAM (pspec); */
|
||||||
GParamSpec *param = value->data[0].v_pointer;
|
GParamSpec *param = value->data[0].v_pointer;
|
||||||
guint changed = 0;
|
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);
|
g_param_spec_unref (param);
|
||||||
value->data[0].v_pointer = NULL;
|
value->data[0].v_pointer = NULL;
|
||||||
@ -640,9 +638,7 @@ param_ccallback_values_cmp (GParamSpec *pspec,
|
|||||||
static void
|
static void
|
||||||
param_spec_boxed_init (GParamSpec *pspec)
|
param_spec_boxed_init (GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GParamSpecBoxed *bspec = G_PARAM_SPEC_BOXED (pspec);
|
/* GParamSpecBoxed *bspec = G_PARAM_SPEC_BOXED (pspec); */
|
||||||
|
|
||||||
bspec->boxed_type = G_TYPE_BOXED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -675,9 +671,7 @@ param_boxed_values_cmp (GParamSpec *pspec,
|
|||||||
static void
|
static void
|
||||||
param_spec_object_init (GParamSpec *pspec)
|
param_spec_object_init (GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GParamSpecObject *ospec = G_PARAM_SPEC_OBJECT (pspec);
|
/* GParamSpecObject *ospec = G_PARAM_SPEC_OBJECT (pspec); */
|
||||||
|
|
||||||
ospec->object_type = G_TYPE_OBJECT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -695,7 +689,7 @@ param_object_validate (GParamSpec *pspec,
|
|||||||
GObject *object = value->data[0].v_pointer;
|
GObject *object = value->data[0].v_pointer;
|
||||||
guint changed = 0;
|
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);
|
g_object_unref (object);
|
||||||
value->data[0].v_pointer = NULL;
|
value->data[0].v_pointer = NULL;
|
||||||
@ -1496,7 +1490,7 @@ g_param_spec_param (const gchar *name,
|
|||||||
nick,
|
nick,
|
||||||
blurb,
|
blurb,
|
||||||
flags);
|
flags);
|
||||||
pspec->param_type = param_type;
|
G_PARAM_SPEC (pspec)->value_type = param_type;
|
||||||
|
|
||||||
return G_PARAM_SPEC (pspec);
|
return G_PARAM_SPEC (pspec);
|
||||||
}
|
}
|
||||||
@ -1543,13 +1537,14 @@ g_param_spec_boxed (const gchar *name,
|
|||||||
GParamSpecBoxed *bspec;
|
GParamSpecBoxed *bspec;
|
||||||
|
|
||||||
g_return_val_if_fail (G_TYPE_IS_BOXED (boxed_type), NULL);
|
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,
|
bspec = g_param_spec_internal (G_TYPE_PARAM_BOXED,
|
||||||
name,
|
name,
|
||||||
nick,
|
nick,
|
||||||
blurb,
|
blurb,
|
||||||
flags);
|
flags);
|
||||||
bspec->boxed_type = boxed_type;
|
G_PARAM_SPEC (bspec)->value_type = boxed_type;
|
||||||
|
|
||||||
return G_PARAM_SPEC (bspec);
|
return G_PARAM_SPEC (bspec);
|
||||||
}
|
}
|
||||||
@ -1570,7 +1565,7 @@ g_param_spec_object (const gchar *name,
|
|||||||
nick,
|
nick,
|
||||||
blurb,
|
blurb,
|
||||||
flags);
|
flags);
|
||||||
ospec->object_type = object_type;
|
G_PARAM_SPEC (ospec)->value_type = object_type;
|
||||||
|
|
||||||
return G_PARAM_SPEC (ospec);
|
return G_PARAM_SPEC (ospec);
|
||||||
}
|
}
|
||||||
|
@ -188,8 +188,6 @@ struct _GParamSpecString
|
|||||||
struct _GParamSpecParam
|
struct _GParamSpecParam
|
||||||
{
|
{
|
||||||
GParamSpec parent_instance;
|
GParamSpec parent_instance;
|
||||||
|
|
||||||
GType param_type;
|
|
||||||
};
|
};
|
||||||
struct _GParamSpecPointer
|
struct _GParamSpecPointer
|
||||||
{
|
{
|
||||||
@ -202,14 +200,10 @@ struct _GParamSpecCCallback
|
|||||||
struct _GParamSpecBoxed
|
struct _GParamSpecBoxed
|
||||||
{
|
{
|
||||||
GParamSpec parent_instance;
|
GParamSpec parent_instance;
|
||||||
|
|
||||||
GType boxed_type;
|
|
||||||
};
|
};
|
||||||
struct _GParamSpecObject
|
struct _GParamSpecObject
|
||||||
{
|
{
|
||||||
GParamSpec parent_instance;
|
GParamSpec parent_instance;
|
||||||
|
|
||||||
GType object_type;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -193,14 +193,14 @@ guint g_signal_handlers_disconnect_matched (gpointer instance,
|
|||||||
GClosure *closure,
|
GClosure *closure,
|
||||||
gpointer func,
|
gpointer func,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
|
|
||||||
/*< private >*/
|
|
||||||
gboolean g_signal_parse_name (const gchar *detailed_signal,
|
gboolean g_signal_parse_name (const gchar *detailed_signal,
|
||||||
GType itype,
|
GType itype,
|
||||||
guint *signal_id_p,
|
guint *signal_id_p,
|
||||||
GQuark *detail_p,
|
GQuark *detail_p,
|
||||||
gboolean force_detail_quark);
|
gboolean force_detail_quark);
|
||||||
|
|
||||||
|
|
||||||
|
/*< private >*/
|
||||||
void g_signal_handlers_destroy (gpointer instance);
|
void g_signal_handlers_destroy (gpointer instance);
|
||||||
void _g_signals_destroy (GType itype);
|
void _g_signals_destroy (GType itype);
|
||||||
|
|
||||||
|
@ -103,6 +103,7 @@ typedef enum /*< skip >*/
|
|||||||
/* Type Checking Macros
|
/* Type Checking Macros
|
||||||
*/
|
*/
|
||||||
#define G_TYPE_IS_FUNDAMENTAL(type) (G_TYPE_BRANCH_SEQNO (type) == 0)
|
#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_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_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))
|
#define G_TYPE_IS_INSTANTIATABLE(type) (g_type_check_flags ((type), G_TYPE_FLAG_INSTANTIATABLE))
|
||||||
|
Loading…
Reference in New Issue
Block a user