[tracker/libtracker-miner: 2/3] Fix compilation with Devicekit-power.
- From: Carlos Garnacho <carlosg src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/libtracker-miner: 2/3] Fix compilation with Devicekit-power.
- Date: Fri, 4 Sep 2009 14:15:38 +0000 (UTC)
commit 8d483259ba4fe0c81cdd95dde47d45bd21882664
Author: Carlos Garnacho <carlos lanedo com>
Date: Fri Sep 4 16:10:34 2009 +0200
Fix compilation with Devicekit-power.
That function should probably be removed altogether, but at least it now
compiles.
src/libtracker-common/tracker-power-devicekit.c | 33 ++++++++++++++++++++++-
1 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-common/tracker-power-devicekit.c b/src/libtracker-common/tracker-power-devicekit.c
index 36c783f..058ea33 100644
--- a/src/libtracker-common/tracker-power-devicekit.c
+++ b/src/libtracker-common/tracker-power-devicekit.c
@@ -46,7 +46,8 @@ static void tracker_power_client_changed_cb (DkpClient *client,
enum {
PROP_0,
PROP_ON_BATTERY,
- PROP_ON_LOW_BATTERY
+ PROP_ON_LOW_BATTERY,
+ PROP_BATTERY_PERCENTAGE
};
G_DEFINE_TYPE (TrackerPower, tracker_power, G_TYPE_OBJECT);
@@ -76,6 +77,15 @@ 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));
}
@@ -214,4 +224,25 @@ 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_DEVKIT_POWER */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]