[Xfce4-commits] [xfce/xfce4-power-manager] 02/03: Brightness plugin: Sanitize checks for button clicks

noreply at xfce.org noreply at xfce.org
Sun Jun 22 20:36:49 CEST 2014


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository xfce/xfce4-power-manager.

commit 7167ac88fd4783912362f503e64d6ba5712043be
Author: Harald Judt <h.judt at gmx.at>
Date:   Mon Jun 16 19:36:44 2014 +0200

    Brightness plugin: Sanitize checks for button clicks
    
    Not sure why one would check for specific numbers instead of ranges?
    
    Signed-off-by: Eric Koegel <eric.koegel at gmail.com>
---
 panel-plugins/brightness/brightness-button.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/panel-plugins/brightness/brightness-button.c b/panel-plugins/brightness/brightness-button.c
index 750fca4..7f88afa 100644
--- a/panel-plugins/brightness/brightness-button.c
+++ b/panel-plugins/brightness/brightness-button.c
@@ -322,7 +322,7 @@ minus_clicked (GtkWidget *widget, BrightnessButton *button)
     
     level = (gint ) gtk_range_get_value (GTK_RANGE (button->priv->range));
     
-    if ( level != 0 )
+    if ( level > 0 )
 	gtk_range_set_value (GTK_RANGE (button->priv->range), level - 1);
 }
 
@@ -334,7 +334,7 @@ plus_clicked (GtkWidget *widget, BrightnessButton *button)
     max_level = xfpm_brightness_get_max_level (button->priv->brightness);
     level = (gint ) gtk_range_get_value (GTK_RANGE (button->priv->range));
     
-    if ( level != max_level )
+    if ( level < max_level )
 	gtk_range_set_value (GTK_RANGE (button->priv->range), level + 1);
 }
 
@@ -443,7 +443,7 @@ brightness_button_up (BrightnessButton *button)
     xfpm_brightness_get_level (button->priv->brightness, &level);
     max_level = xfpm_brightness_get_max_level (button->priv->brightness);
     
-    if ( level != max_level )
+    if ( level < max_level )
     {
 	plus_clicked (NULL, button);
     }
@@ -455,7 +455,7 @@ brightness_button_down (BrightnessButton *button)
     gint32 level;
     xfpm_brightness_get_level (button->priv->brightness, &level);
     
-    if ( level != 0 )
+    if ( level > 0 )
     {
 	minus_clicked (NULL, button);
     }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list