[gnome-builder] egg-state-machine: Set property/style when added if the state is current



commit c8c4b043dd7e438a2eaf89f9e1a5433124ce90fa
Author: Garrett Regier <garrettregier gmail com>
Date:   Wed May 20 20:55:38 2015 -0700

    egg-state-machine: Set property/style when added if the state is current

 contrib/egg/egg-state-machine.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/contrib/egg/egg-state-machine.c b/contrib/egg/egg-state-machine.c
index 6892d90..f07f1a2 100644
--- a/contrib/egg/egg-state-machine.c
+++ b/contrib/egg/egg-state-machine.c
@@ -561,6 +561,7 @@ egg_state_machine_add_propertyv (EggStateMachine *self,
                                  const gchar     *property,
                                  const GValue    *value)
 {
+  EggStateMachinePrivate *priv = egg_state_machine_get_instance_private (self);
   EggState *state_obj;
   EggStateProperty *state_prop;
 
@@ -584,6 +585,9 @@ egg_state_machine_add_propertyv (EggStateMachine *self,
                      state_prop);
 
   g_ptr_array_add (state_obj->properties, state_prop);
+
+  if (g_strcmp0 (state, priv->state) == 0)
+    g_object_set_property (object, property, value);
 }
 
 void
@@ -628,6 +632,7 @@ egg_state_machine_add_style (EggStateMachine *self,
                              GtkWidget       *widget,
                              const gchar     *style)
 {
+  EggStateMachinePrivate *priv = egg_state_machine_get_instance_private (self);
   EggState *state_obj;
   EggStateStyle *style_obj;
 
@@ -648,6 +653,14 @@ egg_state_machine_add_style (EggStateMachine *self,
                      style_obj);
 
   g_ptr_array_add (state_obj->styles, style_obj);
+
+  if (g_strcmp0 (state, priv->state) == 0)
+    {
+      GtkStyleContext *style_context;
+
+      style_context = gtk_widget_get_style_context (widget);
+      gtk_style_context_add_class (style_context, style);
+    }
 }
 
 void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]