changed prototype of g_boxed_type_register_static() to contain an optional
[platform/upstream/glib.git] / gobject / gclosure.h
index 2ca0f3f..8ae329f 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 2000 Red Hat, Inc.
+ * Copyright (C) 2000-2001 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -32,12 +32,13 @@ extern "C" {
 /* --- defines --- */
 #define        G_CLOSURE_NEEDS_MARSHAL(closure) (((GClosure*) (closure))->marshal == NULL)
 #define        G_CCLOSURE_SWAP_DATA(cclosure)   (((GClosure*) (closure))->derivative_flag)
+#define        G_CALLBACK(f)                    ((GCallback) (f))
 
 
 /* -- typedefs --- */
 typedef struct _GClosure                GClosure;
 typedef struct _GClosureNotifyData      GClosureNotifyData;
-typedef        gpointer GCallback;
+typedef        gpointer                         GCallback;
 typedef void  (*GClosureNotify)                (gpointer        data,
                                         GClosure       *closure);
 typedef void  (*GClosureMarshal)       (GClosure       *closure,
@@ -84,7 +85,7 @@ struct _GClosure
    * - order of inotifiers is random
    *   inotifiers may _not_ free/invalidate parameter values (e.g. ->data)
    * - order of fnotifiers is random
-   * - notifiers may only be removed before or during their invocation
+   * - each notifier may only be removed before or during its invocation
    * - reference counting may only happen prior to fnotify invocation
    *   (in that sense, fnotifiers are really finalization handlers)
    */
@@ -105,12 +106,13 @@ GClosure* g_cclosure_new                  (GCallback      callback_func,
 GClosure*      g_cclosure_new_swap             (GCallback      callback_func,
                                                 gpointer       user_data,
                                                 GClosureNotify destroy_data);
-GClosure*      g_signal_type_closure_new       (GType          itype,
+GClosure*      g_signal_type_cclosure_new      (GType          itype,
                                                 guint          struct_offset);
 
 
 /* --- prototypes --- */
 GClosure*      g_closure_ref                   (GClosure       *closure);
+void           g_closure_sink                  (GClosure       *closure);
 void           g_closure_unref                 (GClosure       *closure);
 /* intimidating */
 GClosure*      g_closure_new_simple            (guint           sizeof_closure,
@@ -145,36 +147,15 @@ void              g_closure_invoke                (GClosure       *closure,
                                                 gpointer        invocation_hint);
 
 
-/*
-  data_object::destroy         -> closure_invalidate();
-  closure_invalidate()         -> disconnect(closure);
-  disconnect(closure)          -> (unlink) closure_unref();
-  closure_finalize()           -> g_free (data_string);
-  
-  1) need GObject and GType in glib
-  2) need GParam
-  3) need to resolve dtor cycles
-  4) need GSignal move
-  5) destroy on last caller ref or last data ref?
-  
-  
-  random remarks:
-  - don't mandate signals for GObject
-  - OTOH, don't mandate GObject for GSignal
-  - need marshaller repo with decent aliasing to base types
-  - provide marshaller collection, virtually covering anything out there
-  - at that point, still need GSignalCMarhsaller to g_signal_new() ?
-  - can we combine varargs collect mechanisms with marshaller stubs?
-  for out values (i.e. returntypes), that might get rid of the following
-  point...
-  - char* return signals with connections ala:
-  connect({ return "static data that can't work"; }),
-  connect({ return g_strdup ("properly duplicated string"); })
-  won't work anymore. CRASH
-
-  problems:
-  - accumulator needs gboolean to indicate EMISSION_STOP
-  - accumulator needs data
+/* FIXME:
+   OK:  data_object::destroy           -> closure_invalidate();
+   MIS:        closure_invalidate()            -> disconnect(closure);
+   MIS:        disconnect(closure)             -> (unlink) closure_unref();
+   OK: closure_finalize()              -> g_free (data_string);
+
+   random remarks:
+   - need marshaller repo with decent aliasing to base types
+   - provide marshaller collection, virtually covering anything out there
 */