[Xfce4-commits] [xfce/xfce4-power-manager] 01/01: Keep blank and DPMS timeout settings in order
noreply at xfce.org
noreply at xfce.org
Wed Aug 27 10:14:06 CEST 2014
This is an automated email from the git hooks/post-receive script.
ochosi pushed a commit to branch master
in repository xfce/xfce4-power-manager.
commit 4c6e588aa4e7768ae5ee4f7b3b19a93a8a64e47b
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date: Wed Aug 27 10:14:02 2014 +0200
Keep blank and DPMS timeout settings in order
The blank timeout cannot be longer than the DPMS timeouts,
the DPMS timeouts cannot be shorter than the blank timeout
simply because blanking after the display is already suspended
doesn't make any sense (and vice versa).
---
data/interfaces/xfpm-settings.ui | 2 +
settings/xfpm-settings.c | 83 +++++++++++++++++++++++++++++++++-----
2 files changed, 74 insertions(+), 11 deletions(-)
diff --git a/data/interfaces/xfpm-settings.ui b/data/interfaces/xfpm-settings.ui
index 3fdcca1..e6038a5 100644
--- a/data/interfaces/xfpm-settings.ui
+++ b/data/interfaces/xfpm-settings.ui
@@ -1121,6 +1121,7 @@
<property name="digits">0</property>
<property name="value_pos">bottom</property>
<signal name="format-value" handler="format_dpms_value_cb" swapped="no"/>
+ <signal name="value-changed" handler="display_blank_on_battery_value_changed_cb" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
@@ -1163,6 +1164,7 @@
<property name="digits">0</property>
<property name="value_pos">bottom</property>
<signal name="format-value" handler="format_dpms_value_cb" swapped="no"/>
+ <signal name="value-changed" handler="display_blank_on_ac_value_changed_cb" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
diff --git a/settings/xfpm-settings.c b/settings/xfpm-settings.c
index 2a8f8b4..6c92c18 100644
--- a/settings/xfpm-settings.c
+++ b/settings/xfpm-settings.c
@@ -54,8 +54,10 @@
static GtkBuilder *xml = NULL;
static GtkWidget *nt = NULL;
+static GtkWidget *on_battery_display_blank = NULL;
static GtkWidget *on_battery_dpms_sleep = NULL;
static GtkWidget *on_battery_dpms_off = NULL;
+static GtkWidget *on_ac_display_blank = NULL;
static GtkWidget *on_ac_dpms_sleep = NULL;
static GtkWidget *on_ac_dpms_off = NULL;
static GtkWidget *sideview = NULL; /* Sidebar tree view - all devices are in the sideview */
@@ -400,11 +402,37 @@ dpms_toggled_cb (GtkWidget *w, XfconfChannel *channel)
}
void
+display_blank_on_battery_value_changed_cb (GtkWidget *w, XfconfChannel *channel)
+{
+ gint blank_value = (gint) gtk_range_get_value (GTK_RANGE (on_battery_display_blank));
+ gint sleep_value = (gint) gtk_range_get_value (GTK_RANGE (on_battery_dpms_sleep));
+ gint off_value, brightness_value;
+
+ if ( sleep_value != 0 )
+ {
+ if ( blank_value >= sleep_value )
+ {
+ gtk_range_set_value (GTK_RANGE(on_battery_dpms_sleep), blank_value + 1 );
+ }
+ }
+
+ off_value = (gint) gtk_range_get_value (GTK_RANGE (on_battery_dpms_off));
+ if ( off_value != 0 )
+ {
+ if ( blank_value >= off_value )
+ {
+ gtk_range_set_value (GTK_RANGE(on_battery_dpms_off), off_value + 1 );
+ }
+ }
+}
+
+void
sleep_on_battery_value_changed_cb (GtkWidget *w, XfconfChannel *channel)
{
GtkWidget *brg;
- gint off_value = (gint)gtk_range_get_value (GTK_RANGE (on_battery_dpms_off));
- gint sleep_value = (gint)gtk_range_get_value (GTK_RANGE (w));
+ gint off_value = (gint) gtk_range_get_value (GTK_RANGE (on_battery_dpms_off));
+ gint sleep_value = (gint) gtk_range_get_value (GTK_RANGE (w));
+ gint blank_value = (gint) gtk_range_get_value (GTK_RANGE (on_battery_display_blank));
gint brightness_value;
if ( off_value != 0 )
@@ -414,7 +442,15 @@ sleep_on_battery_value_changed_cb (GtkWidget *w, XfconfChannel *channel)
gtk_range_set_value (GTK_RANGE(on_battery_dpms_off), sleep_value + 1 );
}
}
-
+
+ if ( blank_value != 0 )
+ {
+ if ( blank_value >= sleep_value )
+ {
+ gtk_range_set_value (GTK_RANGE(on_battery_display_blank), sleep_value - 1 );
+ }
+ }
+
if ( lcd_brightness )
{
brg = GTK_WIDGET (gtk_builder_get_object (xml, "brightness-inactivity-on-battery"));
@@ -453,13 +489,31 @@ off_on_battery_value_changed_cb (GtkWidget *w, XfconfChannel *channel)
}
void
+display_blank_on_ac_value_changed_cb (GtkWidget *w, XfconfChannel *channel)
+{
+ gint blank_value = (gint) gtk_range_get_value (GTK_RANGE (on_ac_display_blank));
+ gint sleep_value = (gint) gtk_range_get_value (GTK_RANGE (on_ac_dpms_sleep));
+ gint off_value, brightness_value;
+
+ if ( sleep_value != 0 )
+ {
+ if ( blank_value >= sleep_value )
+ {
+ gtk_range_set_value (GTK_RANGE(on_ac_dpms_sleep), blank_value + 1 );
+ }
+ }
+
+}
+
+void
sleep_on_ac_value_changed_cb (GtkWidget *w, XfconfChannel *channel)
{
GtkWidget *brg;
gint brightness_value;
- gint off_value = (gint)gtk_range_get_value (GTK_RANGE(on_ac_dpms_off));
- gint sleep_value = (gint)gtk_range_get_value (GTK_RANGE(w));
+ gint off_value = (gint)gtk_range_get_value (GTK_RANGE (on_ac_dpms_off));
+ gint sleep_value = (gint)gtk_range_get_value (GTK_RANGE (w));
+ gint blank_value = (gint)gtk_range_get_value (GTK_RANGE (on_ac_display_blank));
if ( off_value > 60 || sleep_value > 60 )
return;
@@ -472,6 +526,14 @@ sleep_on_ac_value_changed_cb (GtkWidget *w, XfconfChannel *channel)
}
}
+ if ( blank_value != 0 )
+ {
+ if ( blank_value >= sleep_value )
+ {
+ gtk_range_set_value (GTK_RANGE(on_ac_display_blank), sleep_value - 1 );
+ }
+ }
+
if ( lcd_brightness )
{
brg = GTK_WIDGET (gtk_builder_get_object (xml, "brightness-inactivity-on-ac"));
@@ -1944,7 +2006,6 @@ xfpm_settings_dialog_new (XfconfChannel *channel, gboolean auth_suspend,
GtkWidget *viewport;
GtkWidget *hbox;
GtkWidget *frame;
- GtkWidget *on_battery_blank, *on_ac_blank;
GtkListStore *list_store;
GtkTreeViewColumn *col;
GtkCellRenderer *renderer;
@@ -1977,16 +2038,16 @@ xfpm_settings_dialog_new (XfconfChannel *channel, gboolean auth_suspend,
on_ac_dpms_sleep = GTK_WIDGET (gtk_builder_get_object (xml, "dpms-sleep-on-ac"));
on_ac_dpms_off = GTK_WIDGET (gtk_builder_get_object (xml, "dpms-off-on-ac"));
- on_battery_blank = GTK_WIDGET (gtk_builder_get_object (xml, "display-blank-on-battery"));
+ on_battery_display_blank = GTK_WIDGET (gtk_builder_get_object (xml, "display-blank-on-battery"));
val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX ON_BATTERY_BLANK, 1);
- gtk_range_set_value (GTK_RANGE (on_battery_blank), val);
+ gtk_range_set_value (GTK_RANGE (on_battery_display_blank), val);
xfconf_g_property_bind (channel, PROPERTIES_PREFIX ON_BATTERY_BLANK,
- G_TYPE_INT, gtk_range_get_adjustment (GTK_RANGE (on_battery_blank)),
+ G_TYPE_INT, gtk_range_get_adjustment (GTK_RANGE (on_battery_display_blank)),
"value");
- on_ac_blank = GTK_WIDGET (gtk_builder_get_object (xml, "display-blank-on-ac"));
+ on_ac_display_blank = GTK_WIDGET (gtk_builder_get_object (xml, "display-blank-on-ac"));
xfconf_g_property_bind (channel, PROPERTIES_PREFIX ON_AC_BLANK,
- G_TYPE_INT, gtk_range_get_adjustment (GTK_RANGE (on_ac_blank)),
+ G_TYPE_INT, gtk_range_get_adjustment (GTK_RANGE (on_ac_display_blank)),
"value");
dialog = GTK_WIDGET (gtk_builder_get_object (xml, "xfpm-settings-dialog"));
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list