mirror of
https://github.com/brl/mutter.git
synced 2024-11-30 03:50:47 -05:00
behaviour: Clean up BehaviourOpacity
• Use a consistent coding style • Call set_bounds() from set_property(), because we need proper notification on the modified property
This commit is contained in:
parent
521d71d4bc
commit
f94e691151
@ -113,16 +113,22 @@ clutter_behaviour_opacity_set_property (GObject *gobject,
|
|||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
ClutterBehaviourOpacity *opacityb = CLUTTER_BEHAVIOUR_OPACITY (gobject);
|
ClutterBehaviourOpacity *self = CLUTTER_BEHAVIOUR_OPACITY (gobject);
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_OPACITY_START:
|
case PROP_OPACITY_START:
|
||||||
opacityb->priv->opacity_start = g_value_get_uint (value);
|
clutter_behaviour_opacity_set_bounds (self,
|
||||||
|
g_value_get_uint (value),
|
||||||
|
self->priv->opacity_end);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_OPACITY_END:
|
case PROP_OPACITY_END:
|
||||||
opacityb->priv->opacity_end = g_value_get_uint (value);
|
clutter_behaviour_opacity_set_bounds (self,
|
||||||
|
self->priv->opacity_start,
|
||||||
|
g_value_get_uint (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -135,16 +141,18 @@ clutter_behaviour_opacity_get_property (GObject *gobject,
|
|||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
ClutterBehaviourOpacity *opacityb = CLUTTER_BEHAVIOUR_OPACITY (gobject);
|
ClutterBehaviourOpacity *self = CLUTTER_BEHAVIOUR_OPACITY (gobject);
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_OPACITY_START:
|
case PROP_OPACITY_START:
|
||||||
g_value_set_uint (value, opacityb->priv->opacity_start);
|
g_value_set_uint (value, self->priv->opacity_start);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_OPACITY_END:
|
case PROP_OPACITY_END:
|
||||||
g_value_set_uint (value, opacityb->priv->opacity_end);
|
g_value_set_uint (value, self->priv->opacity_end);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -156,6 +164,9 @@ clutter_behaviour_opacity_class_init (ClutterBehaviourOpacityClass *klass)
|
|||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass);
|
ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass);
|
||||||
|
GParamSpec *pspec;
|
||||||
|
|
||||||
|
g_type_class_add_private (klass, sizeof (ClutterBehaviourOpacityPrivate));
|
||||||
|
|
||||||
gobject_class->set_property = clutter_behaviour_opacity_set_property;
|
gobject_class->set_property = clutter_behaviour_opacity_set_property;
|
||||||
gobject_class->get_property = clutter_behaviour_opacity_get_property;
|
gobject_class->get_property = clutter_behaviour_opacity_get_property;
|
||||||
@ -167,14 +178,14 @@ clutter_behaviour_opacity_class_init (ClutterBehaviourOpacityClass *klass)
|
|||||||
*
|
*
|
||||||
* Since: 0.2
|
* Since: 0.2
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (gobject_class,
|
pspec = g_param_spec_uint ("opacity-start",
|
||||||
PROP_OPACITY_START,
|
"Opacity Start",
|
||||||
g_param_spec_uint ("opacity-start",
|
"Initial opacity level",
|
||||||
"Opacity Start",
|
0, 255,
|
||||||
"Initial opacity level",
|
0,
|
||||||
0, 255,
|
CLUTTER_PARAM_READWRITE);
|
||||||
0,
|
g_object_class_install_property (gobject_class, PROP_OPACITY_START, pspec);
|
||||||
CLUTTER_PARAM_READWRITE));
|
|
||||||
/**
|
/**
|
||||||
* ClutterBehaviourOpacity:opacity-end:
|
* ClutterBehaviourOpacity:opacity-end:
|
||||||
*
|
*
|
||||||
@ -182,18 +193,15 @@ clutter_behaviour_opacity_class_init (ClutterBehaviourOpacityClass *klass)
|
|||||||
*
|
*
|
||||||
* Since: 0.2
|
* Since: 0.2
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (gobject_class,
|
pspec = g_param_spec_uint ("opacity-end",
|
||||||
PROP_OPACITY_END,
|
"Opacity End",
|
||||||
g_param_spec_uint ("opacity-end",
|
"Final opacity level",
|
||||||
"Opacity End",
|
0, 255,
|
||||||
"Final opacity level",
|
0,
|
||||||
0, 255,
|
CLUTTER_PARAM_READWRITE);
|
||||||
0,
|
g_object_class_install_property (gobject_class, PROP_OPACITY_END, pspec);
|
||||||
CLUTTER_PARAM_READWRITE));
|
|
||||||
|
|
||||||
behave_class->alpha_notify = clutter_behaviour_alpha_notify;
|
behave_class->alpha_notify = clutter_behaviour_alpha_notify;
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (ClutterBehaviourOpacityPrivate));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user