[Goodies-commits] r5749 - xfce4-power-manager/trunk/src

Ali Abdallah aliov at xfce.org
Wed Oct 22 22:01:59 CEST 2008


Author: aliov
Date: 2008-10-22 20:01:59 +0000 (Wed, 22 Oct 2008)
New Revision: 5749

Modified:
   xfce4-power-manager/trunk/src/xfpm-cpu.c
Log:
When opening the settings dialog check if there any new governor loaded meanwhile

Modified: xfce4-power-manager/trunk/src/xfpm-cpu.c
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-cpu.c	2008-10-22 19:52:26 UTC (rev 5748)
+++ xfce4-power-manager/trunk/src/xfpm-cpu.c	2008-10-22 20:01:59 UTC (rev 5749)
@@ -67,6 +67,7 @@
 
 static void xfpm_cpu_load_config(XfpmCpu *cpu);
 static void xfpm_cpu_check(XfpmCpu *cpu);
+static guint8 xfpm_cpu_get_all_governors(XfpmCpu *cpu);
 static void xfpm_cpu_get_governors(XfpmCpu *cpu);
 static void xfpm_cpu_set_governor(XfpmCpu *cpu,
                                   gboolean ac_adapter_present);
@@ -292,26 +293,24 @@
 	XFPM_DEBUG("Cpu freq control cannot be used\n");	
 }
 
-static void xfpm_cpu_get_governors(XfpmCpu *cpu)
+
+static guint8
+xfpm_cpu_get_all_governors(XfpmCpu *cpu)
 {
 	XfpmCpuPrivate *priv;
 	priv = XFPM_CPU_GET_PRIVATE(cpu);
-	
-	if ( priv->governors & CPU_FREQ_CANNOT_BE_USED )
-	{
-		return;
-	}
-	
+		
 	GError *g_error = NULL;
 	gchar **govs = NULL;
-        
+    guint8 governors = 0;
+	    
 	govs = xfpm_hal_get_available_cpu_governors(priv->hal,&g_error);
 	
 	if ( g_error )
 	{
 		XFPM_DEBUG("%s :\n",g_error->message);
 		g_error_free(g_error);
-		return;
+		return 0;
 	}
 
 	int i = 0;    
@@ -319,15 +318,30 @@
 	{
 		for ( i = 0 ; govs[i] ; i++ )
 		{
-			if ( !strcmp(govs[i],"powersave") )    priv->governors |= POWERSAVE;
-			if ( !strcmp(govs[i],"ondemand") )     priv->governors |= ONDEMAND;
-			if ( !strcmp(govs[i],"performance") )  priv->governors |= PERFORMANCE;
-			if ( !strcmp(govs[i],"conservative") ) priv->governors |= CONSERVATIVE;
-			if ( !strcmp(govs[i],"userspace") )    priv->governors |= USERSPACE;
+			if ( !strcmp(govs[i],"powersave") )    governors |= POWERSAVE;
+			if ( !strcmp(govs[i],"ondemand") )     governors |= ONDEMAND;
+			if ( !strcmp(govs[i],"performance") )  governors |= PERFORMANCE;
+			if ( !strcmp(govs[i],"conservative") ) governors |= CONSERVATIVE;
+			if ( !strcmp(govs[i],"userspace") )    governors |= USERSPACE;
 		}   
 		libhal_free_string_array(govs);
+	}	
+	
+	return governors;
+	
+}
+
+static void xfpm_cpu_get_governors(XfpmCpu *cpu)
+{
+	XfpmCpuPrivate *priv;
+	priv = XFPM_CPU_GET_PRIVATE(cpu);
+	
+	if ( priv->governors & CPU_FREQ_CANNOT_BE_USED )
+	{
+		return;
 	}
 	
+	priv->governors = xfpm_cpu_get_all_governors(cpu);
 }
 
 static void
@@ -420,6 +434,12 @@
 	
 	XfpmCpuPrivate *priv;
 	priv = XFPM_CPU_GET_PRIVATE(cpu);
+
+	if ( priv->governors & CPU_FREQ_CANNOT_BE_USED )
+	{
+		return 0;
+	}
 	
-	return priv->governors;
+	
+	return xfpm_cpu_get_all_governors(cpu);
 }




More information about the Goodies-commits mailing list