summaryrefslogtreecommitdiff
path: root/src/gpm-kbd-backlight.c
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2014-04-22 18:00:55 +0200
committerStefano Karapetsas <[email protected]>2014-04-22 18:00:55 +0200
commitd96bb779e9d88d83ba2bf54e8610bf966dcdf1c9 (patch)
treebb895796d71a346eff190714b865928d82980422 /src/gpm-kbd-backlight.c
parent8cb168b752f4130e88daefa400bb9bf07cf18227 (diff)
parentd59f4b8bd38e1628af3a992ae8e96b8e069ab738 (diff)
downloadmate-power-manager-d96bb779e9d88d83ba2bf54e8610bf966dcdf1c9.tar.bz2
mate-power-manager-d96bb779e9d88d83ba2bf54e8610bf966dcdf1c9.tar.xz
Merge pull request #98 from seife/master
make m-p-m work with current upower-0.99
Diffstat (limited to 'src/gpm-kbd-backlight.c')
-rw-r--r--src/gpm-kbd-backlight.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gpm-kbd-backlight.c b/src/gpm-kbd-backlight.c
index 0ac6801..3a0f6e6 100644
--- a/src/gpm-kbd-backlight.c
+++ b/src/gpm-kbd-backlight.c
@@ -113,6 +113,9 @@ gpm_kbd_backlight_set (GpmKbdBacklight *backlight,
guint goal;
g_return_val_if_fail (GPM_IS_KBD_BACKLIGHT (backlight), FALSE);
+ /* avoid warnings if no keyboard brightness is available */
+ if (backlight->priv->max_brightness < 1)
+ return FALSE;
/* if we're setting the same we are, don't bother */
//g_return_val_if_fail (backlight->priv->brightness_percent != percentage, FALSE);
@@ -483,6 +486,9 @@ gpm_kbd_backlight_control_resume_cb (GpmControl *control,
**/
static void
gpm_kbd_backlight_client_changed_cb (UpClient *client,
+#if UP_CHECK_VERSION(0, 99, 0)
+ GParamSpec *pspec,
+#endif
GpmKbdBacklight *backlight)
{
gpm_kbd_backlight_evaluate_power_source_and_set (backlight);
@@ -752,8 +758,13 @@ noerr:
/* Use upower for ac changed signal */
backlight->priv->client = up_client_new ();
+#if UP_CHECK_VERSION(0, 99, 0)
+ g_signal_connect (backlight->priv->client, "notify",
+ G_CALLBACK (gpm_kbd_backlight_client_changed_cb), backlight);
+#else
g_signal_connect (backlight->priv->client, "changed",
G_CALLBACK (gpm_kbd_backlight_client_changed_cb), backlight);
+#endif
backlight->priv->settings = g_settings_new (GPM_SETTINGS_SCHEMA);
//g_signal_connect (backlight->priv->settings, "changed", G_CALLBACK (gpm_settings_key_changed_cb), backlight);