[gnome-control-center] power: Avoid warning with no screen backlight



commit eb4ee209206a4fa354c2eb4b38baca7b13979a8e
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Aug 20 04:33:55 2013 +0200

    power: Avoid warning with no screen backlight
    
    Similar patch to f7c5225288b03c7a6f8139a1c02b840c7eddda8d
    but for the screen backlight.

 panels/power/cc-power-panel.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c
index f82044a..fcb0fb7 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -926,9 +926,16 @@ sync_screen_brightness (CcPowerPanel *self)
 
   result = g_dbus_proxy_get_cached_property (self->priv->screen_proxy, "Brightness");
 
-  /* set the slider */
-  g_variant_get (result, "i", &brightness);
-  visible = brightness >= 0.0;
+  if (result)
+    {
+      /* set the slider */
+      brightness = g_variant_get_int32 (result);
+      visible = brightness >= 0.0;
+    }
+  else
+    {
+      visible = FALSE;
+    }
 
   gtk_widget_set_visible (self->priv->brightness_row, visible);
   gtk_widget_set_visible (self->priv->dim_screen_row, visible);


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