[tracker/rss-enclosures] Port from libdevkit-power-gobject to libupower-glib
- From: Roberto Guido <rguido src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/rss-enclosures] Port from libdevkit-power-gobject to libupower-glib
- Date: Mon, 3 May 2010 00:44:55 +0000 (UTC)
commit 85b734ffbf5fa17f5a324755487f5dca88651165
Author: Michael Biebl <biebl debian org>
Date: Wed Apr 14 03:49:31 2010 +0200
Port from libdevkit-power-gobject to libupower-glib
configure.ac | 54 ++++++++++----------
src/libtracker-common/Makefile.am | 11 ++--
...er-power-devicekit.c => tracker-power-upower.c} | 28 +++++-----
src/miners/fs/tracker-miner-files.c | 16 +++---
4 files changed, 54 insertions(+), 55 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a90af4a..fd87b9d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -139,7 +139,7 @@ GTK_REQUIRED=2.18.0
LIBXML2_REQUIRED=2.6
LIBNOTIFY_REQUIRED=0.4.3
HAL_REQUIRED=0.5
-DEVKIT_POWER_REQUIRED=007
+UPOWER_REQUIRED=0.9.0
GDKPIXBUF_REQUIRED=2.12.0
QUILL_REQUIRED=1.0.0
UNAC_REQUIRED=1.0.0
@@ -398,36 +398,36 @@ fi
##################################################################
-# Check for DeviceKit-power
+# Check for UPower
##################################################################
-AC_ARG_ENABLE(devkit_power,
- AS_HELP_STRING([--disable-devkit-power],
- [disable DeviceKit-power support for AC power detection [[default=auto]]]),,
- [enable_devkit_power=auto])
-
-if test "x$enable_devkit_power" != "xno"; then
- PKG_CHECK_MODULES(DEVKIT_POWER,
- [devkit-power-gobject >= $DEVKIT_POWER_REQUIRED],
- [have_devkit_power=yes] ,
- [have_devkit_power=no])
- AC_SUBST(DEVKIT_POWER_CFLAGS)
- AC_SUBST(DEVKIT_POWER_LIBS)
-
- if test "x$have_devkit_power" = "xyes"; then
- AC_DEFINE(HAVE_DEVKIT_POWER, [], [Define if we have DEVKIT_POWER])
+AC_ARG_ENABLE(upower,
+ AS_HELP_STRING([--disable-upower],
+ [disable UPower support for AC power detection [[default=auto]]]),,
+ [enable_upower=auto])
+
+if test "x$enable_upower" != "xno"; then
+ PKG_CHECK_MODULES(UPOWER,
+ [upower-glib >= $UPOWER_REQUIRED],
+ [have_upower=yes] ,
+ [have_upower=no])
+ AC_SUBST(UPOWER_CFLAGS)
+ AC_SUBST(UPOWER_LIBS)
+
+ if test "x$have_upower" = "xyes"; then
+ AC_DEFINE(HAVE_UPOWER, [], [Define if we have UPOWER])
fi
else
- have_devkit_power="no (disabled)"
+ have_upower="no (disabled)"
fi
-if test "x$enable_devkit_power" = "xyes"; then
- if test "x$have_devkit_power" != "xyes"; then
- AC_MSG_ERROR([Couldn't find devkit_power >= $DEVKIT_POWER_REQUIRED.])
+if test "x$enable_upower" = "xyes"; then
+ if test "x$have_upower" != "xyes"; then
+ AC_MSG_ERROR([Couldn't find upower >= $UPOWER_REQUIRED.])
fi
fi
-AM_CONDITIONAL(HAVE_DEVKIT_POWER, test "x$have_devkit_power" = "xyes")
+AM_CONDITIONAL(HAVE_UPOWER, test "x$have_upower" = "xyes")
##################################################################
# Check for HAL
@@ -438,7 +438,7 @@ AC_ARG_ENABLE(hal,
[disable HAL support for AC power detection [[default=auto]]]),,
[enable_hal=auto])
-if test "x$have_devkit_power" != "xyes" && test "x$enable_hal" != "xno"; then
+if test "x$have_upower" != "xyes" && test "x$enable_hal" != "xno"; then
PKG_CHECK_MODULES(HAL,
[hal >= $HAL_REQUIRED],
[have_hal=yes] ,
@@ -454,8 +454,8 @@ else
fi
if test "x$enable_hal" = "xyes"; then
- if test "x$have_devkit_power" = "xyes"; then
- AC_MSG_ERROR([Only one of DeviceKit-power and HAL can be used.])
+ if test "x$have_upower" = "xyes"; then
+ AC_MSG_ERROR([Only one of UPower and HAL can be used.])
elif test "x$have_hal" != "xyes"; then
AC_MSG_ERROR([Couldn't find hal >= $HAL_REQUIRED.])
fi
@@ -1749,8 +1749,8 @@ Build Configuration:
Enable unit tests: $have_unit_tests
Support for ioprio: $tracker_cv_have_ioprio
- Support for HAL: $have_hal
- Support for DeviceKit-power: $have_devkit_power
+ Support for HAL: $have_hal
+ Support for UPower: $have_upower
Support for file monitoring: $have_file_monitor
Support for accent stripping (unac): $have_unac
Support for Cyrillic languages (enca): $have_enca
diff --git a/src/libtracker-common/Makefile.am b/src/libtracker-common/Makefile.am
index 5a3d33e..555fcff 100644
--- a/src/libtracker-common/Makefile.am
+++ b/src/libtracker-common/Makefile.am
@@ -4,14 +4,13 @@ INCLUDES = \
-DSHAREDIR=\""$(datadir)"\" \
-DG_LOG_DOMAIN=\"Tracker\" \
-DTRACKER_COMPILATION \
- -DI_KNOW_THE_DEVICEKIT_POWER_API_IS_SUBJECT_TO_CHANGE \
-I$(top_srcdir)/src \
$(WARN_CFLAGS) \
$(GLIB2_CFLAGS) \
$(GCOV_CFLAGS) \
$(GIO_CFLAGS) \
$(HAL_CFLAGS) \
- $(DEVKIT_POWER_CFLAGS) \
+ $(UPOWER_CFLAGS) \
$(DBUS_CFLAGS)
libtracker_commondir = $(libdir)/tracker-$(TRACKER_API_VERSION)
@@ -23,12 +22,12 @@ else
os_sources = tracker-os-dependant-unix.c
endif
-# Prefer DeviceKit-power for the power data if it's available, else fall back to HAL
-if HAVE_DEVKIT_POWER
+# Prefer UPower for the power data if it's available, else fall back to HAL
+if HAVE_UPOWER
power_headers = \
tracker-power.h
power_sources = \
- tracker-power-devicekit.c
+ tracker-power-upower.c
else
if HAVE_HAL
power_headers = \
@@ -77,7 +76,7 @@ libtracker_common_la_LDFLAGS = \
libtracker_common_la_LIBADD = \
$(top_builddir)/src/libstemmer/libstemmer.la \
$(HAL_LIBS) \
- $(DEVKIT_POWER_LIBS) \
+ $(UPOWER_LIBS) \
$(DBUS_LIBS) \
$(GIO_LIBS) \
$(GCOV_LIBS) \
diff --git a/src/libtracker-common/tracker-power-devicekit.c b/src/libtracker-common/tracker-power-upower.c
similarity index 90%
rename from src/libtracker-common/tracker-power-devicekit.c
rename to src/libtracker-common/tracker-power-upower.c
index 4022302..8a1b71e 100644
--- a/src/libtracker-common/tracker-power-devicekit.c
+++ b/src/libtracker-common/tracker-power-upower.c
@@ -20,16 +20,16 @@
#include "config.h"
-#ifdef HAVE_DEVKIT_POWER
+#ifdef HAVE_UPOWER
-#include <devkit-power-gobject/devicekit-power.h>
+#include <upower.h>
#include "tracker-power.h"
#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TRACKER_TYPE_POWER, TrackerPowerPriv))
typedef struct {
- DkpClient *client;
+ UpClient *client;
gboolean on_battery;
gboolean on_low_battery;
} TrackerPowerPriv;
@@ -39,7 +39,7 @@ static void tracker_power_get_property (GObject *object,
guint param_id,
GValue *value,
GParamSpec *pspec);
-static void tracker_power_client_changed_cb (DkpClient *client,
+static void tracker_power_client_changed_cb (UpClient *client,
TrackerPower *power);
enum {
@@ -94,18 +94,18 @@ tracker_power_init (TrackerPower *power)
{
TrackerPowerPriv *priv;
- g_message ("Initializing DeviceKit-power...");
+ g_message ("Initializing UPower...");
priv = GET_PRIV (power);
- /* connect to a DeviceKit-power instance */
- priv->client = dkp_client_new ();
+ /* connect to a UPower instance */
+ priv->client = up_client_new ();
g_signal_connect (priv->client, "changed",
G_CALLBACK (tracker_power_client_changed_cb), power);
/* coldplug */
- priv->on_battery = dkp_client_on_battery (priv->client);
- priv->on_low_battery = dkp_client_on_low_battery (priv->client);
+ priv->on_battery = up_client_get_on_battery (priv->client);
+ priv->on_low_battery = up_client_get_on_low_battery (priv->client);
}
static void
@@ -147,7 +147,7 @@ tracker_power_get_property (GObject *object,
* tracker_power_client_changed_cb:
**/
static void
-tracker_power_client_changed_cb (DkpClient *client, TrackerPower *power)
+tracker_power_client_changed_cb (UpClient *client, TrackerPower *power)
{
gboolean on_battery;
gboolean on_low_battery;
@@ -156,14 +156,14 @@ tracker_power_client_changed_cb (DkpClient *client, TrackerPower *power)
priv = GET_PRIV (power);
/* get the on-battery state */
- on_battery = dkp_client_on_battery (priv->client);
+ on_battery = up_client_get_on_battery (priv->client);
if (on_battery != priv->on_battery) {
priv->on_battery = on_battery;
g_object_notify (G_OBJECT (power), "on-battery");
}
/* get the on-low-battery state */
- on_low_battery = dkp_client_on_low_battery (priv->client);
+ on_low_battery = up_client_get_on_low_battery (priv->client);
if (on_low_battery != priv->on_low_battery) {
priv->on_low_battery = on_low_battery;
g_object_notify (G_OBJECT (power), "on-low-battery");
@@ -184,7 +184,7 @@ tracker_power_new ()
}
/**
- * tracker_hal_get_on_battery:
+ * tracker_power_get_on_battery:
* @power: A #TrackerPower.
*
* Returns whether the computer battery (if any) is currently in use.
@@ -244,4 +244,4 @@ tracker_power_get_battery_percentage (TrackerPower *power)
return 0.5;
}
-#endif /* HAVE_DEVKIT_POWER */
+#endif /* HAVE_UPOWER */
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index 62950e4..c38d56d 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -206,7 +206,7 @@ tracker_miner_files_init (TrackerMinerFiles *mf)
G_CALLBACK (mount_point_removed_cb),
mf);
-#if defined(HAVE_DEVKIT_POWER) || defined(HAVE_HAL)
+#if defined(HAVE_UPOWER) || defined(HAVE_HAL)
priv->power = tracker_power_new ();
g_signal_connect (priv->power, "notify::on-low-battery",
@@ -215,7 +215,7 @@ tracker_miner_files_init (TrackerMinerFiles *mf)
g_signal_connect (priv->power, "notify::on-battery",
G_CALLBACK (battery_status_cb),
mf);
-#endif /* defined(HAVE_DEVKIT_POWER) || defined(HAVE_HAL) */
+#endif /* defined(HAVE_UPOWER) || defined(HAVE_HAL) */
priv->volume_monitor = g_volume_monitor_get ();
g_signal_connect (priv->volume_monitor, "mount-pre-unmount",
@@ -300,9 +300,9 @@ miner_files_finalize (GObject *object)
g_slist_free (priv->index_single_directories);
}
-#if defined(HAVE_DEVKIT_POWER) || defined(HAVE_HAL)
+#if defined(HAVE_UPOWER) || defined(HAVE_HAL)
g_object_unref (priv->power);
-#endif /* defined(HAVE_DEVKIT_POWER) || defined(HAVE_HAL) */
+#endif /* defined(HAVE_UPOWER) || defined(HAVE_HAL) */
g_object_unref (priv->storage);
@@ -352,9 +352,9 @@ miner_files_constructed (GObject *object)
mounts = tracker_storage_get_device_roots (mf->private->storage, type, TRUE);
-#if defined(HAVE_DEVKIT_POWER) || defined(HAVE_HAL)
+#if defined(HAVE_UPOWER) || defined(HAVE_HAL)
check_battery_status (mf);
-#endif /* defined(HAVE_DEVKIT_POWER) || defined(HAVE_HAL) */
+#endif /* defined(HAVE_UPOWER) || defined(HAVE_HAL) */
g_message ("Setting up directories to iterate from config (IndexSingleDirectory)");
@@ -851,7 +851,7 @@ mount_point_added_cb (TrackerStorage *storage,
g_free (urn);
}
-#if defined(HAVE_DEVKIT_POWER) || defined(HAVE_HAL)
+#if defined(HAVE_UPOWER) || defined(HAVE_HAL)
static void
set_up_throttle (TrackerMinerFiles *mf,
@@ -929,7 +929,7 @@ battery_status_cb (GObject *object,
check_battery_status (mf);
}
-#endif /* defined(HAVE_DEVKIT_POWER) || defined(HAVE_HAL) */
+#endif /* defined(HAVE_UPOWER) || defined(HAVE_HAL) */
static void
mount_pre_unmount_cb (GVolumeMonitor *volume_monitor,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]