[gnome-power-manager] Remove ambient light sensor support, and keyboard backlight devices



commit c8a560caf488129c03a4e437ff7bd54f173c2f55
Author: Richard Hughes <richard hughsie com>
Date:   Fri Jul 3 11:44:04 2009 +0100

    Remove ambient light sensor support, and keyboard backlight devices

 data/gnome-power-manager.schemas.in |   84 +----
 libhal-glib/Makefile.am             |    4 +-
 libhal-glib/hal-device-store.c      |  309 --------------
 libhal-glib/hal-device-store.h      |   67 ---
 libhal-glib/hal-device.c            |  381 +-----------------
 libhal-glib/hal-device.h            |   21 -
 libhal-glib/hal-manager.c           |   10 +-
 src/Makefile.am                     |    4 -
 src/gpm-backlight.c                 |   55 ---
 src/gpm-brightness-kbd.c            |  774 -----------------------------------
 src/gpm-brightness-kbd.h            |   70 ----
 src/gpm-common.h                    |   11 -
 src/gpm-light-sensor.c              |  385 -----------------
 src/gpm-light-sensor.h              |   64 ---
 src/gpm-manager.c                   |   70 +---
 src/gpm-prefs-core.c                |    2 -
 src/gpm-prefs-server.h              |    1 -
 17 files changed, 12 insertions(+), 2300 deletions(-)
---
diff --git a/data/gnome-power-manager.schemas.in b/data/gnome-power-manager.schemas.in
index d234abd..8444b7b 100644
--- a/data/gnome-power-manager.schemas.in
+++ b/data/gnome-power-manager.schemas.in
@@ -2,66 +2,6 @@
   <schemalist>
 
     <schema>
-      <key>/schemas/apps/gnome-power-manager/ambient/dim_policy</key>
-      <applyto>/apps/gnome-power-manager/ambient/dim_policy</applyto>
-      <owner>gnome-power-manager</owner>
-      <type>string</type>
-      <default>none</default>
-      <locale name="C">
-        <short>Change the brightness automatically using the ambient light sensors</short>
-        <long>If the screen brightness should be changed automatically using the ambient light sensors. Valid is 'none', 'light' and 'dark'</long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/gnome-power-manager/ambient/poll_timeout</key>
-      <applyto>/apps/gnome-power-manager/ambient/poll_timeout</applyto>
-      <owner>gnome-power-manager</owner>
-      <type>int</type>
-      <default>60</default>
-      <locale name="C">
-        <short>The interval the ambient light sensors should be polled</short>
-        <long>The interval the ambient light sensors should be polled in seconds.</long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/gnome-power-manager/ambient/correction_factor</key>
-      <applyto>/apps/gnome-power-manager/ambient/correction_factor</applyto>
-      <owner>gnome-power-manager</owner>
-      <type>int</type>
-      <default>50</default>
-      <locale name="C">
-        <short>The amount the light sensors should contribute to the brightness</short>
-        <long>The amount the light sensors should contribute to the brightness.</long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/gnome-power-manager/ambient/correction_scale</key>
-      <applyto>/apps/gnome-power-manager/ambient/correction_scale</applyto>
-      <owner>gnome-power-manager</owner>
-      <type>int</type>
-      <default>200</default>
-      <locale name="C">
-        <short>The calibration of the light sensors so that the screen is bright enough</short>
-        <long>The calibration of the light sensors so that the screen is bright enough, in percent.</long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/gnome-power-manager/ambient/enable</key>
-      <applyto>/apps/gnome-power-manager/ambient/enable</applyto>
-      <owner>gnome-power-manager</owner>
-      <type>bool</type>
-      <default>false</default>
-      <locale name="C">
-        <short>Change the brightness automatically using the ambient light sensors</short>
-        <long>If the screen brightness should be changed automatically using the ambient light sensors.</long>
-      </locale>
-    </schema>
-
-    <schema>
       <key>/schemas/apps/gnome-power-manager/actions/sleep_type_battery</key>
       <applyto>/apps/gnome-power-manager/actions/sleep_type_battery</applyto>
       <type>string</type>
@@ -136,7 +76,7 @@
       <default>true</default>
       <locale name="C">
         <short>Allow backlight brightness adjustment</short>
-        <long>If the screen brightness can be changed when switching between AC and battery power and by ambient light sensors.</long>
+        <long>If the screen brightness should be changed when switching between AC and battery power.</long>
       </locale>
     </schema>
 
@@ -396,28 +336,6 @@
     </schema>
 
     <schema>
-      <key>/schemas/apps/gnome-power-manager/keyboard/brightness_battery</key>
-      <applyto>/apps/gnome-power-manager/keyboard/brightness_battery</applyto>
-      <type>int</type>
-      <default>50</default>
-      <locale name="C">
-        <short>Keyboard brightness when on battery</short>
-        <long>The brightness of the keyboard when on battery power. Possible values are between 0 and 100.</long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/gnome-power-manager/keyboard/brightness_ac</key>
-      <applyto>/apps/gnome-power-manager/keyboard/brightness_ac</applyto>
-      <type>int</type>
-      <default>100</default>
-      <locale name="C">
-        <short>Keyboard brightness when on AC</short>
-        <long>The brightness of the keyboard when on AC power. Possible values are between 0 and 100.</long>
-      </locale>
-    </schema>
-
-    <schema>
       <key>/schemas/apps/gnome-power-manager/lock/use_screensaver_settings</key>
       <applyto>/apps/gnome-power-manager/lock/use_screensaver_settings</applyto>
       <owner>gnome-power-manager</owner>
diff --git a/libhal-glib/Makefile.am b/libhal-glib/Makefile.am
index 5103b6f..22be87c 100644
--- a/libhal-glib/Makefile.am
+++ b/libhal-glib/Makefile.am
@@ -23,9 +23,7 @@ libhal_la_SOURCES =						\
 	hal-device.c						\
 	hal-device.h						\
 	hal-manager.c						\
-	hal-manager.h						\
-	hal-device-store.c					\
-	hal-device-store.h
+	hal-manager.h
 
 libhal_la_LIBADD =						\
 	$(DBUS_LIBS)						\
diff --git a/libhal-glib/hal-device.c b/libhal-glib/hal-device.c
index 02d0629..3b471aa 100644
--- a/libhal-glib/hal-device.c
+++ b/libhal-glib/hal-device.c
@@ -44,8 +44,6 @@ static void     hal_device_finalize   (GObject	     *object);
 struct HalDevicePrivate
 {
 	DBusGConnection		*connection;
-	gboolean		 use_property_modified;
-	gboolean		 use_condition;
 	EggDbusProxy		*gproxy;
 	gchar			*udi;
 };
@@ -94,7 +92,7 @@ hal_device_set_udi (HalDevice  *device, const gchar *udi)
 	proxy = egg_dbus_proxy_assign (device->priv->gproxy, connection,
 				       HAL_DBUS_SERVICE, udi, HAL_DBUS_INTERFACE_DEVICE);
 	if (DBUS_IS_G_PROXY (proxy) == FALSE) {
-		egg_warning ("proxy failed");
+		g_warning ("proxy failed");
 		return FALSE;
 	}
 	device->priv->udi = g_strdup (udi);
@@ -103,19 +101,6 @@ hal_device_set_udi (HalDevice  *device, const gchar *udi)
 }
 
 /**
- * hal_device_get_udi:
- *
- * Return value: UDI
- **/
-const gchar *
-hal_device_get_udi (HalDevice *device)
-{
-	g_return_val_if_fail (HAL_IS_DEVICE (device), NULL);
-
-	return device->priv->udi;
-}
-
-/**
  * hal_device_get_bool:
  *
  * @hal_device: This class instance
@@ -139,7 +124,7 @@ hal_device_get_bool (HalDevice  *device,
 
 	proxy = egg_dbus_proxy_get_proxy (device->priv->gproxy);
 	if (DBUS_IS_G_PROXY (proxy) == FALSE) {
-		egg_warning ("proxy NULL!!");
+		g_warning ("proxy NULL!!");
 		return FALSE;
 	}
 	ret = dbus_g_proxy_call (proxy, "GetPropertyBoolean", error,
@@ -154,46 +139,6 @@ hal_device_get_bool (HalDevice  *device,
 }
 
 /**
- * hal_device_get_string:
- *
- * @hal_device: This class instance
- * @key: The key to query
- * @value: return value, passed by ref
- * Return value: TRUE for success, FALSE for failure
- *
- * You must g_free () the return value.
- **/
-gboolean
-hal_device_get_string (HalDevice   *device,
-			const gchar  *key,
-			gchar       **value,
-			GError      **error)
-{
-	gboolean ret;
-	DBusGProxy *proxy;
-
-	g_return_val_if_fail (HAL_IS_DEVICE (device), FALSE);
-	g_return_val_if_fail (key != NULL, FALSE);
-	g_return_val_if_fail (value != NULL, FALSE);
-	g_return_val_if_fail (device->priv->udi != NULL, FALSE);
-
-	proxy = egg_dbus_proxy_get_proxy (device->priv->gproxy);
-	if (DBUS_IS_G_PROXY (proxy) == FALSE) {
-		egg_warning ("proxy NULL!!");
-		return FALSE;
-	}
-	ret = dbus_g_proxy_call (proxy, "GetPropertyString", error,
-				 G_TYPE_STRING, key,
-				 G_TYPE_INVALID,
-				 G_TYPE_STRING, value,
-				 G_TYPE_INVALID);
-	if (!ret) {
-		*value = NULL;
-	}
-	return ret;
-}
-
-/**
  * hal_device_get_int:
  *
  * @hal_device: This class instance
@@ -217,7 +162,7 @@ hal_device_get_int (HalDevice   *device,
 
 	proxy = egg_dbus_proxy_get_proxy (device->priv->gproxy);
 	if (DBUS_IS_G_PROXY (proxy) == FALSE) {
-		egg_warning ("proxy NULL!!");
+		g_warning ("proxy NULL!!");
 		return FALSE;
 	}
 	ret = dbus_g_proxy_call (proxy, "GetPropertyInteger", error,
@@ -252,292 +197,6 @@ hal_device_get_uint (HalDevice   *device,
 }
 
 /**
- * hal_device_query_capability:
- *
- * @hal_device: This class instance
- * @capability: The capability, e.g. "battery"
- * @value: return value, passed by ref
- * Return value: TRUE for success, FALSE for failure
- **/
-gboolean
-hal_device_query_capability (HalDevice  *device,
-			      const gchar *capability,
-			      gboolean    *has_capability,
-			      GError     **error)
-{
-	gboolean ret;
-	DBusGProxy *proxy;
-
-	g_return_val_if_fail (HAL_IS_DEVICE (device), FALSE);
-	g_return_val_if_fail (capability != NULL, FALSE);
-	g_return_val_if_fail (has_capability != NULL, FALSE);
-	g_return_val_if_fail (device->priv->udi != NULL, FALSE);
-
-	proxy = egg_dbus_proxy_get_proxy (device->priv->gproxy);
-	if (DBUS_IS_G_PROXY (proxy) == FALSE) {
-		egg_warning ("proxy NULL!!");
-		return FALSE;
-	}
-	ret = dbus_g_proxy_call (proxy, "QueryCapability", error,
-				 G_TYPE_STRING, capability,
-				 G_TYPE_INVALID,
-				 G_TYPE_BOOLEAN, has_capability,
-				 G_TYPE_INVALID);
-	if (!ret) {
-		*has_capability = FALSE;
-	}
-	return ret;
-}
-
-/**
- * watch_device_property_modified:
- *
- * @key: Property key
- * @is_added: If the key was added
- * @is_removed: If the key was removed
- *
- * Invoked when a property of a device in the Global Device List is
- * changed, and we have we have subscribed to changes for that device.
- */
-static void
-watch_device_property_modified (DBusGProxy  *proxy,
-				const gchar *key,
-				gboolean     is_added,
-				gboolean     is_removed,
-				gboolean     finally,
-				HalDevice  *device)
-{
-	g_signal_emit (device, signals [DEVICE_PROPERTY_MODIFIED], 0,
-		       key, is_added, is_removed, finally);
-}
-
-/**
- * watch_device_properties_modified_cb:
- *
- * @proxy: The org.freedesktop.Hal.Manager proxy
- * @device: This class instance
- *
- * Demultiplex the composite PropertyModified events here.
- */
-static void
-watch_device_properties_modified_cb (DBusGProxy *proxy,
-				     gint	 type,
-				     GPtrArray  *properties,
-				     HalDevice *device)
-{
-	GValueArray *array;
-	const gchar *udi;
-	const gchar *key;
-	gboolean     added;
-	gboolean     removed;
-	gboolean     finally = FALSE;
-	guint	     i;
-
-	udi = dbus_g_proxy_get_path (proxy);
-
-	array = NULL;
-
-	for (i = 0; i < properties->len; i++) {
-		array = g_ptr_array_index (properties, i);
-		if (array->n_values != 3) {
-			egg_warning ("array->n_values invalid (!3)");
-			return;
-		}
-
-		key = g_value_get_string (g_value_array_get_nth (array, 0));
-		removed = g_value_get_boolean (g_value_array_get_nth (array, 1));
-		added = g_value_get_boolean (g_value_array_get_nth (array, 2));
-
-		/* Work out if this PropertyModified is the last to be sent as
-		 * sometimes we only want to refresh caches when we have all
-		 * the info from a UDI */
-		if (i == properties->len - 1) {
-			finally = TRUE;
-		}
-
-		watch_device_property_modified (proxy, key, added, removed, finally, device);
-	}
-}
-
-/**
- * hal_device_watch_property_modified:
- *
- * Watch the specified device, so it emits device-property-modified and
- * adds to the gpm cache so we don't get asked to add it again.
- */
-gboolean
-hal_device_watch_property_modified (HalDevice *device)
-{
-	DBusGProxy *proxy;
-	GType struct_array_type, struct_type;
-
-	g_return_val_if_fail (HAL_IS_DEVICE (device), FALSE);
-	g_return_val_if_fail (device->priv->udi != NULL, FALSE);
-
-	if (device->priv->use_property_modified) {
-		/* already watched */
-		return FALSE;
-	}
-
-	device->priv->use_property_modified = TRUE;
-
-	struct_type = dbus_g_type_get_struct ("GValueArray",
-					      G_TYPE_STRING,
-					      G_TYPE_BOOLEAN,
-					      G_TYPE_BOOLEAN,
-					      G_TYPE_INVALID);
-
-	struct_array_type = dbus_g_type_get_collection ("GPtrArray", struct_type);
-
-	dbus_g_object_register_marshaller (hal_marshal_VOID__INT_BOXED,
-					   G_TYPE_NONE, G_TYPE_INT,
-					   struct_array_type, G_TYPE_INVALID);
-
-	proxy = egg_dbus_proxy_get_proxy (device->priv->gproxy);
-	if (DBUS_IS_G_PROXY (proxy) == FALSE) {
-		egg_warning ("proxy NULL!!");
-		return FALSE;
-	}
-	dbus_g_proxy_add_signal (proxy, "PropertyModified",
-				 G_TYPE_INT, struct_array_type, G_TYPE_INVALID);
-	dbus_g_proxy_connect_signal (proxy, "PropertyModified",
-				     G_CALLBACK (watch_device_properties_modified_cb), device, NULL);
-	return TRUE;
-}
-
-/**
- * watch_device_condition_cb:
- *
- * @udi: Univerisal Device Id
- * @name: Name of condition
- * @details: D-BUS message with parameters
- *
- * Invoked when a property of a device in the Global Device List is
- * changed, and we have we have subscribed to changes for that device.
- */
-static void
-watch_device_condition_cb (DBusGProxy  *proxy,
-			   const gchar *condition,
-			   const gchar *details,
-			   HalDevice  *device)
-{
-	g_signal_emit (device, signals [DEVICE_CONDITION], 0, condition, details);
-}
-
-/**
- * hal_device_watch_condition:
- *
- * Watch the specified device, so it emits a device-condition
- */
-gboolean
-hal_device_watch_condition (HalDevice *device)
-{
-	DBusGProxy *proxy;
-
-	g_return_val_if_fail (HAL_IS_DEVICE (device), FALSE);
-	g_return_val_if_fail (device->priv->udi != NULL, FALSE);
-
-	if (device->priv->use_condition) {
-		/* already watched */
-		return FALSE;
-	}
-
-	device->priv->use_condition = TRUE;
-
-	dbus_g_object_register_marshaller (hal_marshal_VOID__STRING_STRING,
-					   G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING,
-					   G_TYPE_INVALID);
-
-	proxy = egg_dbus_proxy_get_proxy (device->priv->gproxy);
-	if (DBUS_IS_G_PROXY (proxy) == FALSE) {
-		egg_warning ("proxy NULL!!");
-		return FALSE;
-	}
-	dbus_g_proxy_add_signal (proxy, "Condition",
-				 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
-	dbus_g_proxy_connect_signal (proxy, "Condition",
-				     G_CALLBACK (watch_device_condition_cb), device, NULL);
-	return TRUE;
-}
-
-/**
- * hal_device_remove_condition:
- *
- * Remove the specified device, so it does not emit device-condition signals.
- */
-gboolean
-hal_device_remove_condition (HalDevice *device)
-{
-	DBusGProxy *proxy;
-
-	g_return_val_if_fail (HAL_IS_DEVICE (device), FALSE);
-
-	if (device->priv->use_condition == FALSE) {
-		/* already connected */
-		return FALSE;
-	}
-
-	device->priv->use_condition = FALSE;
-
-	proxy = egg_dbus_proxy_get_proxy (device->priv->gproxy);
-	if (DBUS_IS_G_PROXY (proxy) == FALSE) {
-		egg_warning ("proxy NULL!!");
-		return FALSE;
-	}
-	dbus_g_proxy_disconnect_signal (proxy, "Condition",
-					G_CALLBACK (watch_device_condition_cb), device);
-	return TRUE;
-}
-
-/**
- * hal_device_remove_property_modified:
- *
- * Remove the specified device, so it does not emit device-propery-modified.
- */
-gboolean
-hal_device_remove_property_modified (HalDevice *device)
-{
-	DBusGProxy *proxy;
-
-	g_return_val_if_fail (HAL_IS_DEVICE (device), FALSE);
-
-	if (device->priv->use_property_modified == FALSE) {
-		/* already disconnected */
-		return FALSE;
-	}
-
-	device->priv->use_property_modified = FALSE;
-
-	proxy = egg_dbus_proxy_get_proxy (device->priv->gproxy);
-	if (DBUS_IS_G_PROXY (proxy) == FALSE) {
-		egg_warning ("proxy NULL!!");
-		return FALSE;
-	}
-	dbus_g_proxy_disconnect_signal (proxy, "PropertyModified",
-				        G_CALLBACK (watch_device_properties_modified_cb), device);
-	return TRUE;
-}
-
-/**
- * proxy_status_cb:
- * @proxy: The dbus raw proxy
- * @status: The status of the service, where TRUE is connected
- * @hal_manager: This class instance
- **/
-static void
-proxy_status_cb (DBusGProxy *proxy,
-		 gboolean    status,
-		 HalDevice *device)
-{
-	g_return_if_fail (HAL_IS_DEVICE (device));
-	if (status) {
-		/* should join */
-	} else {
-		/* should unjoin */
-	}
-}
-
-/**
  * hal_device_class_init:
  * @klass: This class instance
  **/
@@ -547,26 +206,6 @@ hal_device_class_init (HalDeviceClass *klass)
 	GObjectClass *object_class = G_OBJECT_CLASS (klass);
 	object_class->finalize = hal_device_finalize;
 	g_type_class_add_private (klass, sizeof (HalDevicePrivate));
-
-	signals [DEVICE_PROPERTY_MODIFIED] =
-		g_signal_new ("property-modified",
-			      G_TYPE_FROM_CLASS (object_class),
-			      G_SIGNAL_RUN_LAST,
-			      G_STRUCT_OFFSET (HalDeviceClass, device_property_modified),
-			      NULL,
-			      NULL,
-			      hal_marshal_VOID__STRING_BOOLEAN_BOOLEAN_BOOLEAN,
-			      G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
-	signals [DEVICE_CONDITION] =
-		g_signal_new ("device-condition",
-			      G_TYPE_FROM_CLASS (object_class),
-			      G_SIGNAL_RUN_LAST,
-			      G_STRUCT_OFFSET (HalDeviceClass, device_condition),
-			      NULL,
-			      NULL,
-			      hal_marshal_VOID__STRING_STRING,
-			      G_TYPE_NONE,
-			      2, G_TYPE_STRING, G_TYPE_STRING);
 }
 
 /**
@@ -583,17 +222,12 @@ hal_device_init (HalDevice *device)
 
 	device->priv->connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
 	if (error != NULL) {
-		egg_warning ("%s", error->message);
+		g_warning ("%s", error->message);
 		g_error_free (error);
 	}
 
-	device->priv->use_property_modified = FALSE;
-	device->priv->use_condition = FALSE;
-
 	/* get the manager connection */
 	device->priv->gproxy = egg_dbus_proxy_new ();
-	g_signal_connect (device->priv->gproxy, "proxy-status",
-			  G_CALLBACK (proxy_status_cb), device);
 }
 
 /**
@@ -610,13 +244,6 @@ hal_device_finalize (GObject *object)
 	device = HAL_DEVICE (object);
 	device->priv = HAL_DEVICE_GET_PRIVATE (device);
 
-	if (device->priv->use_property_modified) {
-		hal_device_remove_property_modified (device);
-	}
-	if (device->priv->use_condition) {
-		hal_device_remove_condition (device);
-	}
-
 	g_object_unref (device->priv->gproxy);
 	g_free (device->priv->udi);
 
diff --git a/libhal-glib/hal-device.h b/libhal-glib/hal-device.h
index 8a505be..def3a47 100644
--- a/libhal-glib/hal-device.h
+++ b/libhal-glib/hal-device.h
@@ -50,14 +50,6 @@ typedef struct
 typedef struct
 {
 	GObjectClass	parent_class;
-	void		(* device_property_modified)	(HalDevice	*device,
-							 const gchar	*key,
-							 gboolean	 is_added,
-							 gboolean	 is_removed,
-							 gboolean	 finally);
-	void		(* device_condition)		(HalDevice	*device,
-							 const gchar	*condition,
-							 const gchar	*details);
 } HalDeviceClass;
 
 GType		 hal_device_get_type			(void);
@@ -65,27 +57,14 @@ HalDevice	*hal_device_new				(void);
 
 gboolean	 hal_device_set_udi			(HalDevice	*device,
 							 const gchar	*udi);
-const gchar	*hal_device_get_udi			(HalDevice	*device);
 gboolean	 hal_device_get_bool			(HalDevice	*device,
 							 const gchar	*key,
 							 gboolean	*value,
 							 GError		**error);
-gboolean	 hal_device_get_string			(HalDevice	*device,
-							 const gchar	*key,
-							 gchar		**value,
-							 GError		**error);
 gboolean	 hal_device_get_uint			(HalDevice	*device,
 							 const gchar	*key,
 							 guint		*value,
 							 GError		**error);
-gboolean	 hal_device_query_capability		(HalDevice	*device,
-							 const gchar	*capability,
-							 gboolean	*has_capability,
-							 GError		**error);
-gboolean	 hal_device_watch_condition		(HalDevice	*device);
-gboolean	 hal_device_watch_property_modified	(HalDevice	*device);
-gboolean	 hal_device_remove_condition		(HalDevice	*device);
-gboolean	 hal_device_remove_property_modified	(HalDevice	*device);
 
 G_END_DECLS
 
diff --git a/libhal-glib/hal-manager.c b/libhal-glib/hal-manager.c
index caa0059..ed50c91 100644
--- a/libhal-glib/hal-manager.c
+++ b/libhal-glib/hal-manager.c
@@ -208,7 +208,7 @@ hal_manager_proxy_connect_more (HalManager *manager)
 
 	proxy = egg_dbus_proxy_get_proxy (manager->priv->gproxy);
 	if (DBUS_IS_G_PROXY (proxy) == FALSE) {
-		egg_warning ("proxy NULL!!");
+		g_warning ("proxy NULL!!");
 		return FALSE;
 	}
 
@@ -243,7 +243,7 @@ hal_manager_proxy_disconnect_more (HalManager *manager)
 
 	proxy = egg_dbus_proxy_get_proxy (manager->priv->gproxy);
 	if (DBUS_IS_G_PROXY (proxy) == FALSE) {
-		egg_warning ("proxy NULL!!");
+		g_warning ("proxy NULL!!");
 		return FALSE;
 	}
 
@@ -291,7 +291,7 @@ hal_manager_init (HalManager *manager)
 
 	manager->priv->connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
 	if (error) {
-		egg_warning ("%s", error->message);
+		g_warning ("%s", error->message);
 		g_error_free (error);
 	}
 
@@ -302,7 +302,7 @@ hal_manager_init (HalManager *manager)
 				       HAL_DBUS_SERVICE, HAL_DBUS_PATH_MANAGER,
 				       HAL_DBUS_INTERFACE_MANAGER);
 	if (DBUS_IS_G_PROXY (proxy) == FALSE) {
-		egg_warning ("Either HAL or DBUS are not working!");
+		g_warning ("Either HAL or DBUS are not working!");
 		exit (0);
 	}
 
@@ -313,7 +313,7 @@ hal_manager_init (HalManager *manager)
 	manager->priv->computer = hal_device_new();
 	ret = hal_device_set_udi (manager->priv->computer, HAL_ROOT_COMPUTER);
 	if (!ret) {
-		egg_warning ("failed to get Computer root object");
+		g_warning ("failed to get Computer root object");
 	}
 
 	/* blindly try to connect, assuming HAL is alive */
diff --git a/src/Makefile.am b/src/Makefile.am
index 32389fc..559e0ee 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -176,10 +176,6 @@ gnome_power_manager_SOURCES =				\
 	gpm-brightness-hal.c				\
 	gpm-brightness-xrandr.h				\
 	gpm-brightness-xrandr.c				\
-	gpm-brightness-kbd.h				\
-	gpm-brightness-kbd.c				\
-	gpm-light-sensor.h				\
-	gpm-light-sensor.c				\
 	gpm-main.c					\
 	gpm-manager.h					\
 	gpm-manager.c					\
diff --git a/src/gpm-backlight.c b/src/gpm-backlight.c
index 587a308..c62e780 100644
--- a/src/gpm-backlight.c
+++ b/src/gpm-backlight.c
@@ -51,7 +51,6 @@
 #include "gpm-feedback-widget.h"
 #include "gpm-dpms.h"
 #include "gpm-idle.h"
-#include "gpm-light-sensor.h"
 #include "gpm-marshal.h"
 #include "gpm-stock-icons.h"
 #include "gpm-prefs-server.h"
@@ -68,12 +67,9 @@ struct GpmBacklightPrivate
 	GpmControl		*control;
 	GpmDpms			*dpms;
 	GpmIdle			*idle;
-	GpmLightSensor		*light_sensor;
 	gboolean		 can_dim;
-	gboolean		 can_sense;
 	gboolean		 system_is_idle;
 	GTimer			*idle_timer;
-	gfloat			 ambient_sensor_value;
 	guint			 idle_dim_timeout;
 	guint			 master_percentage;
 };
@@ -253,26 +249,6 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int
 	}
 	egg_debug ("3. idle scale %f, brightness %f", scale, brightness);
 
-	/* reduce if ambient is low */
-	enable_action = gconf_client_get_bool (backlight->priv->conf, GPM_CONF_AMBIENT_ENABLE, NULL);
-	if (backlight->priv->can_sense && enable_action) {
-		value = gconf_client_get_int (backlight->priv->conf, GPM_CONF_AMBIENT_SCALE, NULL);
-		scale = backlight->priv->ambient_sensor_value * (value / 100.0f);
-		value = gconf_client_get_int (backlight->priv->conf, GPM_CONF_AMBIENT_FACTOR, NULL);
-		scale = gpm_common_sum_scale (brightness, scale, value / 100.0f);
-		if (scale > 1.0f) {
-			scale = 1.0f;
-		}
-		if (scale < 0.80f) {
-			brightness *= scale;
-		} else {
-			scale = 1.0f;
-		}
-	} else {
-		scale = 1.0f;
-	}
-	egg_debug ("4. ambient scale %f, brightness %f", scale, brightness);
-
 	/* convert to percentage */
 	value = (guint) ((brightness * 100.0f) + 0.5);
 
@@ -324,9 +300,6 @@ gpm_conf_gconf_key_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *e
 		gpm_backlight_brightness_evaluate_and_set (backlight, FALSE);
 
 	} else if (strcmp (entry->key, GPM_CONF_BACKLIGHT_IDLE_DIM_AC) == 0 ||
-	         strcmp (entry->key, GPM_CONF_AMBIENT_ENABLE) == 0 ||
-	         strcmp (entry->key, GPM_CONF_AMBIENT_FACTOR) == 0 ||
-	         strcmp (entry->key, GPM_CONF_AMBIENT_SCALE) == 0 ||
 	         strcmp (entry->key, GPM_CONF_BACKLIGHT_ENABLE) == 0 ||
 	         strcmp (entry->key, GPM_CONF_TIMEOUT_SLEEP_DISPLAY_BATT) == 0 ||
 	         strcmp (entry->key, GPM_CONF_BACKLIGHT_BATTERY_REDUCE) == 0 ||
@@ -568,22 +541,6 @@ brightness_changed_cb (GpmBrightness *brightness, guint percentage, GpmBacklight
 }
 
 /**
- * brightness_changed_cb:
- * @brightness: The GpmBrightness class instance
- * @percentage: The new percentage brightness
- * @brightness: This class instance
- *
- * This callback is called when the brightness value changes.
- **/
-static void
-sensor_changed_cb (GpmLightSensor *sensor, guint percentage, GpmBacklight *backlight)
-{
-	egg_debug ("sensor changed! %i", percentage);
-	backlight->priv->ambient_sensor_value = percentage / 100.0f;
-	gpm_backlight_brightness_evaluate_and_set (backlight, FALSE);
-}
-
-/**
  * control_resume_cb:
  * @control: The control class instance
  * @power: This power class instance
@@ -619,7 +576,6 @@ gpm_backlight_finalize (GObject *object)
 
 	g_object_unref (backlight->priv->dpms);
 	g_object_unref (backlight->priv->control);
-	g_object_unref (backlight->priv->light_sensor);
 	g_object_unref (backlight->priv->feedback);
 	g_object_unref (backlight->priv->conf);
 	g_object_unref (backlight->priv->client);
@@ -663,7 +619,6 @@ gpm_backlight_class_init (GpmBacklightClass *klass)
 static void
 gpm_backlight_init (GpmBacklight *backlight)
 {
-	guint value;
 	gboolean lid_is_present = TRUE;
 	GpmPrefsServer *prefs_server;
 
@@ -672,11 +627,6 @@ gpm_backlight_init (GpmBacklight *backlight)
 	/* record our idle time */
 	backlight->priv->idle_timer = g_timer_new ();
 
-	/* this has a delay.. */
-	backlight->priv->light_sensor = gpm_light_sensor_new ();
-	g_signal_connect (backlight->priv->light_sensor, "sensor-changed",
-			  G_CALLBACK (sensor_changed_cb), backlight);
-
 	/* watch for manual brightness changes (for the feedback widget) */
 	backlight->priv->brightness = gpm_brightness_new ();
 	g_signal_connect (backlight->priv->brightness, "brightness-changed",
@@ -689,7 +639,6 @@ gpm_backlight_init (GpmBacklight *backlight)
 
 	/* gets caps */
 	backlight->priv->can_dim = gpm_brightness_has_hw (backlight->priv->brightness);
-	backlight->priv->can_sense = gpm_light_sensor_has_hw (backlight->priv->light_sensor);
 
 	/* we use DeviceKit-power to see if we should show the lid UI */
 #if DKP_CHECK_VERSION(0x009)
@@ -704,8 +653,6 @@ gpm_backlight_init (GpmBacklight *backlight)
 		gpm_prefs_server_set_capability (prefs_server, GPM_PREFS_SERVER_LID);
 	if (backlight->priv->can_dim)
 		gpm_prefs_server_set_capability (prefs_server, GPM_PREFS_SERVER_BACKLIGHT);
-	if (backlight->priv->can_sense)
-		gpm_prefs_server_set_capability (prefs_server, GPM_PREFS_SERVER_AMBIENT);
 	g_object_unref (prefs_server);
 
 	/* watch for dim value changes */
@@ -750,8 +697,6 @@ gpm_backlight_init (GpmBacklight *backlight)
 			  G_CALLBACK (control_resume_cb), backlight);
 
 	/* sync at startup */
-	gpm_light_sensor_get_absolute (backlight->priv->light_sensor, &value);
-	backlight->priv->ambient_sensor_value = value / 100.0f;
 	gpm_backlight_brightness_evaluate_and_set (backlight, FALSE);
 }
 
diff --git a/src/gpm-common.h b/src/gpm-common.h
index 363a027..99edcb1 100644
--- a/src/gpm-common.h
+++ b/src/gpm-common.h
@@ -57,13 +57,6 @@ G_BEGIN_DECLS
 
 #define GPM_CONF_DIR 				"/apps/gnome-power-manager"
 
-/* ambient */
-#define GPM_CONF_AMBIENT_ENABLE			GPM_CONF_DIR "/ambient/enable"
-#define GPM_CONF_AMBIENT_POLL			GPM_CONF_DIR "/ambient/poll_timeout"
-#define GPM_CONF_AMBIENT_FACTOR			GPM_CONF_DIR "/ambient/correction_factor"
-#define GPM_CONF_AMBIENT_SCALE			GPM_CONF_DIR "/ambient/correction_scale"
-#define GPM_CONF_AMBIENT_DIM_POLICY		GPM_CONF_DIR "/ambient/dim_policy"
-
 /* actions */
 #define GPM_CONF_ACTIONS_CRITICAL_UPS		GPM_CONF_DIR "/actions/critical_ups"
 #define GPM_CONF_ACTIONS_CRITICAL_BATT		GPM_CONF_DIR "/actions/critical_battery"
@@ -102,10 +95,6 @@ G_BEGIN_DECLS
 #define GPM_CONF_LAPTOP_USES_EXT_MON		GPM_CONF_DIR "/general/using_external_monitor"
 #define GPM_CONF_IGNORE_INHIBITS		GPM_CONF_DIR "/general/ignore_inhibit_requests"
 
-/* keyboard */
-#define GPM_CONF_KEYBOARD_BRIGHTNESS_AC		GPM_CONF_DIR "/keyboard/brightness_ac"
-#define GPM_CONF_KEYBOARD_BRIGHTNESS_BATT	GPM_CONF_DIR "/keyboard/brightness_battery"
-
 /* lock */
 #define GPM_CONF_LOCK_USE_SCREENSAVER		GPM_CONF_DIR "/lock/use_screensaver_settings"
 #define GPM_CONF_LOCK_ON_BLANK_SCREEN		GPM_CONF_DIR "/lock/blank_screen"
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index 4f406ca..555f5a6 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -55,7 +55,6 @@
 #include "gpm-prefs.h"
 #include "gpm-screensaver.h"
 #include "gpm-backlight.h"
-#include "gpm-brightness-kbd.h"
 #include "gpm-screensaver.h"
 #include "gpm-session.h"
 #include "gpm-stock-icons.h"
@@ -86,8 +85,6 @@ struct GpmManagerPrivate
 	GpmScreensaver 		*screensaver;
 	GpmTrayIcon		*tray_icon;
 	GpmEngine		*engine;
-	GpmBrightnessKbd	*brightness_kbd;
-	GpmFeedback		*feedback_kbd;
 	GpmBacklight		*backlight;
 	EggConsoleKit		*console;
 	guint32         	 screensaver_ac_throttle_id;
@@ -619,13 +616,7 @@ idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmManager *manager)
 		return;
 	}
 
-	if (mode == GPM_IDLE_MODE_NORMAL) {
-		egg_debug ("Idle state changed: NORMAL");
-		gpm_brightness_kbd_undim (manager->priv->brightness_kbd);
-	} else if (mode == GPM_IDLE_MODE_BLANK) {
-		egg_debug ("Idle state changed: BLANK");
-		gpm_brightness_kbd_dim (manager->priv->brightness_kbd);
-	} else if (mode == GPM_IDLE_MODE_SLEEP) {
+	if (mode == GPM_IDLE_MODE_SLEEP) {
 		egg_debug ("Idle state changed: SLEEP");
 		if (gpm_manager_is_inhibit_valid (manager, FALSE, "timeout action") == FALSE)
 			return;
@@ -775,13 +766,6 @@ button_pressed_cb (GpmButton *button, const gchar *type, GpmManager *manager)
 		update_lid_throttle (manager, TRUE);
 	else if (strcmp (type, GPM_BUTTON_LID_OPEN) == 0)
 		update_lid_throttle (manager, FALSE);
-
-	if ((strcmp (type, GPM_BUTTON_KBD_BRIGHT_UP) == 0))
-		gpm_brightness_kbd_up (manager->priv->brightness_kbd);
-	else if ((strcmp (type, GPM_BUTTON_KBD_BRIGHT_DOWN) == 0))
-		gpm_brightness_kbd_down (manager->priv->brightness_kbd);
-	else if (strcmp (type, GPM_BUTTON_KBD_BRIGHT_TOGGLE) == 0)
-		gpm_brightness_kbd_toggle (manager->priv->brightness_kbd);
 }
 
 /**
@@ -813,7 +797,6 @@ static void
 gpm_manager_client_changed_cb (DkpClient *client, GpmManager *manager)
 {
 	gboolean event_when_closed;
-	guint brightness;
 	guint timeout;
 	gboolean on_battery;
 
@@ -841,12 +824,6 @@ gpm_manager_client_changed_cb (DkpClient *client, GpmManager *manager)
 	timeout = gpm_manager_get_spindown_timeout (manager);
 	gpm_disks_set_spindown_timeout (manager->priv->disks, timeout);
 
-	if (!on_battery)
-		brightness = gconf_client_get_int (manager->priv->conf, GPM_CONF_KEYBOARD_BRIGHTNESS_AC, NULL);
-	else
-		brightness = gconf_client_get_int (manager->priv->conf, GPM_CONF_KEYBOARD_BRIGHTNESS_BATT, NULL);
-	gpm_brightness_kbd_set_std (manager->priv->brightness_kbd, brightness);
-
 	gpm_manager_sync_policy_sleep (manager);
 
 	update_ac_throttle (manager);
@@ -911,7 +888,6 @@ static void
 gpm_conf_gconf_key_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, GpmManager *manager)
 {
 	GConfValue *value;
-	gint brightness;
 
 	value = gconf_entry_get_value (entry);
 	if (value == NULL)
@@ -922,21 +898,6 @@ gpm_conf_gconf_key_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *e
 	    strcmp (entry->key, GPM_CONF_TIMEOUT_SLEEP_DISPLAY_BATT) == 0 ||
 	    strcmp (entry->key, GPM_CONF_TIMEOUT_SLEEP_DISPLAY_AC) == 0)
 		gpm_manager_sync_policy_sleep (manager);
-
-	/* set keyboard brightness */
-	if (strcmp (entry->key, GPM_CONF_KEYBOARD_BRIGHTNESS_BATT) == 0) {
-
-		brightness = gconf_value_get_int (value);
-		if (manager->priv->on_battery)
-			gpm_brightness_kbd_set_std (manager->priv->brightness_kbd, brightness);
-
-	} else if (strcmp (entry->key, GPM_CONF_KEYBOARD_BRIGHTNESS_AC) == 0) {
-
-		brightness = gconf_client_get_int (manager->priv->conf, GPM_CONF_KEYBOARD_BRIGHTNESS_AC, NULL);
-		if (!manager->priv->on_battery)
-			gpm_brightness_kbd_set_std (manager->priv->brightness_kbd, brightness);
-
-	}
 }
 
 /**
@@ -980,10 +941,6 @@ screensaver_auth_request_cb (GpmScreensaver *screensaver, gboolean auth_begin, G
 	GError *error = NULL;
 
 	if (auth_begin) {
-		/* TODO: This may be a bid of a bodge, as we will have multiple
-			 resume requests -- maybe this need a logic cleanup */
-		gpm_brightness_kbd_undim (manager->priv->brightness_kbd);
-
 		/* We turn on the monitor unconditionally, as we may be using
 		 * a smartcard to authenticate and DPMS might still be on.
 		 * See #350291 for more details */
@@ -1418,21 +1375,6 @@ out:
 }
 
 /**
- * brightness_kbd_changed_cb:
- * @brightness: The GpmBrightnessKbd class instance
- * @percentage: The new percentage brightness
- * @brightness: This class instance
- *
- * This callback is called when the brightness value changes.
- **/
-static void
-brightness_kbd_changed_cb (GpmBrightnessKbd *brightness, gint percentage, GpmManager *manager)
-{
-	egg_debug ("Need to display backlight feedback value %i", percentage);
-	gpm_feedback_display_value (manager->priv->feedback_kbd, (float) percentage / 100.0f);
-}
-
-/**
  * dpms_mode_changed_cb:
  * @mode: The DPMS mode, e.g. GPM_DPMS_MODE_OFF
  * @info: This class instance
@@ -1568,14 +1510,6 @@ gpm_manager_init (GpmManager *manager)
 						     G_OBJECT (manager->priv->backlight));
 	}
 
-	/* use a visual widget */
-	manager->priv->feedback_kbd = gpm_feedback_new ();
-	gpm_feedback_set_icon_name (manager->priv->feedback_kbd, GPM_STOCK_BRIGHTNESS_KBD);
-
-	manager->priv->brightness_kbd = gpm_brightness_kbd_new ();
-	g_signal_connect (manager->priv->brightness_kbd, "brightness-changed",
-			  G_CALLBACK (brightness_kbd_changed_cb), manager);
-
 	manager->priv->idle = gpm_idle_new ();
 	g_signal_connect (manager->priv->idle, "idle-changed",
 			  G_CALLBACK (idle_changed_cb), manager);
@@ -1661,9 +1595,7 @@ gpm_manager_finalize (GObject *object)
 	g_object_unref (manager->priv->notify);
 	g_object_unref (manager->priv->prefs_server);
 	g_object_unref (manager->priv->control);
-	g_object_unref (manager->priv->feedback_kbd);
 	g_object_unref (manager->priv->button);
-	g_object_unref (manager->priv->brightness_kbd);
 	g_object_unref (manager->priv->backlight);
 	g_object_unref (manager->priv->console);
 	g_object_unref (manager->priv->client);
diff --git a/src/gpm-prefs-core.c b/src/gpm-prefs-core.c
index 1ae62aa..9155a74 100644
--- a/src/gpm-prefs-core.c
+++ b/src/gpm-prefs-core.c
@@ -56,7 +56,6 @@ struct GpmPrefsPrivate
 	gboolean		 has_batteries;
 	gboolean		 has_lcd;
 	gboolean		 has_ups;
-	gboolean		 has_ambient;
 	gboolean		 has_button_lid;
 	gboolean		 has_button_suspend;
 	gboolean		 can_shutdown;
@@ -1003,7 +1002,6 @@ gpm_prefs_init (GpmPrefs *prefs)
 	prefs->priv->has_batteries = ((caps & GPM_PREFS_SERVER_BATTERY) > 0);
 	prefs->priv->has_ups = ((caps & GPM_PREFS_SERVER_UPS) > 0);
 	prefs->priv->has_lcd = ((caps & GPM_PREFS_SERVER_BACKLIGHT) > 0);
-	prefs->priv->has_ambient = ((caps & GPM_PREFS_SERVER_AMBIENT) > 0);
 	prefs->priv->has_button_lid = ((caps & GPM_PREFS_SERVER_LID) > 0);
 	prefs->priv->has_button_suspend = TRUE;
 	prefs->priv->can_shutdown = TRUE;
diff --git a/src/gpm-prefs-server.h b/src/gpm-prefs-server.h
index 0d1ccd7..29198aa 100644
--- a/src/gpm-prefs-server.h
+++ b/src/gpm-prefs-server.h
@@ -34,7 +34,6 @@ G_BEGIN_DECLS
 #define GPM_PREFS_SERVER_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), GPM_TYPE_PREFS_SERVER, GpmPrefsServerClass))
 
 #define GPM_PREFS_SERVER_BACKLIGHT	1
-#define GPM_PREFS_SERVER_AMBIENT	2
 #define GPM_PREFS_SERVER_LID		4
 #define GPM_PREFS_SERVER_BATTERY	8
 #define GPM_PREFS_SERVER_UPS		16



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]