urg managed to forget this last time ;(
authorTim Janik <timj@gtk.org>
Wed, 13 Dec 2000 08:36:17 +0000 (08:36 +0000)
committerTim Janik <timj@src.gnome.org>
Wed, 13 Dec 2000 08:36:17 +0000 (08:36 +0000)
Wed Dec 13 09:31:26 2000  Tim Janik  <timj@gtk.org>

        * gparamspecs.[hc]: add G_TYPE_PARAM_BOXED implementation.

        * gobject.[hc]: minor fixes.

gobject/ChangeLog
gobject/Makefile.am
gobject/gobject.c
gobject/gobject.h
gobject/gparamspecs.c
gobject/gparamspecs.h
gobject/gtype.h

index 928ac3a..6d5e5e4 100644 (file)
@@ -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.
index 7baa429..a495ba9 100644 (file)
@@ -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
index 50e68a0..cc70c09 100644 (file)
@@ -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);
index 2d4bff6..6039061 100644 (file)
@@ -80,14 +80,14 @@ struct  _GObjectClass
   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);
index 64b63f0..54604a3 100644 (file)
@@ -638,6 +638,41 @@ param_ccallback_values_cmp (GParamSpec   *pspec,
 }
 
 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);
@@ -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
    */
   {
@@ -1482,6 +1534,27 @@ g_param_spec_ccallback (const gchar *name,
 }
 
 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,
index 5fb0b00..d70b1d2 100644 (file)
@@ -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,
index bbbf36b..e86eb7e 100644 (file)
@@ -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;