mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-16 12:28:48 +02:00
urg managed to forget this last time ;(
Wed Dec 13 09:31:26 2000 Tim Janik <timj@gtk.org> * gparamspecs.[hc]: add G_TYPE_PARAM_BOXED implementation. * gobject.[hc]: minor fixes.
This commit is contained in:
parent
9edb08492d
commit
484f2ee732
@ -1,3 +1,9 @@
|
||||
Wed Dec 13 09:31:26 2000 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gparamspecs.[hc]: add G_TYPE_PARAM_BOXED implementation.
|
||||
|
||||
* gobject.[hc]: minor fixes.
|
||||
|
||||
Tue Dec 12 23:38:02 2000 Tim Janik <timj@gtk.org>
|
||||
|
||||
* Makefile.am: _never_ touch oldest-source-stamp.
|
||||
|
@ -101,7 +101,7 @@ EXTRA_DIST += $(gruntime_built_sources)
|
||||
# setup autogeneration dependancies
|
||||
gen_sources = xgen-gmh xgen-gmc xgen-gms
|
||||
CLEANFILES += $(gen_sources)
|
||||
Makefile: oldest-source-stamp # oh boy, does automake SUCK!
|
||||
# Makefile: oldest-source-stamp # oh boy, does automake SUCK!
|
||||
oldest-source-stamp: $(gruntime_built_sources)
|
||||
|
||||
$(OBJECTS): oldest-source-stamp ${gruntime_built_public_sources} # this is our oldest file, used for implicit auto-generation deps
|
||||
|
@ -430,7 +430,7 @@ static void
|
||||
g_object_init (GObject *object)
|
||||
{
|
||||
object->ref_count = 1;
|
||||
object->qdata = NULL;
|
||||
g_datalist_init (&object->qdata);
|
||||
|
||||
/* freeze object's notification queue, g_object_new_valist() takes care of that */
|
||||
object_freeze_notifies (object);
|
||||
|
@ -80,16 +80,16 @@ struct _GObjectClass
|
||||
GObject* (*constructor) (GType type,
|
||||
guint n_construct_properties,
|
||||
GObjectConstructParam *construct_properties);
|
||||
void (*get_property) (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec,
|
||||
const gchar *trailer);
|
||||
void (*set_property) (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec,
|
||||
const gchar *trailer);
|
||||
void (*get_property) (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec,
|
||||
const gchar *trailer);
|
||||
void (*shutdown) (GObject *object);
|
||||
void (*finalize) (GObject *object);
|
||||
|
||||
|
@ -637,6 +637,41 @@ param_ccallback_values_cmp (GParamSpec *pspec,
|
||||
value1->data[1].v_pointer != value2->data[1].v_pointer);
|
||||
}
|
||||
|
||||
static void
|
||||
param_spec_boxed_init (GParamSpec *pspec)
|
||||
{
|
||||
GParamSpecBoxed *bspec = G_PARAM_SPEC_BOXED (pspec);
|
||||
|
||||
bspec->boxed_type = G_TYPE_BOXED;
|
||||
}
|
||||
|
||||
static void
|
||||
param_boxed_set_default (GParamSpec *pspec,
|
||||
GValue *value)
|
||||
{
|
||||
value->data[0].v_pointer = NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
param_boxed_validate (GParamSpec *pspec,
|
||||
GValue *value)
|
||||
{
|
||||
/* GParamSpecBoxed *bspec = G_PARAM_SPEC_BOXED (pspec); */
|
||||
guint changed = 0;
|
||||
|
||||
/* can't do a whole lot here since we haven't even G_BOXED_TYPE() */
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
static gint
|
||||
param_boxed_values_cmp (GParamSpec *pspec,
|
||||
const GValue *value1,
|
||||
const GValue *value2)
|
||||
{
|
||||
return value1->data[0].v_pointer != value2->data[0].v_pointer;
|
||||
}
|
||||
|
||||
static void
|
||||
param_spec_object_init (GParamSpec *pspec)
|
||||
{
|
||||
@ -1067,6 +1102,23 @@ g_param_spec_types_init (void) /* sync with gtype.c */
|
||||
g_assert (type == G_TYPE_PARAM_CCALLBACK);
|
||||
}
|
||||
|
||||
/* G_TYPE_PARAM_BOXED
|
||||
*/
|
||||
{
|
||||
static const GParamSpecTypeInfo pspec_info = {
|
||||
sizeof (GParamSpecBoxed), /* instance_size */
|
||||
4, /* n_preallocs */
|
||||
param_spec_boxed_init, /* instance_init */
|
||||
G_TYPE_BOXED, /* value_type */
|
||||
NULL, /* finalize */
|
||||
param_boxed_set_default, /* value_set_default */
|
||||
param_boxed_validate, /* value_validate */
|
||||
param_boxed_values_cmp, /* values_cmp */
|
||||
};
|
||||
type = g_param_type_register_static ("GParamBoxed", &pspec_info);
|
||||
g_assert (type == G_TYPE_PARAM_BOXED);
|
||||
}
|
||||
|
||||
/* G_TYPE_PARAM_OBJECT
|
||||
*/
|
||||
{
|
||||
@ -1481,6 +1533,27 @@ g_param_spec_ccallback (const gchar *name,
|
||||
return G_PARAM_SPEC (cspec);
|
||||
}
|
||||
|
||||
GParamSpec*
|
||||
g_param_spec_boxed (const gchar *name,
|
||||
const gchar *nick,
|
||||
const gchar *blurb,
|
||||
GType boxed_type,
|
||||
GParamFlags flags)
|
||||
{
|
||||
GParamSpecBoxed *bspec;
|
||||
|
||||
g_return_val_if_fail (G_TYPE_IS_BOXED (boxed_type), NULL);
|
||||
|
||||
bspec = g_param_spec_internal (G_TYPE_PARAM_BOXED,
|
||||
name,
|
||||
nick,
|
||||
blurb,
|
||||
flags);
|
||||
bspec->boxed_type = boxed_type;
|
||||
|
||||
return G_PARAM_SPEC (bspec);
|
||||
}
|
||||
|
||||
GParamSpec*
|
||||
g_param_spec_object (const gchar *name,
|
||||
const gchar *nick,
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <gobject/gvalue.h>
|
||||
#include <gobject/genums.h>
|
||||
#include <gobject/gboxed.h>
|
||||
#include <gobject/gobject.h>
|
||||
|
||||
|
||||
@ -63,6 +64,8 @@ extern "C" {
|
||||
#define G_PARAM_SPEC_POINTER(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_POINTER, GParamSpecPointer))
|
||||
#define G_IS_PARAM_SPEC_CCALLBACK(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_CCALLBACK))
|
||||
#define G_PARAM_SPEC_CCALLBACK(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_CCALLBACK, GParamSpecCCallback))
|
||||
#define G_IS_PARAM_SPEC_BOXED(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOXED))
|
||||
#define G_PARAM_SPEC_BOXED(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOXED, GParamSpecBoxed))
|
||||
#define G_IS_PARAM_SPEC_OBJECT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_OBJECT))
|
||||
#define G_PARAM_SPEC_OBJECT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_OBJECT, GParamSpecObject))
|
||||
|
||||
@ -83,6 +86,7 @@ typedef struct _GParamSpecString GParamSpecString;
|
||||
typedef struct _GParamSpecParam GParamSpecParam;
|
||||
typedef struct _GParamSpecPointer GParamSpecPointer;
|
||||
typedef struct _GParamSpecCCallback GParamSpecCCallback;
|
||||
typedef struct _GParamSpecBoxed GParamSpecBoxed;
|
||||
typedef struct _GParamSpecObject GParamSpecObject;
|
||||
struct _GParamSpecChar
|
||||
{
|
||||
@ -195,6 +199,12 @@ struct _GParamSpecCCallback
|
||||
{
|
||||
GParamSpec parent_instance;
|
||||
};
|
||||
struct _GParamSpecBoxed
|
||||
{
|
||||
GParamSpec parent_instance;
|
||||
|
||||
GType boxed_type;
|
||||
};
|
||||
struct _GParamSpecObject
|
||||
{
|
||||
GParamSpec parent_instance;
|
||||
@ -300,6 +310,11 @@ GParamSpec* g_param_spec_ccallback (const gchar *name,
|
||||
const gchar *nick,
|
||||
const gchar *blurb,
|
||||
GParamFlags flags);
|
||||
GParamSpec* g_param_spec_boxed (const gchar *name,
|
||||
const gchar *nick,
|
||||
const gchar *blurb,
|
||||
GType boxed_type,
|
||||
GParamFlags flags);
|
||||
GParamSpec* g_param_spec_object (const gchar *name,
|
||||
const gchar *nick,
|
||||
const gchar *blurb,
|
||||
|
@ -95,7 +95,8 @@ typedef enum /*< skip >*/
|
||||
G_TYPE_PARAM_PARAM = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 13),
|
||||
G_TYPE_PARAM_POINTER = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 14),
|
||||
G_TYPE_PARAM_CCALLBACK = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 15),
|
||||
G_TYPE_PARAM_OBJECT = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 16)
|
||||
G_TYPE_PARAM_BOXED = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 16),
|
||||
G_TYPE_PARAM_OBJECT = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 17)
|
||||
} GTypeFundamentals;
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user