use g_signal_newc
authorHavoc Pennington <hp@pobox.com>
Fri, 15 Dec 2000 07:05:10 +0000 (07:05 +0000)
committerHavoc Pennington <hp@src.gnome.org>
Fri, 15 Dec 2000 07:05:10 +0000 (07:05 +0000)
2000-12-15  Havoc Pennington  <hp@pobox.com>

* gobject.c (g_object_do_class_init): use g_signal_newc

* gsignal.c (g_signal_newc): convenience function for signals
created from C
(g_signal_new_valist): added
(g_signal_new): removed

gobject/ChangeLog
gobject/gobject.c
gobject/gsignal.c
gobject/gsignal.h

index c420b14f9c8495d91ec967e3a271ad2970c5f3cd..d5c18324a415589469ca36b2f85486ae8789458e 100644 (file)
@@ -1,3 +1,12 @@
+2000-12-15  Havoc Pennington  <hp@pobox.com>
+
+       * gobject.c (g_object_do_class_init): use g_signal_newc
+
+       * gsignal.c (g_signal_newc): convenience function for signals
+       created from C
+       (g_signal_new_valist): added
+       (g_signal_new): removed
+
 Fri Dec 15 04:40:23 2000  Tim Janik  <timj@gtk.org>
 
        * gparam.[hc]: add an instance member value_type so the default
index cc70c0911c08beee78bf7d8fd3fa63700fc75120..6a8bc0b5cbb116277507552a0cd602e6091154cf 100644 (file)
@@ -299,25 +299,23 @@ g_object_do_class_init (GObjectClass *class)
                                                           "and a data pointer",
                                                           G_PARAM_WRITABLE));
   gobject_signals[PROPERTIES_CHANGED] =
-    g_signal_new ("properties_changed",
-                 G_TYPE_FROM_CLASS (class),
-                 G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
-                 g_signal_type_cclosure_new (G_TYPE_FROM_CLASS (class),
-                                             G_STRUCT_OFFSET (GObjectClass, properties_changed)),
-                 NULL, /* accumulator */
-                 g_cclosure_marshal_VOID__UINT_POINTER,
-                 G_TYPE_NONE,
-                 2, G_TYPE_UINT, G_TYPE_POINTER);
+    g_signal_newc ("properties_changed",
+                   G_TYPE_FROM_CLASS (class),
+                   G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
+                   G_STRUCT_OFFSET (GObjectClass, properties_changed),
+                   NULL, /* accumulator */
+                   g_cclosure_marshal_VOID__UINT_POINTER,
+                   G_TYPE_NONE,
+                   2, G_TYPE_UINT, G_TYPE_POINTER);
   gobject_signals[NOTIFY] =
-    g_signal_new ("notify",
-                 G_TYPE_FROM_CLASS (class),
-                 G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE | G_SIGNAL_DETAILED | G_SIGNAL_NO_HOOKS,
-                 g_signal_type_cclosure_new (G_TYPE_FROM_CLASS (class),
-                                             G_STRUCT_OFFSET (GObjectClass, notify)),
-                 NULL, /* accumulator */
-                 g_cclosure_marshal_VOID__PARAM,
-                 G_TYPE_NONE,
-                 1, G_TYPE_PARAM);
+    g_signal_newc ("notify",
+                   G_TYPE_FROM_CLASS (class),
+                   G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE | G_SIGNAL_DETAILED | G_SIGNAL_NO_HOOKS,
+                   G_STRUCT_OFFSET (GObjectClass, notify),
+                   NULL, /* accumulator */
+                   g_cclosure_marshal_VOID__PARAM,
+                   G_TYPE_NONE,
+                   1, G_TYPE_PARAM);
 }
 
 void
index dc93b5a2c218cd53ed0e3deba9a43101a3bf5abb..af69cc909a571e027901862775791c7ad1b96d97 100644 (file)
@@ -883,31 +883,26 @@ g_signal_list_ids (GType  itype,
 }
 
 guint
-g_signal_new (const gchar       *signal_name,
-             GType              itype,
-             GSignalFlags       signal_flags,
-             GClosure          *class_closure,
-             GSignalAccumulator accumulator,
-             GSignalCMarshaller c_marshaller,
-             GType              return_type,
-             guint              n_params,
-             ...)
+g_signal_new_valist (const gchar       *signal_name,
+                     GType              itype,
+                     GSignalFlags       signal_flags,
+                     GClosure          *class_closure,
+                     GSignalAccumulator accumulator,
+                     GSignalCMarshaller c_marshaller,
+                     GType              return_type,
+                     guint              n_params,
+                     va_list            args)
 {
   GType *param_types;
   guint i;
-  va_list args;
   guint signal_id;
 
   if (n_params > 0)
     {
       param_types = g_new (GType, n_params);
 
-      va_start (args, n_params);
-
       for (i = 0; i < n_params; i++)
        param_types[i] = va_arg (args, GType);
-
-      va_end (args);
     }
   else
     param_types = NULL;
@@ -920,6 +915,35 @@ g_signal_new (const gchar       *signal_name,
   return signal_id;
 }
 
+guint
+g_signal_newc (const gchar      *signal_name,
+               GType             itype,
+               GSignalFlags      signal_flags,
+               guint              class_offset,
+               GSignalAccumulator accumulator,
+               GSignalCMarshaller c_marshaller,
+               GType             return_type,
+               guint             n_params,
+               ...)
+{
+  va_list args;
+  guint signal_id;
+
+  g_return_val_if_fail (signal_name != NULL, 0);
+  
+  va_start (args, n_params);
+
+  signal_id = g_signal_new_valist (signal_name, itype, signal_flags,
+                                   g_signal_type_cclosure_new (itype,
+                                                               class_offset),
+                                   accumulator, c_marshaller,
+                                   return_type, n_params, args);
+
+  va_end (args);
+  return signal_id;
+}
+
 guint
 g_signal_newv (const gchar       *signal_name,
                GType              itype,
index 971a0e5c7a9e586787d81ae996ff1908b85577df..748e0729926cceb7f8c68a8c5299b698f184d04f 100644 (file)
@@ -87,7 +87,7 @@ struct _GSignalQuery
 
 
 /* --- signals --- */
-guint  g_signal_new                          (const gchar       *signal_name,
+guint  g_signal_newv                         (const gchar       *signal_name,
                                               GType              itype,
                                               GSignalFlags       signal_flags,
                                               GClosure          *class_closure,
@@ -95,8 +95,8 @@ guint g_signal_new                          (const gchar       *signal_name,
                                               GSignalCMarshaller c_marshaller,
                                               GType              return_type,
                                               guint              n_params,
-                                              ...);
-guint  g_signal_newv                         (const gchar       *signal_name,
+                                              GType             *param_types);
+guint  g_signal_new_valist                   (const gchar       *signal_name,
                                               GType              itype,
                                               GSignalFlags       signal_flags,
                                               GClosure          *class_closure,
@@ -104,7 +104,16 @@ guint      g_signal_newv                         (const gchar       *signal_name,
                                               GSignalCMarshaller c_marshaller,
                                               GType              return_type,
                                               guint              n_params,
-                                              GType             *param_types);
+                                              va_list            args);
+guint  g_signal_newc                         (const gchar       *signal_name,
+                                              GType              itype,
+                                              GSignalFlags       signal_flags,
+                                               guint              class_offset,
+                                              GSignalAccumulator accumulator,
+                                              GSignalCMarshaller c_marshaller,
+                                              GType              return_type,
+                                              guint              n_params,
+                                              ...);
 void   g_signal_emitv                        (const GValue      *instance_and_params,
                                               guint              signal_id,
                                               GQuark             detail,