+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.
# 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
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);
GObject* (*constructor) (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_properties);
- void (*get_property) (GObject *object,
+ void (*set_property) (GObject *object,
guint property_id,
- GValue *value,
+ const GValue *value,
GParamSpec *pspec,
const gchar *trailer);
- void (*set_property) (GObject *object,
+ void (*get_property) (GObject *object,
guint property_id,
- const GValue *value,
+ GValue *value,
GParamSpec *pspec,
const gchar *trailer);
void (*shutdown) (GObject *object);
}
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)
{
GParamSpecObject *ospec = G_PARAM_SPEC_OBJECT (pspec);
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
*/
{
}
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,
const gchar *blurb,
#include <gobject/gvalue.h>
#include <gobject/genums.h>
+#include <gobject/gboxed.h>
#include <gobject/gobject.h>
#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))
typedef struct _GParamSpecParam GParamSpecParam;
typedef struct _GParamSpecPointer GParamSpecPointer;
typedef struct _GParamSpecCCallback GParamSpecCCallback;
+typedef struct _GParamSpecBoxed GParamSpecBoxed;
typedef struct _GParamSpecObject GParamSpecObject;
struct _GParamSpecChar
{
{
GParamSpec parent_instance;
};
+struct _GParamSpecBoxed
+{
+ GParamSpec parent_instance;
+
+ GType boxed_type;
+};
struct _GParamSpecObject
{
GParamSpec parent_instance;
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,
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;