[Xfce4-commits] [xfce/xfce4-power-manager] 01/01: Hide brightness tab when LCD brightness is unavailable

noreply at xfce.org noreply at xfce.org
Sat Jul 12 04:07:06 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 1b079c85d73c1e25c1b5a13f7ec561979326b823
Author: Harald Judt <h.judt at gmx.at>
Date:   Fri Jul 11 11:49:23 2014 +0200

    Hide brightness tab when LCD brightness is unavailable
---
 settings/xfpm-settings.c |   92 ++++++++++++++++++++--------------------------
 1 file changed, 39 insertions(+), 53 deletions(-)

diff --git a/settings/xfpm-settings.c b/settings/xfpm-settings.c
index 0d3a36d..4fb7202 100644
--- a/settings/xfpm-settings.c
+++ b/settings/xfpm-settings.c
@@ -905,32 +905,6 @@ xfpm_settings_on_battery (XfconfChannel *channel, gboolean auth_suspend,
     }
 
     /*
-     * Brightness on battery power
-     */
-    brg = GTK_WIDGET (gtk_builder_get_object (xml ,"brg-on-battery"));
-    brg_level = GTK_WIDGET (gtk_builder_get_object (xml ,"brg-level-on-battery"));
-    if ( has_lcd_brightness )
-    {
-	val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX BRIGHTNESS_ON_BATTERY, 120);
-	gtk_range_set_value (GTK_RANGE(brg), val);
-	
-	val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX BRIGHTNESS_LEVEL_ON_BATTERY, 20);
-	gtk_range_set_value (GTK_RANGE (brg_level), val);
-	
-    }
-    else
-    {
-	gtk_widget_set_sensitive (GTK_WIDGET (brg), FALSE);
-	gtk_widget_set_sensitive (GTK_WIDGET (brg_level), FALSE);
-    }
-#ifndef HAVE_DPMS
-    if ( !has_lcd_brightness )
-    {
-	gtk_notebook_remove_page (GTK_NOTEBOOK (nt), 1);
-    }
-#endif
-
-    /*
      * Hard drive energy saving
      */
     spin_down_hdd = GTK_WIDGET (gtk_builder_get_object (xml, "spin-down-hdd"));
@@ -980,6 +954,26 @@ xfpm_settings_on_battery (XfconfChannel *channel, gboolean auth_suspend,
     {
 	gtk_widget_set_tooltip_text (spin_down_hdd, _("Spinning down hard disks permission denied"));
     }
+
+    /*
+     * Brightness on battery
+     */
+    if ( has_lcd_brightness )
+    {
+    brg = GTK_WIDGET (gtk_builder_get_object (xml ,"brg-on-battery"));
+    brg_level = GTK_WIDGET (gtk_builder_get_object (xml ,"brg-level-on-battery"));
+    val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX BRIGHTNESS_ON_BATTERY, 120);
+    gtk_range_set_value (GTK_RANGE(brg), val);
+
+    val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX BRIGHTNESS_LEVEL_ON_BATTERY, 20);
+    gtk_range_set_value (GTK_RANGE (brg_level), val);
+
+    }
+    else
+    {
+    gtk_notebook_remove_page (GTK_NOTEBOOK (nt), 3);
+    }
+
 }
 
 static void
@@ -1081,33 +1075,6 @@ xfpm_settings_on_ac (XfconfChannel *channel, gboolean auth_suspend,
 	gtk_widget_hide (lid);
     }
     
-    /*
-     * 
-     * Brightness on AC power
-     */
-    brg = GTK_WIDGET (gtk_builder_get_object (xml ,"brg-on-ac"));
-    brg_level = GTK_WIDGET (gtk_builder_get_object (xml ,"brg-level-on-ac"));
-    if ( has_lcd_brightness )
-    {
-	val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX BRIGHTNESS_ON_AC, 9);
-	gtk_range_set_value (GTK_RANGE (brg), val);
-	
-	val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX BRIGHTNESS_LEVEL_ON_AC, 80);
-	gtk_range_set_value (GTK_RANGE (brg_level), val);
-	
-    }
-    else
-    {
-	gtk_widget_set_sensitive (GTK_WIDGET (brg), FALSE);
-	gtk_widget_set_sensitive (GTK_WIDGET (brg_level), FALSE);
-    }
-#ifndef HAVE_DPMS
-    if ( !has_lcd_brightness )
-    {
-	gtk_notebook_remove_page (GTK_NOTEBOOK (GTK_WIDGET (gtk_builder_get_object (xml, "on-ac-notebook"))), 1);
-    }
-#endif
-
     spin_down_hdd = GTK_WIDGET (gtk_builder_get_object (xml, "spin-down-hdd"));
     /*
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (spin_down), 
@@ -1125,6 +1092,25 @@ xfpm_settings_on_ac (XfconfChannel *channel, gboolean auth_suspend,
 	gtk_widget_set_tooltip_text (spin_down_hdd, _("Spinning down hard disks permission denied"));
     }
 
+	/*
+	 * Brightness on AC power
+	 */
+	if ( has_lcd_brightness )
+	{
+	brg = GTK_WIDGET (gtk_builder_get_object (xml ,"brg-on-ac"));
+	brg_level = GTK_WIDGET (gtk_builder_get_object (xml ,"brg-level-on-ac"));
+	val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX BRIGHTNESS_ON_AC, 9);
+	gtk_range_set_value (GTK_RANGE(brg), val);
+
+	val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX BRIGHTNESS_LEVEL_ON_AC, 80);
+	gtk_range_set_value (GTK_RANGE (brg_level), val);
+
+	}
+	else
+	{
+	gtk_notebook_remove_page (GTK_NOTEBOOK (nt), 3);
+	}
+
 }
 
 static void

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


More information about the Xfce4-commits mailing list