[gnome-control-center] color: Emit the expanded-changed signal whenever the state changes



commit 5fd213a7f9adc57123313983607110612043b5d6
Author: Richard Hughes <richard hughsie com>
Date:   Mon Feb 18 17:08:01 2013 +0000

    color: Emit the expanded-changed signal whenever the state changes

 panels/color/cc-color-device.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/panels/color/cc-color-device.c b/panels/color/cc-color-device.c
index 388ddda..3208e6c 100644
--- a/panels/color/cc-color-device.c
+++ b/panels/color/cc-color-device.c
@@ -168,7 +168,16 @@ cc_color_device_set_expanded (CcColorDevice *color_device,
                               gboolean expanded)
 {
   CcColorDevicePrivate *priv = color_device->priv;
-  priv->expanded = FALSE;
+
+  /* same as before */
+  if (priv->expanded == expanded)
+    return;
+
+  /* refresh */
+  priv->expanded = expanded;
+  g_signal_emit (color_device,
+                 signals[SIGNAL_EXPANDED_CHANGED], 0,
+                 priv->expanded);
   cc_color_device_refresh (color_device);
 }
 
@@ -195,12 +204,7 @@ cc_color_device_notify_enable_device_cb (GtkSwitch *sw,
     }
 
   /* if expanded, close */
-  if (priv->expanded)
-    {
-      cc_color_device_set_expanded (color_device, FALSE);
-      g_signal_emit (color_device, signals[SIGNAL_EXPANDED_CHANGED], 0,
-                     priv->expanded);
-    }
+  cc_color_device_set_expanded (color_device, FALSE);
 }
 
 static void


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