we need signal.h for G_BREAKPOINT().
[platform/upstream/glib.git] / gobject / gobject.h
index 87f4de8..5d34232 100644 (file)
@@ -23,6 +23,8 @@
 #include        <gobject/gvalue.h>
 #include        <gobject/gparam.h>
 #include        <gobject/gclosure.h>
+#include        <gobject/gsignal.h>
+#include        <signal.h>
 
 G_BEGIN_DECLS
 
@@ -53,6 +55,8 @@ typedef void (*GObjectSetPropertyFunc)  (GObject      *object,
                                          const GValue *value,
                                          GParamSpec   *pspec);
 typedef void (*GObjectFinalizeFunc)     (GObject      *object);
+typedef void (*GWeakNotify)            (gpointer      data,
+                                        GObject      *where_the_object_was);
 struct  _GObject
 {
   GTypeInstance g_type_instance;
@@ -65,42 +69,37 @@ struct  _GObjectClass
 {
   GTypeClass   g_type_class;
 
-  /* private, these fields might vanish */
-  guint        n_property_specs;
-  GParamSpec **property_specs;
+  /*< private >*/
   GSList      *construct_properties;
 
   /* public overridable methods */
   GObject*   (*constructor)     (GType                  type,
                                  guint                  n_construct_properties,
                                  GObjectConstructParam *construct_properties);
-  void       (*set_property)            (GObject        *object,
+  void       (*set_property)           (GObject        *object,
                                          guint           property_id,
                                          const GValue   *value,
                                          GParamSpec     *pspec);
-  void       (*get_property)            (GObject        *object,
+  void       (*get_property)           (GObject        *object,
                                          guint           property_id,
                                          GValue         *value,
                                          GParamSpec     *pspec);
-  void       (*shutdown)                (GObject        *object);
-  void       (*finalize)                (GObject        *object);
-
-  /*< private >*/
+  void       (*dispose)                        (GObject        *object);
+  void       (*finalize)               (GObject        *object);
+  
+  /* seldomly overidden */
   void       (*dispatch_properties_changed) (GObject      *object,
                                             guint         n_pspecs,
                                             GParamSpec  **pspecs);
 
   /* signals */
-  void      (*properties_changed)      (GObject        *object,
-                                        guint           n_pspecs,
-                                        GParamSpec    **pspecs);
   void      (*notify)                  (GObject        *object,
                                         GParamSpec     *pspec);
 };
 struct _GObjectConstructParam
 {
-  GParamSpec  *pspec;
-  GValue      *value;
+  GParamSpec *pspec;
+  GValue     *value;
 };
 
 
@@ -110,13 +109,18 @@ void        g_object_class_install_property   (GObjectClass   *oclass,
                                               GParamSpec     *pspec);
 GParamSpec* g_object_class_find_property      (GObjectClass   *oclass,
                                               const gchar    *property_name);
+GParamSpec**g_object_class_list_properties    (GObjectClass   *oclass,
+                                              guint          *n_properties);
 gpointer    g_object_new                      (GType           object_type,
                                               const gchar    *first_property_name,
                                               ...);
-gpointer    g_object_new_valist               (GType           object_type,
+gpointer    g_object_newv                    (GType           object_type,
+                                              guint           n_parameters,
+                                              GParameter     *parameters);
+GObject*    g_object_new_valist               (GType           object_type,
                                               const gchar    *first_property_name,
                                               va_list         var_args);
-gpointer    g_object_set                      (gpointer               object,
+void       g_object_set                      (gpointer        object,
                                               const gchar    *first_property_name,
                                               ...);
 void        g_object_get                      (gpointer        object,
@@ -125,7 +129,7 @@ void        g_object_get                      (gpointer        object,
 gpointer    g_object_connect                  (gpointer               object,
                                               const gchar    *signal_spec,
                                               ...);
-gpointer    g_object_disconnect               (gpointer               object,
+void       g_object_disconnect               (gpointer        object,
                                               const gchar    *signal_spec,
                                               ...);
 void        g_object_set_valist               (GObject        *object,
@@ -146,6 +150,16 @@ void        g_object_notify                   (GObject        *object,
 void        g_object_thaw_notify              (GObject        *object);
 gpointer    g_object_ref                      (gpointer        object);
 void        g_object_unref                    (gpointer        object);
+void       g_object_weak_ref                 (GObject        *object,
+                                              GWeakNotify     notify,
+                                              gpointer        data);
+void       g_object_weak_unref               (GObject        *object,
+                                              GWeakNotify     notify,
+                                              gpointer        data);
+void        g_object_add_weak_pointer         (GObject        *object, 
+                                               gpointer       *weak_pointer_location);
+void        g_object_remove_weak_pointer      (GObject        *object, 
+                                               gpointer       *weak_pointer_location);
 gpointer    g_object_get_qdata                (GObject        *object,
                                               GQuark          quark);
 void        g_object_set_qdata                (GObject        *object,
@@ -171,9 +185,9 @@ gpointer    g_object_steal_data               (GObject        *object,
 void        g_object_watch_closure            (GObject        *object,
                                               GClosure       *closure);
 GClosure*   g_cclosure_new_object             (GCallback       callback_func,
-                                              gpointer        object);
+                                              GObject        *object);
 GClosure*   g_cclosure_new_object_swap        (GCallback       callback_func,
-                                              gpointer        object);
+                                              GObject        *object);
 GClosure*   g_closure_new_object              (guint           sizeof_closure,
                                               GObject        *object);
 void        g_value_set_object                (GValue         *value,
@@ -184,23 +198,29 @@ guint         g_signal_connect_object           (gpointer        instance,
                                               const gchar    *detailed_signal,
                                               GCallback       c_handler,
                                               gpointer        gobject,
-                                              gboolean        swapped,
-                                              gboolean        after);
+                                              GConnectFlags   connect_flags);
+
+
+/*< protected >*/
+void        g_object_run_dispose             (GObject        *object);
 
 
 /* --- implementation macros --- */
-#define G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec) \
+#define G_OBJECT_WARN_INVALID_PSPEC(object, pname, property_id, pspec) \
 G_STMT_START { \
   GObject *_object = (GObject*) (object); \
   GParamSpec *_pspec = (GParamSpec*) (pspec); \
   guint _property_id = (property_id); \
-  g_warning ("%s: invalid property id %u for \"%s\" of type `%s' in `%s'", \
+  g_warning ("%s: invalid %s id %u for \"%s\" of type `%s' in `%s'", \
              G_STRLOC, \
+             (pname), \
              _property_id, \
              _pspec->name, \
              g_type_name (G_PARAM_SPEC_TYPE (_pspec)), \
              G_OBJECT_TYPE_NAME (_object)); \
 } G_STMT_END
+#define G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec) \
+    G_OBJECT_WARN_INVALID_PSPEC ((object), "property id", (property_id), (pspec))
 
 G_END_DECLS