[Xfce4-commits] [xfce/xfce4-power-manager] 01/01: Replace the brightness spinbutton in the settings with a scale
noreply at xfce.org
noreply at xfce.org
Tue Jun 10 18:51:13 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 12cbd3bdcc8b5e21daf7c8a14c438f0d8b843117
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date: Tue Jun 10 18:50:54 2014 +0200
Replace the brightness spinbutton in the settings with a scale
---
data/interfaces/xfpm-settings.ui | 26 ++++++++++----------------
settings/xfpm-settings.c | 30 +++++++++++++++++++-----------
2 files changed, 29 insertions(+), 27 deletions(-)
diff --git a/data/interfaces/xfpm-settings.ui b/data/interfaces/xfpm-settings.ui
index 3ad43f3..d46b747 100644
--- a/data/interfaces/xfpm-settings.ui
+++ b/data/interfaces/xfpm-settings.ui
@@ -1005,46 +1005,40 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="brg-level-on-battery">
+ <object class="GtkHScale" id="brg-level-on-battery">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="invisible_char">•</property>
+ <property name="update_policy">discontinuous</property>
<property name="adjustment">adjustment11</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
- <property name="primary_icon_sensitive">True</property>
- <property name="secondary_icon_sensitive">True</property>
- <signal name="output" handler="critical_spin_output_cb" swapped="no"/>
+ <property name="digits">0</property>
+ <property name="value_pos">bottom</property>
<signal name="value_changed" handler="brightness_level_on_battery" swapped="no"/>
+ <signal name="format_value" handler="format_brightness_percentage_cb" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
- <property name="x_options"/>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="brg-level-on-ac">
+ <object class="GtkHScale" id="brg-level-on-ac">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="invisible_char">•</property>
+ <property name="update_policy">discontinuous</property>
<property name="adjustment">adjustment10</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
- <property name="primary_icon_sensitive">True</property>
- <property name="secondary_icon_sensitive">True</property>
- <signal name="output" handler="critical_spin_output_cb" swapped="no"/>
+ <property name="digits">0</property>
+ <property name="value_pos">bottom</property>
<signal name="value_changed" handler="brightness_level_on_ac" swapped="no"/>
+ <signal name="format_value" handler="format_brightness_percentage_cb" swapped="no"/>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
- <property name="x_options"/>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
diff --git a/settings/xfpm-settings.c b/settings/xfpm-settings.c
index 329eabb..f3e6622 100644
--- a/settings/xfpm-settings.c
+++ b/settings/xfpm-settings.c
@@ -85,10 +85,10 @@ enum
/*
* GtkBuilder callbacks
*/
-void brightness_level_on_ac (GtkSpinButton *w,
+void brightness_level_on_ac (GtkWidget *w,
XfconfChannel *channel);
-void brightness_level_on_battery (GtkSpinButton *w,
+void brightness_level_on_battery (GtkWidget *w,
XfconfChannel *channel);
void battery_critical_changed_cb (GtkWidget *w,
@@ -148,6 +148,10 @@ gchar *format_brightness_value_cb (GtkScale *scale,
gdouble value,
gpointer data);
+gchar *format_brightness_percentage_cb (GtkScale *scale,
+ gdouble value,
+ gpointer data);
+
void brightness_on_battery_value_changed_cb (GtkWidget *w,
XfconfChannel *channel);
@@ -177,9 +181,9 @@ void _cursor_changed_cb (GtkTreeView *view,
-void brightness_level_on_ac (GtkSpinButton *w, XfconfChannel *channel)
+void brightness_level_on_ac (GtkWidget *w, XfconfChannel *channel)
{
- guint val = (guint) gtk_spin_button_get_value (w);
+ guint val = (guint) gtk_range_get_value (GTK_RANGE (w));
if (!xfconf_channel_set_uint (channel, PROPERTIES_PREFIX BRIGHTNESS_LEVEL_ON_AC, val) )
{
@@ -187,9 +191,9 @@ void brightness_level_on_ac (GtkSpinButton *w, XfconfChannel *channel)
}
}
-void brightness_level_on_battery (GtkSpinButton *w, XfconfChannel *channel)
+void brightness_level_on_battery (GtkWidget *w, XfconfChannel *channel)
{
- guint val = (guint) gtk_spin_button_get_value (w);
+ guint val = (guint) gtk_range_get_value (GTK_RANGE (w));
if (!xfconf_channel_set_uint (channel, PROPERTIES_PREFIX BRIGHTNESS_LEVEL_ON_BATTERY, val) )
{
@@ -581,6 +585,12 @@ format_brightness_value_cb (GtkScale *scale, gdouble value, gpointer data)
return g_strdup_printf ("%d %s", (int)value, _("Seconds"));
}
+gchar *
+format_brightness_percentage_cb (GtkScale *scale, gdouble value, gpointer data)
+{
+ return g_strdup_printf ("%d %s", (int)value, _("%"));
+}
+
void
brightness_on_battery_value_changed_cb (GtkWidget *w, XfconfChannel *channel)
{
@@ -899,11 +909,10 @@ xfpm_settings_on_battery (XfconfChannel *channel, gboolean auth_hibernate,
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_spin_button_set_value (GTK_SPIN_BUTTON (brg_level), val);
+ gtk_range_set_value (GTK_RANGE (brg_level), val);
}
else
@@ -1075,11 +1084,10 @@ xfpm_settings_on_ac (XfconfChannel *channel, gboolean auth_suspend,
if ( has_lcd_brightness )
{
val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX BRIGHTNESS_ON_AC, 9);
-
- gtk_range_set_value (GTK_RANGE(brg), val);
+ gtk_range_set_value (GTK_RANGE (brg), val);
val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX BRIGHTNESS_LEVEL_ON_AC, 80);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (brg_level), val);
+ gtk_range_set_value (GTK_RANGE (brg_level), val);
}
else
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list