diff options
author | Ali Abdallah <ali.slackware@gmail.com> | 2009-06-20 17:14:35 +0000 |
---|---|---|
committer | Ali Abdallah <ali.slackware@gmail.com> | 2009-06-20 17:14:35 +0000 |
commit | 653f888132104e8074658f7376b7c11eee1203ff (patch) | |
tree | 22255e357561aa65527028ee0f1e22e29e8f311f | |
parent | 628eb04efc22fe7330c203a18c92fabb1dc8c7aa (diff) | |
download | ixfce4-power-manager-653f888132104e8074658f7376b7c11eee1203ff.tar.gz |
* Fix a DPMS storage values.
(Old svn revision: 7621)
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | settings/xfpm-settings.c | 47 | ||||
-rw-r--r-- | src/xfpm-dpms.c | 13 |
3 files changed, 48 insertions, 17 deletions
@@ -1,4 +1,7 @@ -2009-06-20: 16:30 Ali aliov@xfce.org +2009-06-20: 19:10 Ali aliov@xfce.org + * Fix a DPMS storage values. + +2009-06-20: 18:30 Ali aliov@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 diff --git a/settings/xfpm-settings.c b/settings/xfpm-settings.c index 16cf6d05..0ca1b359 100644 --- a/settings/xfpm-settings.c +++ b/settings/xfpm-settings.c @@ -317,29 +317,48 @@ notify_toggled_cb (GtkWidget *w, XfconfChannel *channel) 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 @@ void 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 @@ xfpm_settings_advanced (XfconfChannel *channel, gboolean system_laptop, gboolean 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); diff --git a/src/xfpm-dpms.c b/src/xfpm-dpms.c index 386cd8c1..b627ae51 100644 --- a/src/xfpm-dpms.c +++ b/src/xfpm-dpms.c @@ -128,7 +128,7 @@ xfpm_dpms_get_sleep_mode (XfpmDpms *dpms, gboolean *ret_standby_mode) 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 @@ xfpm_dpms_get_sleep_mode (XfpmDpms *dpms, gboolean *ret_standby_mode) 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_refresh (XfpmDpms *dpms) 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 @@ static void 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 |