summaryrefslogtreecommitdiff
path: root/clutter/clutter-state.c
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2010-06-21 10:20:32 +0100
committerNeil Roberts <neil@linux.intel.com>2010-08-10 17:12:06 +0100
commit8d5161797974f8f9eb25da844f64fc27bceb28f4 (patch)
treecac62b6d80b7955ce80559c1f63ae159f1d5bc4b /clutter/clutter-state.c
parentbfa10f629f6400ff31471922ad57c27c71e76697 (diff)
downloadclutter-8d5161797974f8f9eb25da844f64fc27bceb28f4.tar.gz
Conditionally use g_object_notify_by_pspec
This adds a wrapper macro to clutter-private that will use g_object_notify_by_pspec if it's compiled against a version of GLib that is sufficiently new. Otherwise it will notify by the property name as before by extracting the name from the pspec. The objects can then store a static array of GParamSpecs and notify using those as suggested in the documentation for g_object_notify_by_pspec. Note that the name of the variable used for storing the array of GParamSpecs is obj_props instead of properties as used in the documentation because some places in Clutter uses 'properties' as the name of a local variable. Mose of the classes in Clutter have been converted using the script in the bug report. Some classes have not been modified even though the script picked them up as described here: json-generator: We probably don't want to modify the internal copy of JSON behaviour-depth: rectangle: score: stage-manager: These aren't using the separate GParamSpec* variable style. blur-effect: win32/device-manager: Don't actually define any properties even though it has the enum. box-layout: flow-layout: Have some per-child properties that don't work automatically with the script. clutter-model: The script gets confused with ClutterModelIter stage: Script gets confused because PROP_USER_RESIZE doesn't match "user-resizable" test-layout: Don't really want to modify the tests http://bugzilla.clutter-project.org/show_bug.cgi?id=2150
Diffstat (limited to 'clutter/clutter-state.c')
-rw-r--r--clutter/clutter-state.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/clutter/clutter-state.c b/clutter/clutter-state.c
index 5ebfa8005..def4ed967 100644
--- a/clutter/clutter-state.c
+++ b/clutter/clutter-state.c
@@ -118,9 +118,13 @@ enum
{
PROP_0,
PROP_DURATION,
- PROP_STATE
+ PROP_STATE,
+
+ PROP_LAST
};
+static GParamSpec *obj_props[PROP_LAST];
+
enum
{
COMPLETED,
@@ -477,7 +481,7 @@ clutter_state_change (ClutterState *state,
priv->source_state_name = priv->target_state_name;
priv->target_state_name = target_state_name;
- g_object_notify (G_OBJECT (state), "state");
+ _clutter_notify_by_pspec (G_OBJECT (state), obj_props[PROP_STATE]);
duration = clutter_state_get_duration (state,
priv->source_state_name,
@@ -1160,6 +1164,7 @@ clutter_state_class_init (ClutterStateClass *klass)
P_("Currently set state, (transition to this state might not be complete)"),
NULL,
CLUTTER_PARAM_READWRITE);
+ obj_props[PROP_STATE] = pspec;
g_object_class_install_property (gobject_class, PROP_STATE, pspec);
/**
@@ -1173,6 +1178,7 @@ clutter_state_class_init (ClutterStateClass *klass)
P_("Default transition duration"),
0, 86400000, 1000,
CLUTTER_PARAM_READWRITE);
+ obj_props[PROP_DURATION] = pspec;
g_object_class_install_property (gobject_class, PROP_DURATION, pspec);
}