gnome-power-manager r2790 - in trunk: . src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-power-manager r2790 - in trunk: . src
- Date: Fri, 9 May 2008 12:56:35 +0100 (BST)
Author: rhughes
Date: Fri May 9 11:56:35 2008
New Revision: 2790
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=2790&view=rev
Log:
2008-05-09 Richard Hughes <richard hughsie com>
* src/gpm-brightness.c: (gpm_brightness_finalize),
(gpm_brightness_changed), (gpm_brightness_xrandr_changed_cb),
(gpm_brightness_hal_changed_cb), (gpm_brightness_init):
Be more careful only listening to the brightness changed signals from the event source
we are using. This should fix duplicate notifications from hardware that can do both sorts
of dimming.
Modified:
trunk/ChangeLog
trunk/src/gpm-brightness.c
Modified: trunk/src/gpm-brightness.c
==============================================================================
--- trunk/src/gpm-brightness.c (original)
+++ trunk/src/gpm-brightness.c Fri May 9 11:56:35 2008
@@ -301,6 +301,7 @@
g_return_if_fail (GPM_IS_BRIGHTNESS (object));
brightness = GPM_BRIGHTNESS (object);
g_object_unref (brightness->priv->hal);
+ g_object_unref (brightness->priv->xrandr);
G_OBJECT_CLASS (gpm_brightness_parent_class)->finalize (object);
}
@@ -324,11 +325,11 @@
}
/**
- * gpm_brightness_changed_cb:
+ * gpm_brightness_changed:
* This callback is called when the brightness value changes.
**/
static void
-gpm_brightness_changed_cb (gpointer caller, guint percentage, GpmBrightness *brightness)
+gpm_brightness_changed (GpmBrightness *brightness, guint percentage)
{
g_return_if_fail (GPM_IS_BRIGHTNESS (brightness));
brightness->priv->cache_trusted = TRUE;
@@ -351,6 +352,32 @@
}
/**
+ * gpm_brightness_xrandr_changed_cb:
+ * This callback is called when the brightness value changes.
+ **/
+static void
+gpm_brightness_xrandr_changed_cb (GpmBrightnessXRandR *xrandr, guint percentage, GpmBrightness *brightness)
+{
+ g_return_if_fail (GPM_IS_BRIGHTNESS (brightness));
+ if (brightness->priv->use_xrandr) {
+ gpm_brightness_changed (brightness, percentage);
+ }
+}
+
+/**
+ * gpm_brightness_hal_changed_cb:
+ * This callback is called when the brightness value changes.
+ **/
+static void
+gpm_brightness_hal_changed_cb (GpmBrightnessHal *hal, guint percentage, GpmBrightness *brightness)
+{
+ g_return_if_fail (GPM_IS_BRIGHTNESS (brightness));
+ if (brightness->priv->use_hal) {
+ gpm_brightness_changed (brightness, percentage);
+ }
+}
+
+/**
* gpm_brightness_init:
* @brightness: This brightness class instance
**/
@@ -373,10 +400,14 @@
if (gpm_brightness_hal_has_hw (brightness->priv->hal)) {
brightness->priv->use_hal = TRUE;
}
+ /* we want to default to only use XRANDR if available, as some hardware can use either */
+ if (brightness->priv->use_xrandr) {
+ brightness->priv->use_hal = FALSE;
+ }
g_signal_connect (brightness->priv->hal, "brightness-changed",
- G_CALLBACK (gpm_brightness_changed_cb), brightness);
+ G_CALLBACK (gpm_brightness_hal_changed_cb), brightness);
g_signal_connect (brightness->priv->xrandr, "brightness-changed",
- G_CALLBACK (gpm_brightness_changed_cb), brightness);
+ G_CALLBACK (gpm_brightness_xrandr_changed_cb), brightness);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]