[tracker] TrackerPower: Remove tracker_power_get_battery_percentage().
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] TrackerPower: Remove tracker_power_get_battery_percentage().
- Date: Mon, 26 Apr 2010 10:09:43 +0000 (UTC)
commit ace15a652a7fdae7fef600139c179e6bbab438f1
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Apr 26 12:03:22 2010 +0200
TrackerPower: Remove tracker_power_get_battery_percentage().
It is unused and the semantics are confusing, since it's hard to do a
correct estimation depending on the number of batteries and their
characteristics.
src/libtracker-common/tracker-power-hal.c | 39 +-------------------------
src/libtracker-common/tracker-power-upower.c | 33 +---------------------
src/libtracker-common/tracker-power.h | 1 -
3 files changed, 2 insertions(+), 71 deletions(-)
---
diff --git a/src/libtracker-common/tracker-power-hal.c b/src/libtracker-common/tracker-power-hal.c
index e931130..fcd4375 100644
--- a/src/libtracker-common/tracker-power-hal.c
+++ b/src/libtracker-common/tracker-power-hal.c
@@ -80,8 +80,7 @@ static void hal_device_property_modified_cb (LibHalContext *context,
enum {
PROP_0,
PROP_ON_BATTERY,
- PROP_ON_LOW_BATTERY,
- PROP_BATTERY_PERCENTAGE
+ PROP_ON_LOW_BATTERY
};
G_DEFINE_TYPE (TrackerPower, tracker_power, G_TYPE_OBJECT);
@@ -110,15 +109,6 @@ tracker_power_class_init (TrackerPowerClass *klass)
"Whether the battery is low",
FALSE,
G_PARAM_READABLE));
- g_object_class_install_property (object_class,
- PROP_BATTERY_PERCENTAGE,
- g_param_spec_double ("battery-percentage",
- "Battery percentage",
- "Current battery percentage left",
- 0.0,
- 1.0,
- 0.0,
- G_PARAM_READABLE));
g_type_class_add_private (object_class, sizeof (TrackerPowerPriv));
}
@@ -238,9 +228,6 @@ hal_get_property (GObject *object,
/* hardcoded to 5% */
g_value_set_boolean (value, priv->battery_percentage < BATTERY_LOW_THRESHOLD);
break;
- case PROP_BATTERY_PERCENTAGE:
- g_value_set_double (value, priv->battery_percentage);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -407,10 +394,6 @@ hal_battery_notify (TrackerPower *power)
g_object_notify (G_OBJECT (power), "on-low-battery");
}
- if (old_percentage != priv->battery_percentage) {
- g_object_notify (G_OBJECT (power), "battery-percentage");
- }
-
g_list_free (values);
}
@@ -567,24 +550,4 @@ tracker_power_get_on_low_battery (TrackerPower *power)
return (priv->battery_percentage < BATTERY_LOW_THRESHOLD);
}
-/**
- * tracker_power_get_battery_percentage:
- * @power: A #TrackerPower
- *
- * Returns the percentage of battery power available.
- *
- * Returns: #gdouble representing the percentage between 0.0 and 1.0.
- **/
-gdouble
-tracker_power_get_battery_percentage (TrackerPower *power)
-{
- TrackerPowerPriv *priv;
-
- g_return_val_if_fail (TRACKER_IS_POWER (power), TRUE);
-
- priv = GET_PRIV (power);
-
- return priv->battery_percentage;
-}
-
#endif /* HAVE_HAL */
diff --git a/src/libtracker-common/tracker-power-upower.c b/src/libtracker-common/tracker-power-upower.c
index 8a1b71e..d3e9406 100644
--- a/src/libtracker-common/tracker-power-upower.c
+++ b/src/libtracker-common/tracker-power-upower.c
@@ -45,8 +45,7 @@ static void tracker_power_client_changed_cb (UpClient *client,
enum {
PROP_0,
PROP_ON_BATTERY,
- PROP_ON_LOW_BATTERY,
- PROP_BATTERY_PERCENTAGE
+ PROP_ON_LOW_BATTERY
};
G_DEFINE_TYPE (TrackerPower, tracker_power, G_TYPE_OBJECT);
@@ -76,15 +75,6 @@ tracker_power_class_init (TrackerPowerClass *klass)
"Whether the battery is low",
FALSE,
G_PARAM_READABLE));
- g_object_class_install_property (object_class,
- PROP_BATTERY_PERCENTAGE,
- g_param_spec_double ("battery-percentage",
- "Battery percentage",
- "Current battery percentage left",
- 0.0,
- 1.0,
- 0.0,
- G_PARAM_READABLE));
g_type_class_add_private (object_class, sizeof (TrackerPowerPriv));
}
@@ -223,25 +213,4 @@ tracker_power_get_on_low_battery (TrackerPower *power)
return priv->on_low_battery;
}
-/**
- * tracker_power_get_battery_percentage:
- * @power: A #TrackerPower
- *
- * Returns the percentage of battery power available.
- *
- * Returns: #gdouble representing the percentage between 0.0 and 1.0.
- **/
-gdouble
-tracker_power_get_battery_percentage (TrackerPower *power)
-{
- TrackerPowerPriv *priv;
-
- g_return_val_if_fail (TRACKER_IS_POWER (power), TRUE);
-
- priv = GET_PRIV (power);
-
- /* FIXME: Implement */
- return 0.5;
-}
-
#endif /* HAVE_UPOWER */
diff --git a/src/libtracker-common/tracker-power.h b/src/libtracker-common/tracker-power.h
index 68d0ade..4727521 100644
--- a/src/libtracker-common/tracker-power.h
+++ b/src/libtracker-common/tracker-power.h
@@ -52,7 +52,6 @@ TrackerPower *tracker_power_new (void);
gboolean tracker_power_get_on_battery (TrackerPower *power);
gboolean tracker_power_get_on_low_battery (TrackerPower *power);
-gdouble tracker_power_get_battery_percentage (TrackerPower *power);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]