Moving properties_changed into a class function
- From: Alex Larsson <alexl redhat com>
- To: <gtk-devel-list gnome org>
- Cc: <timj gtk org>
- Subject: Moving properties_changed into a class function
- Date: Tue, 5 Jun 2001 14:57:42 -0400 (EDT)
The following patch moves the properties_changed signal into a class
function. This is done mostly for performance reasons.
Is this OK to check in?
There is one use of properties_changed in Gtk+ in the tree, but that was
only because jonathan didn't understand it. He will switch to
using notify::model instead on his next checkin.
/ Alex
Index: gobject.c
===================================================================
RCS file: /cvs/gnome/glib/gobject/gobject.c,v
retrieving revision 1.34
diff -u -p -r1.34 gobject.c
--- gobject.c 2001/05/24 12:52:39 1.34
+++ gobject.c 2001/06/05 18:53:04
@@ -40,7 +40,6 @@
/* --- signals --- */
enum {
- PROPERTIES_CHANGED,
NOTIFY,
LAST_SIGNAL
};
@@ -90,9 +89,6 @@ static gchar* g_value_object_lcopy_value
guint n_collect_values,
GTypeCValue *collect_values,
guint collect_flags);
-static void g_object_dispatch_properties_changed (GObject *object,
- guint n_pspecs,
- GParamSpec **pspecs);
static void g_object_properties_changed (GObject *object,
guint n_pspecs,
GParamSpec **pspecs);
@@ -262,19 +258,8 @@ g_object_do_class_init (GObjectClass *cl
class->get_property = g_object_do_get_property;
class->shutdown = g_object_shutdown;
class->finalize = g_object_finalize;
- class->dispatch_properties_changed = g_object_dispatch_properties_changed;
class->properties_changed = g_object_properties_changed;
- class->notify = g_object_notify_property_changed;
- gobject_signals[PROPERTIES_CHANGED] =
- 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, NULL,
- g_cclosure_marshal_VOID__UINT_POINTER,
- G_TYPE_NONE,
- 2, G_TYPE_UINT, G_TYPE_POINTER);
gobject_signals[NOTIFY] =
g_signal_newc ("notify",
G_TYPE_FROM_CLASS (class),
@@ -534,40 +519,22 @@ object_thaw_notifies (GObject *objec
pspecs[n_pspecs++] = pspec;
}
g_object_set_qdata (object, quark_notify_queue, NULL);
-
+
if (n_pspecs)
- G_OBJECT_GET_CLASS (object)->dispatch_properties_changed (object, n_pspecs, pspecs);
+ G_OBJECT_GET_CLASS (object)->properties_changed (object, n_pspecs, pspecs);
g_free (pspecs);
}
static void
-g_object_dispatch_properties_changed (GObject *object,
- guint n_pspecs,
- GParamSpec **pspecs)
-{
- g_signal_emit (object, gobject_signals[PROPERTIES_CHANGED], 0, n_pspecs, pspecs);
-}
-
-static void
g_object_properties_changed (GObject *object,
guint n_pspecs,
GParamSpec **pspecs)
{
guint i;
-
+
for (i = 0; i < n_pspecs; i++)
g_signal_emit (object, gobject_signals[NOTIFY], g_quark_from_string (pspecs[i]->name), pspecs[i]);
-}
-
-static void
-g_object_notify_property_changed (GObject *object,
- GParamSpec *pspec)
-{
- if (0) /* FIXME */
- g_message ("NOTIFICATION: property `%s' changed on object `%s'",
- pspec->name,
- G_OBJECT_TYPE_NAME (object));
}
void
Index: gobject.h
===================================================================
RCS file: /cvs/gnome/glib/gobject/gobject.h,v
retrieving revision 1.13
diff -u -p -r1.13 gobject.h
--- gobject.h 2001/05/24 12:52:39 1.13
+++ gobject.h 2001/06/05 18:53:04
@@ -84,16 +84,11 @@ struct _GObjectClass
GParamSpec *pspec);
void (*shutdown) (GObject *object);
void (*finalize) (GObject *object);
-
- /*< private >*/
- void (*dispatch_properties_changed) (GObject *object,
- guint n_pspecs,
- GParamSpec **pspecs);
-
- /* signals */
void (*properties_changed) (GObject *object,
guint n_pspecs,
GParamSpec **pspecs);
+
+ /* signals */
void (*notify) (GObject *object,
GParamSpec *pspec);
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]