[Goodies-commits] r7621 - in xfce4-power-manager/trunk: . settings src

Ali Abdallah aliov at xfce.org
Sat Jun 20 19:14:35 CEST 2009


Author: aliov
Date: 2009-06-20 17:14:35 +0000 (Sat, 20 Jun 2009)
New Revision: 7621

Modified:
   xfce4-power-manager/trunk/ChangeLog
   xfce4-power-manager/trunk/settings/xfpm-settings.c
   xfce4-power-manager/trunk/src/xfpm-dpms.c
Log:
	* Fix a DPMS storage values.

Modified: xfce4-power-manager/trunk/ChangeLog
===================================================================
--- xfce4-power-manager/trunk/ChangeLog	2009-06-20 16:40:44 UTC (rev 7620)
+++ xfce4-power-manager/trunk/ChangeLog	2009-06-20 17:14:35 UTC (rev 7621)
@@ -1,4 +1,7 @@
-2009-06-20: 16:30  Ali aliov at xfce.org
+2009-06-20: 19:10 Ali aliov at xfce.org
+	* Fix a DPMS storage values.
+
+2009-06-20: 18:30  Ali aliov at xfce.org
 	* settings/xfpm-settings.c
 	Get a pointer to the notebook before connecting signals.
 	* src/xfpm-xfconf.c Store Configurations in GValues instead of 

Modified: xfce4-power-manager/trunk/settings/xfpm-settings.c
===================================================================
--- xfce4-power-manager/trunk/settings/xfpm-settings.c	2009-06-20 16:40:44 UTC (rev 7620)
+++ xfce4-power-manager/trunk/settings/xfpm-settings.c	2009-06-20 17:14:35 UTC (rev 7621)
@@ -317,29 +317,48 @@
 void
 set_hibernate_inactivity (GtkWidget *w, XfconfChannel *channel)
 {
-    if (!xfconf_channel_set_string (channel, "/" INACTIVITY_SLEEP_MODE, "Hibernate") )
+    gboolean active;
+    
+    active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w));
+    
+    if ( active )
     {
-	g_critical ("Cannot set value hibernate for property %s", INACTIVITY_SLEEP_MODE);
+	if (!xfconf_channel_set_string (channel, "/" INACTIVITY_SLEEP_MODE, "Hibernate") )
+	{
+	    g_critical ("Cannot set value hibernate for property %s", INACTIVITY_SLEEP_MODE);
+	}
     }
 }
 
 void
 set_suspend_inactivity (GtkWidget *w, XfconfChannel *channel)
 {
-    if (!xfconf_channel_set_string (channel, "/" INACTIVITY_SLEEP_MODE, "Suspend") )
+    gboolean active;
+    
+    active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w));
+    if ( active )
     {
-	g_critical ("Cannot set value suspend for property %s", INACTIVITY_SLEEP_MODE);
+	if (!xfconf_channel_set_string (channel, "/" INACTIVITY_SLEEP_MODE, "Suspend") )
+	{
+	    g_critical ("Cannot set value suspend for property %s", INACTIVITY_SLEEP_MODE);
+	}
     }
 }
 
-
 void
 set_dpms_standby_mode (GtkWidget *w, XfconfChannel *channel)
 {
 #ifdef HAVE_DPMS
-    if (!xfconf_channel_set_string (channel, "/" DPMS_SLEEP_MODE, "standby") )
+    gboolean active;
+    
+    active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w));
+    
+    if ( active )
     {
-	g_critical ("Cannot set value sleep for property %s\n", DPMS_SLEEP_MODE);
+	if (!xfconf_channel_set_string (channel, "/" DPMS_SLEEP_MODE, "standby") )
+	{
+	    g_critical ("Cannot set value sleep for property %s\n", DPMS_SLEEP_MODE);
+	}
     }
 #endif
 }
@@ -348,9 +367,15 @@
 set_dpms_suspend_mode (GtkWidget *w, XfconfChannel *channel)
 {
 #ifdef HAVE_DPMS
-    if (!xfconf_channel_set_string (channel, "/" DPMS_SLEEP_MODE, "suspend") )
+    gboolean active;
+    
+    active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w));
+    if ( active )
     {
-	g_critical ("Cannot set value sleep for property %s\n", DPMS_SLEEP_MODE);
+	if (!xfconf_channel_set_string (channel, "/" DPMS_SLEEP_MODE, "suspend") )
+	{
+	    g_critical ("Cannot set value sleep for property %s\n", DPMS_SLEEP_MODE);
+	}
     }
 #endif
 }
@@ -1169,9 +1194,9 @@
     suspend_dpms_mode = GTK_WIDGET (gtk_builder_get_object (xml, "suspend-dpms-mode"));
     
 #ifdef HAVE_DPMS
-    str = xfconf_channel_get_string (channel, "/" DPMS_SLEEP_MODE, "sleep");
+    str = xfconf_channel_get_string (channel, "/" DPMS_SLEEP_MODE, "standby");
     
-    if ( xfpm_strequal (str, "sleep" ) )
+    if ( xfpm_strequal (str, "standby" ) )
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sleep_dpms_mode), TRUE);
     else if ( xfpm_strequal (str, "suspend") )
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (suspend_dpms_mode), TRUE);

Modified: xfce4-power-manager/trunk/src/xfpm-dpms.c
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-dpms.c	2009-06-20 16:40:44 UTC (rev 7620)
+++ xfce4-power-manager/trunk/src/xfpm-dpms.c	2009-06-20 17:14:35 UTC (rev 7621)
@@ -128,7 +128,7 @@
     g_object_get (G_OBJECT (dpms->priv->conf),
 		  DPMS_SLEEP_MODE, &sleep_mode,
 		  NULL);
-
+    
     if ( !g_strcmp0 (sleep_mode, "standby"))
 	*ret_standby_mode = TRUE;
     else
@@ -140,10 +140,10 @@
 static void
 xfpm_dpms_get_configuration_timeouts (XfpmDpms *dpms, guint16 *ret_sleep, guint16 *ret_off )
 {
-    guint16 sleep, off;
+    guint sleep, off;
     
     g_object_get (G_OBJECT (dpms->priv->conf),
-		  dpms->priv->on_battery ? ON_BATT_DPMS_SLEEP : ON_AC_DPMS_OFF, &sleep,
+		  dpms->priv->on_battery ? ON_BATT_DPMS_SLEEP : ON_AC_DPMS_SLEEP, &sleep,
 		  dpms->priv->on_battery ? ON_BATT_DPMS_OFF : ON_AC_DPMS_OFF, &off,
 		  NULL);
 		  
@@ -172,11 +172,11 @@
 	xfpm_dpms_disable (dpms);
 	return;
     }
-        
+
     xfpm_dpms_enable (dpms);
     xfpm_dpms_get_configuration_timeouts (dpms, &sleep_timeout, &off_timeout);
     xfpm_dpms_get_sleep_mode (dpms, &sleep_mode);
-    
+
     if (sleep_mode == TRUE )
     {
 	xfpm_dpms_set_timeouts	   (dpms, 
@@ -197,7 +197,10 @@
 xfpm_dpms_settings_changed_cb (GObject *obj, GParamSpec *spec, XfpmDpms *dpms)
 {
     if ( g_str_has_prefix (spec->name, "dpms"))
+    {
+	TRACE ("Configuration changed");
 	xfpm_dpms_refresh (dpms);
+    }
 }
 
 static void




More information about the Goodies-commits mailing list