summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2010-08-31 19:45:49 +0100
committerRichard Hughes <richard@hughsie.com>2010-08-31 19:45:49 +0100
commita20798dc9c27f42d0ccce3b6a7b964b59b5d02e2 (patch)
treef40e85a2699fb8513e64ef3153c76cbb54c0feaf
parent4a53c56a913b002d4f7e23b3379ccb134ed454db (diff)
Remove devkit-power-gobject
-rw-r--r--Makefile.am4
-rw-r--r--configure.ac3
-rw-r--r--devkit-power-gobject.pc.in13
-rw-r--r--devkit-power-gobject/.gitignore14
-rw-r--r--devkit-power-gobject/Makefile.am76
-rw-r--r--devkit-power-gobject/devicekit-power.h44
-rw-r--r--devkit-power-gobject/dkp-client.c758
-rw-r--r--devkit-power-gobject/dkp-client.h94
-rw-r--r--devkit-power-gobject/dkp-device.c1172
-rw-r--r--devkit-power-gobject/dkp-device.h90
-rw-r--r--devkit-power-gobject/dkp-enum.c230
-rw-r--r--devkit-power-gobject/dkp-enum.h87
-rw-r--r--devkit-power-gobject/dkp-history-obj.c171
-rw-r--r--devkit-power-gobject/dkp-history-obj.h64
-rw-r--r--devkit-power-gobject/dkp-qos-obj.c105
-rw-r--r--devkit-power-gobject/dkp-qos-obj.h59
-rw-r--r--devkit-power-gobject/dkp-stats-obj.c119
-rw-r--r--devkit-power-gobject/dkp-stats-obj.h54
-rw-r--r--devkit-power-gobject/dkp-version.h.in37
-rw-r--r--devkit-power-gobject/dkp-wakeups-obj.c103
-rw-r--r--devkit-power-gobject/dkp-wakeups-obj.h57
-rw-r--r--devkit-power-gobject/dkp-wakeups.c350
-rw-r--r--devkit-power-gobject/dkp-wakeups.h72
l---------devkit-power-gobject/up-client.h1
l---------devkit-power-gobject/up-device.h1
l---------devkit-power-gobject/up-history-obj.h1
l---------devkit-power-gobject/up-qos-obj.h1
l---------devkit-power-gobject/up-stats-obj.h1
-rw-r--r--devkit-power-gobject/up-wakeups-obj.h57
l---------devkit-power-gobject/up-wakeups.h1
30 files changed, 2 insertions, 3837 deletions
diff --git a/Makefile.am b/Makefile.am
index 5eb2250..3cafba3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,7 @@
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = etc devkit-power-gobject libupower-glib src doc tools policy po
+SUBDIRS = etc libupower-glib src doc tools policy po
if BACKEND_TYPE_LINUX
SUBDIRS += rules
@@ -33,7 +33,7 @@ snapshot:
$(MAKE) dist distdir=$(PACKAGE)-$(VERSION)-`date +"%Y%m%d"`
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = devkit-power-gobject.pc upower-glib.pc
+pkgconfig_DATA = upower-glib.pc
# xsltproc barfs on 'make distcheck'; disable for now
DISTCHECK_CONFIGURE_FLAGS=--disable-man-pages --enable-gtk-doc --enable-introspection
diff --git a/configure.ac b/configure.ac
index a9461f7..d727e72 100644
--- a/configure.ac
+++ b/configure.ac
@@ -225,7 +225,6 @@ AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
AC_CONFIG_FILES([
Makefile
-devkit-power-gobject.pc
upower-glib.pc
etc/Makefile
src/Makefile
@@ -239,8 +238,6 @@ doc/man/Makefile
doc/dbus/Makefile
policy/Makefile
rules/Makefile
-devkit-power-gobject/Makefile
-devkit-power-gobject/dkp-version.h
libupower-glib/Makefile
libupower-glib/up-version.h
po/Makefile.in
diff --git a/devkit-power-gobject.pc.in b/devkit-power-gobject.pc.in
deleted file mode 100644
index b1aa3fb..0000000
--- a/devkit-power-gobject.pc.in
+++ /dev/null
@@ -1,13 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: devkit-power-gobject
-Description: DeviceKit-power is a system daemon for installing stuff.
-Version: 015
-Requires.private: dbus-1, gthread-2.0
-Requires: glib-2.0, gobject-2.0
-Libs: -L${libdir} -ldevkit-power-gobject
-Cflags: -I${includedir}/DeviceKit-power
-
diff --git a/devkit-power-gobject/.gitignore b/devkit-power-gobject/.gitignore
deleted file mode 100644
index 8eb6524..0000000
--- a/devkit-power-gobject/.gitignore
+++ /dev/null
@@ -1,14 +0,0 @@
-.deps
-.libs
-*.o
-*.la
-*.lo
-*-marshal.c
-*-marshal.h
-*.gcov
-*.gcda
-*.gcno
-dkp-version.h
-*.gir
-*.typelib
-
diff --git a/devkit-power-gobject/Makefile.am b/devkit-power-gobject/Makefile.am
deleted file mode 100644
index 5e22f1f..0000000
--- a/devkit-power-gobject/Makefile.am
+++ /dev/null
@@ -1,76 +0,0 @@
-INCLUDES = \
- $(GLIB_CFLAGS) \
- $(DBUS_GLIB_CFLAGS) \
- -I$(top_srcdir) \
- -I$(top_srcdir)/devkit-power-gobject \
- -DUP_COMPILATION \
- -DG_LOG_DOMAIN=\"devkit-power-gobject\" \
- -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
- -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
-
-lib_LTLIBRARIES = \
- libdevkit-power-gobject.la
-
-libdevkit_power_includedir = $(includedir)/DeviceKit-power/devkit-power-gobject
-libdevkit_power_include_HEADERS = \
- devicekit-power.h \
- dkp-version.h \
- dkp-client.h \
- dkp-device.h \
- dkp-wakeups.h \
- dkp-qos-obj.h \
- dkp-history-obj.h \
- dkp-stats-obj.h \
- dkp-wakeups-obj.h \
- dkp-enum.h
-
-libdevkit_power_gobject_la_SOURCES = \
- devicekit-power.h \
- dkp-version.h \
- dkp-client.c \
- dkp-client.h \
- dkp-device.c \
- dkp-device.h \
- dkp-wakeups.c \
- dkp-wakeups.h \
- dkp-qos-obj.c \
- dkp-qos-obj.h \
- dkp-history-obj.c \
- dkp-history-obj.h \
- dkp-stats-obj.c \
- dkp-stats-obj.h \
- dkp-wakeups-obj.c \
- dkp-wakeups-obj.h \
- dkp-enum.c \
- dkp-enum.h
-
-libdevkit_power_gobject_la_LIBADD = \
- $(INTLLIBS) \
- $(GLIB_LIBS) \
- $(DBUS_GLIB_LIBS)
-
-libdevkit_power_gobject_la_LDFLAGS = \
- -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
- -export-dynamic \
- -no-undefined \
- -export-symbols-regex '^dkp_.*'
-
-libdevkit_power_gobject_la_CFLAGS = \
- $(WARNINGFLAGS_C) \
- $(NULL)
-
-EXTRA_DIST = \
- up-client.h \
- up-device.h \
- up-history-obj.h \
- up-qos-obj.h \
- up-stats-obj.h \
- up-wakeups-obj.h \
- up-wakeups.h \
- dkp-version.h.in
-
-CLEANFILES = $(BUILT_SOURCES)
-
-clean-local:
- rm -f *~
-
diff --git a/devkit-power-gobject/devicekit-power.h b/devkit-power-gobject/devicekit-power.h
deleted file mode 100644
index 6eeb457..0000000
--- a/devkit-power-gobject/devicekit-power.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008 Richard Hughes <richard@hughsie.com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef I_KNOW_THE_DEVICEKIT_POWER_API_IS_SUBJECT_TO_CHANGE
-#error You have to define I_KNOW_THE_DEVICEKIT_POWER_API_IS_SUBJECT_TO_CHANGE
-#endif
-
-#ifndef __DEVICEKIT_POWER_H__
-#define __DEVICEKIT_POWER_H__
-
-#define __UPOWER_H_INSIDE__
-
-#include <devkit-power-gobject/dkp-version.h>
-#include <devkit-power-gobject/dkp-client.h>
-#include <devkit-power-gobject/dkp-device.h>
-#include <devkit-power-gobject/dkp-enum.h>
-#include <devkit-power-gobject/dkp-history-obj.h>
-#include <devkit-power-gobject/dkp-qos-obj.h>
-#include <devkit-power-gobject/dkp-stats-obj.h>
-#include <devkit-power-gobject/dkp-wakeups.h>
-#include <devkit-power-gobject/dkp-wakeups-obj.h>
-
-#undef __UPOWER_H_INSIDE__
-
-#endif /* __DEVICEKIT_POWER_H__ */
-
diff --git a/devkit-power-gobject/dkp-client.c b/devkit-power-gobject/dkp-client.c
deleted file mode 100644
index 3b26a0e..0000000
--- a/devkit-power-gobject/dkp-client.c
+++ /dev/null
@@ -1,758 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008 Richard Hughes <richard@hughsie.com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <glib.h>
-#include <dbus/dbus-glib.h>
-
-#include "dkp-client.h"
-#include "dkp-device.h"
-
-static void dkp_client_class_init (DkpClientClass *klass);
-static void dkp_client_init (DkpClient *client);
-static void dkp_client_finalize (GObject *object);
-
-#define DKP_CLIENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DKP_TYPE_CLIENT, DkpClientPrivate))
-
-struct DkpClientPrivate
-{
- DBusGConnection *bus;
- DBusGProxy *proxy;
- DBusGProxy *prop_proxy;
- GHashTable *hash;
-
- gboolean have_properties;
-
- gchar *daemon_version;
- gboolean can_suspend;
- gboolean can_hibernate;
- gboolean lid_is_closed;
- gboolean on_battery;
- gboolean on_low_battery;
- gboolean lid_is_present;
-};
-
-enum {
- DKP_DEVICE_ADDED,
- DKP_DEVICE_CHANGED,
- DKP_DEVICE_REMOVED,
- DKP_CLIENT_CHANGED,
- DKP_CLIENT_LAST_SIGNAL
-};
-
-enum {
- PROP_0,
- PROP_DAEMON_VERSION,
- PROP_CAN_SUSPEND,
- PROP_CAN_HIBERNATE,
- PROP_ON_BATTERY,
- PROP_ON_LOW_BATTERY,
- PROP_LID_IS_CLOSED,
- PROP_LID_IS_PRESENT,
- PROP_LAST
-};
-
-static guint signals [DKP_CLIENT_LAST_SIGNAL] = { 0 };
-static gpointer dkp_client_object = NULL;
-
-G_DEFINE_TYPE (DkpClient, dkp_client, G_TYPE_OBJECT)
-
-/**
- * dkp_client_get_device:
- **/
-static DkpDevice *
-dkp_client_get_device (DkpClient *client, const gchar *object_path)
-{
- DkpDevice *device;
- device = g_hash_table_lookup (client->priv->hash, object_path);
- return device;
-}
-
-/**
- * dkp_client_enumerate_devices:
- *
- * Return a list of devices, which need to be unref'd, and the array needs
- * to be freed
- **/
-GPtrArray *
-dkp_client_enumerate_devices (DkpClient *client, GError **error)
-{
- guint i;
- GPtrArray *array;
- DkpDevice *device;
- GList *list;
- guint len;
-
- array = g_ptr_array_new ();
-
- list = g_hash_table_get_values (client->priv->hash);
-
- len = g_list_length (list);
- for (i=0; i < len; i++) {
- device = g_list_nth_data (list, i);
- g_ptr_array_add (array, g_object_ref (device));
- }
- if (list != NULL)
- g_list_free (list);
-
- return array;
-}
-
-/**
- * dkp_client_enumerate_devices_private:
- **/
-static GPtrArray *
-dkp_client_enumerate_devices_private (DkpClient *client, GError **error)
-{
- gboolean ret;
- GError *error_local = NULL;
- GPtrArray *devices = NULL;
- GType g_type_array;
-
- if (!client->priv->proxy)
- return NULL;
- g_type_array = dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_OBJECT_PATH);
- ret = dbus_g_proxy_call (client->priv->proxy, "EnumerateDevices", &error_local,
- G_TYPE_INVALID,
- g_type_array, &devices,
- G_TYPE_INVALID);
- if (!ret) {
- g_warning ("Couldn't enumerate devices: %s", error_local->message);
- g_set_error (error, 1, 0, "%s", error_local->message);
- g_error_free (error_local);
- }
- return devices;
-}
-
-/**
- * dkp_client_suspend:
- * @client : a #DkpClient instance.
- * @error : a #GError.
- *
- * Puts the computer into a low power state, but state is not preserved if the
- * power is lost.
- *
- * NOTE: The system is still consuming a small amount of power
- *
- * Return value: TRUE if system suspended okay, FALSE other wise.
- **/
-gboolean
-dkp_client_suspend (DkpClient *client, GError **error)
-{
- gboolean ret;
- GError *error_local = NULL;
-
- g_return_val_if_fail (DKP_IS_CLIENT (client), FALSE);
- g_return_val_if_fail (client->priv->proxy != NULL, FALSE);
-
- ret = dbus_g_proxy_call (client->priv->proxy, "Suspend", &error_local,
- G_TYPE_INVALID, G_TYPE_INVALID);
- if (!ret) {
- /* DBus might time out, which is okay */
- if (g_error_matches (error_local, DBUS_GERROR, DBUS_GERROR_NO_REPLY)) {
- g_debug ("DBUS timed out, but recovering");
- ret = TRUE;
- goto out;
- }
-
- /* an actual error */
- g_warning ("Couldn't suspend: %s", error_local->message);
- g_set_error (error, 1, 0, "%s", error_local->message);
- }
-out:
- if (error_local != NULL)
- g_error_free (error_local);
- return ret;
-}
-
-/**
- * dkp_client_hibernate:
- * @client : a #DkpClient instance.
- * @error : a #GError.
- *
- * Puts the computer into a low power state, where state is preserved if the
- * power is lost.
- *
- * Return value: TRUE if system suspended okay, FALSE other wise.
- **/
-gboolean
-dkp_client_hibernate (DkpClient *client, GError **error)
-{
- gboolean ret;
- GError *error_local = NULL;
-
- g_return_val_if_fail (DKP_IS_CLIENT (client), FALSE);
- g_return_val_if_fail (client->priv->proxy != NULL, FALSE);
-
- ret = dbus_g_proxy_call (client->priv->proxy, "Hibernate", &error_local,
- G_TYPE_INVALID, G_TYPE_INVALID);
- if (!ret) {
- /* DBus might time out, which is okay */
- if (g_error_matches (error_local, DBUS_GERROR, DBUS_GERROR_NO_REPLY)) {
- g_debug ("DBUS timed out, but recovering");
- ret = TRUE;
- goto out;
- }
-
- /* an actual error */
- g_warning ("Couldn't hibernate: %s", error_local->message);
- g_set_error (error, 1, 0, "%s", error_local->message);
- }
-out:
- if (error_local != NULL)
- g_error_free (error_local);
- return ret;
-}
-
-/**
- * dkp_client_ensure_properties:
- **/
-static void
-dkp_client_ensure_properties (DkpClient *client)
-{
- gboolean ret;
- gboolean allowed = FALSE;
- GError *error;
- GHashTable *props;
- GValue *value;
-
- props = NULL;
-
- if (client->priv->have_properties)
- goto out;
- if (!client->priv->prop_proxy)
- goto out;
-
- error = NULL;
- ret = dbus_g_proxy_call (client->priv->prop_proxy, "GetAll", &error,
- G_TYPE_STRING, "org.freedesktop.UPower",
- G_TYPE_INVALID,
- dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &props,
- G_TYPE_INVALID);
- if (!ret) {
- g_warning ("Error invoking GetAll() to get properties: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
- value = g_hash_table_lookup (props, "DaemonVersion");
- if (value == NULL) {
- g_warning ("No 'DaemonVersion' property");
- goto out;
- }
- client->priv->daemon_version = g_strdup (g_value_get_string (value));
-
- value = g_hash_table_lookup (props, "CanSuspend");
- if (value == NULL) {
- g_warning ("No 'CanSuspend' property");
- goto out;
- }
-
- ret = dbus_g_proxy_call (client->priv->proxy, "SuspendAllowed", &error,
- G_TYPE_INVALID, G_TYPE_BOOLEAN, &allowed, G_TYPE_INVALID);
- if (!ret)
- goto out;
-
- ret = g_value_get_boolean (value) && allowed;
- if (ret != client->priv->can_suspend) {
- client->priv->can_suspend = ret;
- g_object_notify (G_OBJECT(client), "can-suspend");
- }
-
- value = g_hash_table_lookup (props, "CanHibernate");
- if (value == NULL) {
- g_warning ("No 'CanHibernate' property");
- goto out;
- }
- ret = dbus_g_proxy_call (client->priv->proxy, "HibernateAllowed", &error,
- G_TYPE_INVALID, G_TYPE_BOOLEAN, &allowed, G_TYPE_INVALID);
- if (!ret)
- goto out;
-
- ret = g_value_get_boolean (value) && allowed;
- if (ret != client->priv->can_hibernate) {
- client->priv->can_hibernate = ret;
- g_object_notify (G_OBJECT(client), "can-hibernate");
- }
-
- value = g_hash_table_lookup (props, "LidIsClosed");
- if (value == NULL) {
- g_warning ("No 'LidIsClosed' property");
- goto out;
- }
- ret = g_value_get_boolean (value);
- if (ret != client->priv->lid_is_closed) {
- client->priv->lid_is_closed = ret;
- g_object_notify (G_OBJECT(client), "lid-is-closed");
- }
-
- value = g_hash_table_lookup (props, "OnBattery");
- if (value == NULL) {
- g_warning ("No 'OnBattery' property");
- goto out;
- }
- ret = g_value_get_boolean (value);
- if (ret != client->priv->on_battery) {
- client->priv->on_battery = ret;
- g_object_notify (G_OBJECT(client), "on-battery");
- }
-
- value = g_hash_table_lookup (props, "OnLowBattery");
- if (value == NULL) {
- g_warning ("No 'OnLowBattery' property");
- goto out;
- }
- ret = g_value_get_boolean (value);
- if (ret != client->priv->on_low_battery) {
- client->priv->on_low_battery = ret;
- g_object_notify (G_OBJECT(client), "on-low-battery");
- }
-
- value = g_hash_table_lookup (props, "LidIsPresent");
- if (value == NULL) {
- g_warning ("No 'LidIsPresent' property");
- goto out;
- }
- ret = g_value_get_boolean (value);
- if (ret != client->priv->lid_is_present) {
- client->priv->lid_is_present = ret;
- g_object_notify (G_OBJECT(client), "lid-is-present");
- }
-
- /* cached */
- client->priv->have_properties = TRUE;
-
-out:
- if (props != NULL)
- g_hash_table_unref (props);
-}
-
-#ifndef UP_DISABLE_DEPRECATED
-/**
- * dkp_client_get_daemon_version:
- * @client : a #DkpClient instance.
- *
- * Get DeviceKit-power daemon version.
- *
- * Return value: string containing the daemon version, e.g. 008
- **/
-const gchar *
-dkp_client_get_daemon_version (DkpClient *client)
-{
- g_return_val_if_fail (DKP_IS_CLIENT (client), NULL);
- dkp_client_ensure_properties (client);
- return client->priv->daemon_version;
-}
-
-/**
- * dkp_client_can_hibernate:
- * @client : a #DkpClient instance.
- *
- * Get whether the system is able to hibernate.
- *
- * Return value: TRUE if system can hibernate, FALSE other wise.
- **/
-gboolean
-dkp_client_can_hibernate (DkpClient *client)
-{
- g_return_val_if_fail (DKP_IS_CLIENT (client), FALSE);
- dkp_client_ensure_properties (client);
- return client->priv->can_hibernate;
-}
-
-/**
- * dkp_client_lid_is_closed:
- * @client : a #DkpClient instance.
- *
- * Get whether the laptop lid is closed.
- *
- * Return value: %TRUE if lid is closed or %FALSE otherwise.
- */
-gboolean
-dkp_client_lid_is_closed (DkpClient *client)
-{
- g_return_val_if_fail (DKP_IS_CLIENT (client), FALSE);
- dkp_client_ensure_properties (client);
- return client->priv->lid_is_closed;
-}
-
-/**
- * dkp_client_can_suspend:
- * @client : a #DkpClient instance.
- *
- * Get whether the system is able to suspend.
- *
- * Return value: TRUE if system can suspend, FALSE other wise.
- **/
-gboolean
-dkp_client_can_suspend (DkpClient *client)
-{
- g_return_val_if_fail (DKP_IS_CLIENT (client), FALSE);
- dkp_client_ensure_properties (client);
- return client->priv->can_suspend;
-}
-
-/**
- * dkp_client_on_battery:
- * @client : a #DkpClient instance.
- *
- * Get whether the system is running on battery power.
- *
- * Return value: TRUE if the system is currently running on battery, FALSE other wise.
- **/
-gboolean
-dkp_client_on_battery (DkpClient *client)
-{
- g_return_val_if_fail (DKP_IS_CLIENT (client), FALSE);
- dkp_client_ensure_properties (client);
- return client->priv->on_battery;
-}
-
-/**
- * dkp_client_on_low_battery:
- * @client : a #DkpClient instance.
- *
- * Get whether the system is running on low battery power.
- *
- * Return value: TRUE if the system is currently on low battery power, FALSE other wise.
- **/
-gboolean
-dkp_client_on_low_battery (DkpClient *client)
-{
- g_return_val_if_fail (DKP_IS_CLIENT (client), FALSE);
- dkp_client_ensure_properties (client);
- return client->priv->on_low_battery;
-}
-#endif
-
-/**
- * dkp_client_add:
- **/
-static DkpDevice *
-dkp_client_add (DkpClient *client, const gchar *object_path)
-{
- DkpDevice *device;
-
- /* create new device */
- device = dkp_device_new ();
- dkp_device_set_object_path (device, object_path, NULL);
-
- g_hash_table_insert (client->priv->hash, g_strdup (object_path), device);
- return device;
-}
-
-/**
- * dkp_client_added_cb:
- **/
-static void
-dkp_device_added_cb (DBusGProxy *proxy, const gchar *object_path, DkpClient *client)
-{
- DkpDevice *device;
-
- /* create new device */
- device = dkp_client_add (client, object_path);
- g_signal_emit (client, signals [DKP_DEVICE_ADDED], 0, device);
-}
-
-/**
- * dkp_client_changed_cb:
- **/
-static void
-dkp_device_changed_cb (DBusGProxy *proxy, const gchar *object_path, DkpClient *client)
-{
- DkpDevice *device;
- device = dkp_client_get_device (client, object_path);
- if (device != NULL)
- g_signal_emit (client, signals [DKP_DEVICE_CHANGED], 0, device);
-}
-
-/**
- * dkp_client_removed_cb:
- **/
-static void
-dkp_device_removed_cb (DBusGProxy *proxy, const gchar *object_path, DkpClient *client)
-{
- DkpDevice *device;
- device = dkp_client_get_device (client, object_path);
- if (device != NULL)
- g_signal_emit (client, signals [DKP_DEVICE_REMOVED], 0, device);
- g_hash_table_remove (client->priv->hash, dkp_device_get_object_path (device));
-}
-
-/**
- * dkp_client_changed_cb:
- **/
-static void
-dkp_client_changed_cb (DBusGProxy *proxy, DkpClient *client)
-{
- client->priv->have_properties = FALSE;
- g_signal_emit (client, signals [DKP_CLIENT_CHANGED], 0);
-}
-
-static void
-dkp_client_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- DkpClient *client;
- client = DKP_CLIENT (object);
-
- dkp_client_ensure_properties (client);
-
- switch (prop_id) {
- case PROP_DAEMON_VERSION:
- g_value_set_string (value, client->priv->daemon_version);
- break;
- case PROP_CAN_SUSPEND:
- g_value_set_boolean (value, client->priv->can_suspend);
- break;
- case PROP_CAN_HIBERNATE:
- g_value_set_boolean (value, client->priv->can_hibernate);
- break;
- case PROP_ON_BATTERY:
- g_value_set_boolean (value, client->priv->on_battery);
- break;
- case PROP_ON_LOW_BATTERY:
- g_value_set_boolean (value, client->priv->on_low_battery);
- break;
- case PROP_LID_IS_CLOSED:
- g_value_set_boolean (value, client->priv->lid_is_closed);
- break;
- case PROP_LID_IS_PRESENT:
- g_value_set_boolean (value, client->priv->lid_is_present);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/**
- * dkp_client_class_init:
- * @klass: The DkpClientClass
- **/
-static void
-dkp_client_class_init (DkpClientClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->get_property = dkp_client_get_property;
- object_class->finalize = dkp_client_finalize;
-
- g_object_class_install_property (object_class,
- PROP_DAEMON_VERSION,
- g_param_spec_string ("daemon-version",
- NULL, NULL,
- NULL,
- G_PARAM_READABLE));
-
- g_object_class_install_property (object_class,
- PROP_CAN_SUSPEND,
- g_param_spec_boolean ("can-suspend",
- NULL, NULL,
- FALSE,
- G_PARAM_READABLE));
-
- g_object_class_install_property (object_class,
- PROP_CAN_HIBERNATE,
- g_param_spec_boolean ("can-hibernate",
- NULL, NULL,
- FALSE,
- G_PARAM_READABLE));
-
- g_object_class_install_property (object_class,
- PROP_ON_BATTERY,
- g_param_spec_boolean ("on-battery",
- NULL, NULL,
- FALSE,
- G_PARAM_READABLE));
-
- g_object_class_install_property (object_class,
- PROP_ON_LOW_BATTERY,
- g_param_spec_boolean ("on-low-battery",
- NULL, NULL,
- FALSE,
- G_PARAM_READABLE));
-
- g_object_class_install_property (object_class,
- PROP_LID_IS_CLOSED,
- g_param_spec_boolean ("lid-is-closed",
- NULL, NULL,
- FALSE,
- G_PARAM_READABLE));
-
- g_object_class_install_property (object_class,
- PROP_LID_IS_PRESENT,
- g_param_spec_boolean ("lid-is-present",
- NULL, NULL,
- FALSE,
- G_PARAM_READABLE));
-
- signals [DKP_DEVICE_ADDED] =
- g_signal_new ("device-added",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (DkpClientClass, device_added),
- NULL, NULL, g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
- signals [DKP_DEVICE_REMOVED] =
- g_signal_new ("device-removed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (DkpClientClass, device_removed),
- NULL, NULL, g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
- signals [DKP_DEVICE_CHANGED] =
- g_signal_new ("device-changed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (DkpClientClass, device_changed),
- NULL, NULL, g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
- signals [DKP_CLIENT_CHANGED] =
- g_signal_new ("changed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (DkpClientClass, changed),
- NULL, NULL, g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- g_type_class_add_private (klass, sizeof (DkpClientPrivate));
-}
-
-/**
- * dkp_client_init:
- * @client: This class instance
- **/
-static void
-dkp_client_init (DkpClient *client)
-{
- GError *error = NULL;
- const gchar *object_path;
- GPtrArray *devices;
- guint i;
-
- client->priv = DKP_CLIENT_GET_PRIVATE (client);
- client->priv->hash = g_hash_table_new_full (g_str_hash, g_str_equal,
- g_free, g_object_unref);
- client->priv->have_properties = FALSE;
-
- /* get on the bus */
- client->priv->bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
- if (client->priv->bus == NULL) {
- g_warning ("Couldn't connect to system bus: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
- /* connect to main interface */
- client->priv->proxy = dbus_g_proxy_new_for_name (client->priv->bus,
- "org.freedesktop.UPower",
- "/org/freedesktop/UPower",
- "org.freedesktop.UPower");
- if (client->priv->proxy == NULL) {
- g_warning ("Couldn't connect to proxy");
- goto out;
- }
-
- /* connect to properties interface */
- client->priv->prop_proxy = dbus_g_proxy_new_for_name (client->priv->bus,
- "org.freedesktop.UPower",
- "/org/freedesktop/UPower",
- "org.freedesktop.DBus.Properties");
- if (client->priv->prop_proxy == NULL) {
- g_warning ("Couldn't connect to proxy");
- goto out;
- }
-
- dbus_g_proxy_add_signal (client->priv->proxy, "DeviceAdded", G_TYPE_STRING, G_TYPE_INVALID);
- dbus_g_proxy_add_signal (client->priv->proxy, "DeviceRemoved", G_TYPE_STRING, G_TYPE_INVALID);
- dbus_g_proxy_add_signal (client->priv->proxy, "DeviceChanged", G_TYPE_STRING, G_TYPE_INVALID);
- dbus_g_proxy_add_signal (client->priv->proxy, "Changed", G_TYPE_INVALID);
-
- /* all callbacks */
- dbus_g_proxy_connect_signal (client->priv->proxy, "DeviceAdded",
- G_CALLBACK (dkp_device_added_cb), client, NULL);
- dbus_g_proxy_connect_signal (client->priv->proxy, "DeviceRemoved",
- G_CALLBACK (dkp_device_removed_cb), client, NULL);
- dbus_g_proxy_connect_signal (client->priv->proxy, "DeviceChanged",
- G_CALLBACK (dkp_device_changed_cb), client, NULL);
- dbus_g_proxy_connect_signal (client->priv->proxy, "Changed",
- G_CALLBACK (dkp_client_changed_cb), client, NULL);
-
- /* coldplug */
- devices = dkp_client_enumerate_devices_private (client, NULL);
- if (devices == NULL)
- goto out;
- for (i=0; i<devices->len; i++) {
- object_path = (const gchar *) g_ptr_array_index (devices, i);
- dkp_client_add (client, object_path);
- }
-out:
- return;
-}
-
-/**
- * dkp_client_finalize:
- * @object: The object to finalize
- **/
-static void
-dkp_client_finalize (GObject *object)
-{
- DkpClient *client;
-
- g_return_if_fail (DKP_IS_CLIENT (object));
-
- client = DKP_CLIENT (object);
-
- g_hash_table_destroy (client->priv->hash);
-
- if (client->priv->bus)
- dbus_g_connection_unref (client->priv->bus);
-
- if (client->priv->proxy != NULL)
- g_object_unref (client->priv->proxy);
-
- if (client->priv->prop_proxy != NULL)
- g_object_unref (client->priv->prop_proxy);
-
- g_free (client->priv->daemon_version);
-
- G_OBJECT_CLASS (dkp_client_parent_class)->finalize (object);
-}
-
-/**
- * dkp_client_new:
- *
- * Return value: a new DkpClient object.
- **/
-DkpClient *
-dkp_client_new (void)
-{
- if (dkp_client_object != NULL) {
- g_object_ref (dkp_client_object);
- } else {
- dkp_client_object = g_object_new (DKP_TYPE_CLIENT, NULL);
- g_object_add_weak_pointer (dkp_client_object, &dkp_client_object);
- }
- return DKP_CLIENT (dkp_client_object);
-}
-
diff --git a/devkit-power-gobject/dkp-client.h b/devkit-power-gobject/dkp-client.h
deleted file mode 100644
index fef18aa..0000000
--- a/devkit-power-gobject/dkp-client.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008 Richard Hughes <richard@hughsie.com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#if !defined (__UPOWER_H_INSIDE__) && !defined (UP_COMPILATION)
-#error "Only <devicekit-power.h> can be included directly."
-#endif
-
-#ifndef __DKP_CLIENT_H
-#define __DKP_CLIENT_H
-
-#include <glib-object.h>
-#include <devkit-power-gobject/dkp-enum.h>
-#include <devkit-power-gobject/dkp-device.h>
-
-G_BEGIN_DECLS
-
-#define DKP_TYPE_CLIENT (dkp_client_get_type ())
-#define DKP_CLIENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), DKP_TYPE_CLIENT, DkpClient))
-#define DKP_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), DKP_TYPE_CLIENT, DkpClientClass))
-#define DKP_IS_CLIENT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), DKP_TYPE_CLIENT))
-#define DKP_IS_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), DKP_TYPE_CLIENT))
-#define DKP_CLIENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DKP_TYPE_CLIENT, DkpClientClass))
-#define DKP_CLIENT_ERROR (dkp_client_error_quark ())
-#define DKP_CLIENT_TYPE_ERROR (dkp_client_error_get_type ())
-
-typedef struct DkpClientPrivate DkpClientPrivate;
-
-typedef struct
-{
- GObject parent;
- DkpClientPrivate *priv;
-} DkpClient;
-
-typedef struct
-{
- GObjectClass parent_class;
- void (*device_added) (DkpClient *client,
- const DkpDevice *device);
- void (*device_changed) (DkpClient *client,
- const DkpDevice *device);
- void (*device_removed) (DkpClient *client,
- const DkpDevice *device);
- void (*changed) (DkpClient *client);
- /*< private >*/
- /* Padding for future expansion */
- void (*_dkp_client_reserved1) (void);
- void (*_dkp_client_reserved2) (void);
- void (*_dkp_client_reserved3) (void);
- void (*_dkp_client_reserved4) (void);
- void (*_dkp_client_reserved5) (void);
- void (*_dkp_client_reserved6) (void);
- void (*_dkp_client_reserved7) (void);
- void (*_dkp_client_reserved8) (void);
-} DkpClientClass;
-
-GType dkp_client_get_type (void);
-DkpClient *dkp_client_new (void);
-GPtrArray *dkp_client_enumerate_devices (DkpClient *client,
- GError **error);
-gboolean dkp_client_suspend (DkpClient *client,
- GError **error);
-gboolean dkp_client_hibernate (DkpClient *client,
- GError **error);
-#ifndef UP_DISABLE_DEPRECATED
-const gchar *dkp_client_get_daemon_version (DkpClient *client);
-gboolean dkp_client_can_hibernate (DkpClient *client);
-gboolean dkp_client_lid_is_closed (DkpClient *client);
-gboolean dkp_client_can_suspend (DkpClient *client);
-gboolean dkp_client_on_battery (DkpClient *client);
-gboolean dkp_client_on_low_battery (DkpClient *client);
-#endif
-
-G_END_DECLS
-
-#endif /* __DKP_CLIENT_H */
-
diff --git a/devkit-power-gobject/dkp-device.c b/devkit-power-gobject/dkp-device.c
deleted file mode 100644
index 6f1e569..0000000
--- a/devkit-power-gobject/dkp-device.c
+++ /dev/null
@@ -1,1172 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008 Richard Hughes <richard@hughsie.com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <glib.h>
-#include <dbus/dbus-glib.h>
-#include <string.h>
-
-#include "dkp-device.h"
-#include "dkp-stats-obj.h"
-#include "dkp-history-obj.h"
-
-static void dkp_device_class_init (DkpDeviceClass *klass);
-static void dkp_device_init (DkpDevice *device);
-static void dkp_device_finalize (GObject *object);
-
-#define DKP_DEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DKP_TYPE_DEVICE, DkpDevicePrivate))
-
-struct DkpDevicePrivate
-{
- gchar *object_path;
- DBusGConnection *bus;
- DBusGProxy *proxy_device;
- DBusGProxy *proxy_props;
-
- /* properties */
- guint64 update_time;
- gchar *vendor;
- gchar *model;
- gchar *serial;
- gchar *native_path;
- gboolean power_supply;
- gboolean online;
- gboolean is_present;
- gboolean is_rechargeable;
- gboolean has_history;
- gboolean has_statistics;
- DkpDeviceType type;
- DkpDeviceState state;
- DkpDeviceTechnology technology;
- gdouble capacity; /* percent */
- gdouble energy; /* Watt Hours */
- gdouble energy_empty; /* Watt Hours */
- gdouble energy_full; /* Watt Hours */
- gdouble energy_full_design; /* Watt Hours */
- gdouble energy_rate; /* Watts */
- gdouble voltage; /* Volts */
- gint64 time_to_empty; /* seconds */
- gint64 time_to_full; /* seconds */
- gdouble percentage; /* percent */
- gboolean recall_notice;
- gchar *recall_vendor;
- gchar *recall_url;
-};
-
-enum {
- PROP_0,
- PROP_UPDATE_TIME,
- PROP_VENDOR,
- PROP_MODEL,
- PROP_SERIAL,
- PROP_NATIVE_PATH,
- PROP_POWER_SUPPLY,
- PROP_ONLINE,
- PROP_IS_PRESENT,
- PROP_IS_RECHARGEABLE,
- PROP_HAS_HISTORY,
- PROP_HAS_STATISTICS,
- PROP_TYPE,
- PROP_STATE,
- PROP_TECHNOLOGY,
- PROP_CAPACITY,
- PROP_ENERGY,
- PROP_ENERGY_EMPTY,
- PROP_ENERGY_FULL,
- PROP_ENERGY_FULL_DESIGN,
- PROP_ENERGY_RATE,
- PROP_VOLTAGE,
- PROP_TIME_TO_EMPTY,
- PROP_TIME_TO_FULL,
- PROP_PERCENTAGE,
- PROP_RECALL_NOTICE,
- PROP_RECALL_VENDOR,
- PROP_RECALL_URL,
- PROP_LAST
-};
-
-enum {
- DKP_DEVICE_CHANGED,
- DKP_DEVICE_LAST_SIGNAL
-};
-
-static guint signals [DKP_DEVICE_LAST_SIGNAL] = { 0 };
-
-G_DEFINE_TYPE (DkpDevice, dkp_device, G_TYPE_OBJECT)
-
-/**
- * dkp_device_get_device_properties:
- **/
-static GHashTable *
-dkp_device_get_device_properties (DkpDevice *device, GError **error)
-{
- gboolean ret;
- GError *error_local = NULL;
- GHashTable *hash_table = NULL;
-
- ret = dbus_g_proxy_call (device->priv->proxy_props, "GetAll", &error_local,
- G_TYPE_STRING, "org.freedesktop.UPower.Device",
- G_TYPE_INVALID,
- dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE),
- &hash_table,
- G_TYPE_INVALID);
- if (!ret) {
- g_set_error (error, 1, 0, "Couldn't call GetAll() to get properties for %s: %s", device->priv->object_path, error_local->message);
- g_error_free (error_local);
- goto out;
- }
-out:
- return hash_table;
-}
-
-/**
- * dkp_device_collect_props_cb:
- **/
-static void
-dkp_device_collect_props_cb (const char *key, const GValue *value, DkpDevice *device)
-{
- if (g_strcmp0 (key, "NativePath") == 0) {
- g_free (device->priv->native_path);
- device->priv->native_path = g_strdup (g_value_get_string (value));
- } else if (g_strcmp0 (key, "Vendor") == 0) {
- g_free (device->priv->vendor);
- device->priv->vendor = g_strdup (g_value_get_string (value));
- } else if (g_strcmp0 (key, "Model") == 0) {
- g_free (device->priv->model);
- device->priv->model = g_strdup (g_value_get_string (value));
- } else if (g_strcmp0 (key, "Serial") == 0) {
- g_free (device->priv->serial);
- device->priv->serial = g_strdup (g_value_get_string (value));
- } else if (g_strcmp0 (key, "UpdateTime") == 0) {
- device->priv->update_time = g_value_get_uint64 (value);
- } else if (g_strcmp0 (key, "Type") == 0) {
- device->priv->type = g_value_get_uint (value);
- } else if (g_strcmp0 (key, "Online") == 0) {
- device->priv->online = g_value_get_boolean (value);
- } else if (g_strcmp0 (key, "HasHistory") == 0) {
- device->priv->has_history = g_value_get_boolean (value);
- } else if (g_strcmp0 (key, "HasStatistics") == 0) {
- device->priv->has_statistics = g_value_get_boolean (value);
- } else if (g_strcmp0 (key, "Energy") == 0) {
- device->priv->energy = g_value_get_double (value);
- } else if (g_strcmp0 (key, "EnergyEmpty") == 0) {
- device->priv->energy_empty = g_value_get_double (value);
- } else if (g_strcmp0 (key, "EnergyFull") == 0) {
- device->priv->energy_full = g_value_get_double (value);
- } else if (g_strcmp0 (key, "EnergyFullDesign") == 0) {
- device->priv->energy_full_design = g_value_get_double (value);
- } else if (g_strcmp0 (key, "EnergyRate") == 0) {
- device->priv->energy_rate = g_value_get_double (value);
- } else if (g_strcmp0 (key, "Voltage") == 0) {
- device->priv->voltage = g_value_get_double (value);
- } else if (g_strcmp0 (key, "TimeToFull") == 0) {
- device->priv->time_to_full = g_value_get_int64 (value);
- } else if (g_strcmp0 (key, "TimeToEmpty") == 0) {
- device->priv->time_to_empty = g_value_get_int64 (value);
- } else if (g_strcmp0 (key, "Percentage") == 0) {
- device->priv->percentage = g_value_get_double (value);
- } else if (g_strcmp0 (key, "Technology") == 0) {
- device->priv->technology = g_value_get_uint (value);
- } else if (g_strcmp0 (key, "IsPresent") == 0) {
- device->priv->is_present = g_value_get_boolean (value);
- } else if (g_strcmp0 (key, "IsRechargeable") == 0) {
- device->priv->is_rechargeable = g_value_get_boolean (value);
- } else if (g_strcmp0 (key, "PowerSupply") == 0) {
- device->priv->power_supply = g_value_get_boolean (value);
- } else if (g_strcmp0 (key, "Capacity") == 0) {
- device->priv->capacity = g_value_get_double (value);
- } else if (g_strcmp0 (key, "State") == 0) {
- device->priv->state = g_value_get_uint (value);
- } else if (g_strcmp0 (key, "RecallNotice") == 0) {
- device->priv->recall_notice = g_value_get_boolean (value);
- } else if (g_strcmp0 (key, "RecallVendor") == 0) {
- g_free (device->priv->recall_vendor);
- device->priv->recall_vendor = g_strdup (g_value_get_string (value));
- } else if (g_strcmp0 (key, "RecallUrl") == 0) {
- g_free (device->priv->recall_url);
- device->priv->recall_url = g_strdup (g_value_get_string (value));
- } else {
- g_warning ("unhandled property '%s'", key);
- }
-}
-
-/**
- * dkp_device_refresh_internal:
- **/
-static gboolean
-dkp_device_refresh_internal (DkpDevice *device, GError **error)
-{
- GHashTable *hash;
- GError *error_local = NULL;
-
- /* get all the properties */
- hash = dkp_device_get_device_properties (device, &error_local);
- if (hash == NULL) {
- g_set_error (error, 1, 0, "Cannot get device properties for %s: %s", device->priv->object_path, error_local->message);
- g_error_free (error_local);
- return FALSE;
- }
- g_hash_table_foreach (hash, (GHFunc) dkp_device_collect_props_cb, device);
- g_hash_table_unref (hash);
- return TRUE;
-}
-
-/**
- * dkp_device_changed_cb:
- **/
-static void
-dkp_device_changed_cb (DBusGProxy *proxy, DkpDevice *device)
-{
- g_return_if_fail (DKP_IS_DEVICE (device));
- dkp_device_refresh_internal (device, NULL);
- g_signal_emit (device, signals [DKP_DEVICE_CHANGED], 0, NULL); //TODO xxx
-}
-
-/**
- * dkp_device_set_object_path:
- **/
-gboolean
-dkp_device_set_object_path (DkpDevice *device, const gchar *object_path, GError **error)
-{
- GError *error_local = NULL;
- gboolean ret = FALSE;
- DBusGProxy *proxy_device;
- DBusGProxy *proxy_props;
-
- g_return_val_if_fail (DKP_IS_DEVICE (device), FALSE);
-
- if (device->priv->object_path != NULL)
- return FALSE;
- if (object_path == NULL)
- return FALSE;
-
- /* connect to the bus */
- device->priv->bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error_local);
- if (device->priv->bus == NULL) {
- g_set_error (error, 1, 0, "Couldn't connect to system bus: %s", error_local->message);
- g_error_free (error_local);
- goto out;
- }
-
- /* connect to the correct path for properties */
- proxy_props = dbus_g_proxy_new_for_name (device->priv->bus, "org.freedesktop.UPower",
- object_path, "org.freedesktop.DBus.Properties");
- if (proxy_props == NULL) {
- g_set_error_literal (error, 1, 0, "Couldn't connect to proxy");
- goto out;
- }
-
- /* connect to the correct path for all the other methods */
- proxy_device = dbus_g_proxy_new_for_name (device->priv->bus, "org.freedesktop.UPower",
- object_path, "org.freedesktop.UPower.Device");
- if (proxy_device == NULL) {
- g_set_error_literal (error, 1, 0, "Couldn't connect to proxy");
- goto out;
- }
-
- /* listen to Changed */
- dbus_g_proxy_add_signal (proxy_device, "Changed", G_TYPE_INVALID);
- dbus_g_proxy_connect_signal (proxy_device, "Changed",
- G_CALLBACK (dkp_device_changed_cb), device, NULL);
-
- /* yay */
- device->priv->proxy_device = proxy_device;
- device->priv->proxy_props = proxy_props;
- device->priv->object_path = g_strdup (object_path);
-
- /* coldplug */
- ret = dkp_device_refresh_internal (device, &error_local);
- if (!ret) {
- g_set_error (error, 1, 0, "cannot refresh: %s", error_local->message);
- g_error_free (error_local);
- }
-out:
- return ret;
-}
-
-/**
- * dkp_device_get_object_path:
- **/
-const gchar *
-dkp_device_get_object_path (const DkpDevice *device)
-{
- g_return_val_if_fail (DKP_IS_DEVICE (device), NULL);
- return device->priv->object_path;
-}
-
-/**
- * dkp_device_print_history:
- **/
-static gboolean
-dkp_device_print_history (const DkpDevice *device, const gchar *type)
-{
- guint i;
- GPtrArray *array;
- const DkpHistoryObj *obj;
- gboolean ret = FALSE;
-
- /* get a fair chunk of data */
- array = dkp_device_get_history (device, type, 120, 10, NULL);
- if (array == NULL)
- goto out;
-
- /* pretty print */
- g_print (" History (%s):\n", type);
- for (i=0; i<array->len; i++) {
- obj = (const DkpHistoryObj *) g_ptr_array_index (array, i);
- g_print (" %i\t%.3f\t%s\n", obj->time, obj->value, dkp_device_state_to_text (obj->state));
- }
- g_ptr_array_unref (array);
- ret = TRUE;
-out:
- return ret;
-}
-
-/**
- * dkp_device_print_bool_to_text:
- **/
-static const gchar *
-dkp_device_print_bool_to_text (gboolean ret)
-{
- return ret ? "yes" : "no";
-}
-
-/**
- * dkp_device_print_time_to_text:
- **/
-static gchar *
-dkp_device_print_time_to_text (gint seconds)
-{
- gfloat value = seconds;
-
- if (value < 0)
- return g_strdup ("unknown");
- if (value < 60)
- return g_strdup_printf ("%.0f seconds", value);
- value /= 60.0;
- if (value < 60)
- return g_strdup_printf ("%.1f minutes", value);
- value /= 60.0;
- if (value < 60)
- return g_strdup_printf ("%.1f hours", value);
- value /= 24.0;
- return g_strdup_printf ("%.1f days", value);
-}
-
-/**
- * dkp_device_print:
- **/
-gboolean
-dkp_device_print (const DkpDevice *device)
-{
- struct tm *time_tm;
- time_t t;
- gchar time_buf[256];
- gchar *time_str;
-
- g_return_val_if_fail (DKP_IS_DEVICE (device), FALSE);
-
- /* get a human readable time */
- t = (time_t) device->priv->update_time;
- time_tm = localtime (&t);
- strftime (time_buf, sizeof time_buf, "%c", time_tm);
-
- g_print (" native-path: %s\n", device->priv->native_path);
- if (device->priv->vendor != NULL && device->priv->vendor[0] != '\0')
- g_print (" vendor: %s\n", device->priv->vendor);
- if (device->priv->model != NULL && device->priv->model[0] != '\0')
- g_print (" model: %s\n", device->priv->model);
- if (device->priv->serial != NULL && device->priv->serial[0] != '\0')
- g_print (" serial: %s\n", device->priv->serial);
- g_print (" power supply: %s\n", dkp_device_print_bool_to_text (device->priv->power_supply));
- g_print (" updated: %s (%d seconds ago)\n", time_buf, (int) (time (NULL) - device->priv->update_time));
- g_print (" has history: %s\n", dkp_device_print_bool_to_text (device->priv->has_history));
- g_print (" has statistics: %s\n", dkp_device_print_bool_to_text (device->priv->has_statistics));
- g_print (" %s\n", dkp_device_type_to_text (device->priv->type));
-
- if (device->priv->type == DKP_DEVICE_TYPE_BATTERY ||
- device->priv->type == DKP_DEVICE_TYPE_MOUSE ||
- device->priv->type == DKP_DEVICE_TYPE_KEYBOARD ||
- device->priv->type == DKP_DEVICE_TYPE_UPS)
- g_print (" present: %s\n", dkp_device_print_bool_to_text (device->priv->is_present));
- if (device->priv->type == DKP_DEVICE_TYPE_BATTERY ||
- device->priv->type == DKP_DEVICE_TYPE_MOUSE ||
- device->priv->type == DKP_DEVICE_TYPE_KEYBOARD)
- g_print (" rechargeable: %s\n", dkp_device_print_bool_to_text (device->priv->is_rechargeable));
- if (device->priv->type == DKP_DEVICE_TYPE_BATTERY ||
- device->priv->type == DKP_DEVICE_TYPE_MOUSE ||
- device->priv->type == DKP_DEVICE_TYPE_KEYBOARD ||
- device->priv->type == DKP_DEVICE_TYPE_UPS)
- g_print (" state: %s\n", dkp_device_state_to_text (device->priv->state));
- if (device->priv->type == DKP_DEVICE_TYPE_BATTERY) {
- g_print (" energy: %g Wh\n", device->priv->energy);
- g_print (" energy-empty: %g Wh\n", device->priv->energy_empty);
- g_print (" energy-full: %g Wh\n", device->priv->energy_full);
- g_print (" energy-full-design: %g Wh\n", device->priv->energy_full_design);
- }
- if (device->priv->type == DKP_DEVICE_TYPE_BATTERY ||
- device->priv->type == DKP_DEVICE_TYPE_MONITOR)
- g_print (" energy-rate: %g W\n", device->priv->energy_rate);
- if (device->priv->type == DKP_DEVICE_TYPE_UPS ||
- device->priv->type == DKP_DEVICE_TYPE_BATTERY ||
- device->priv->type == DKP_DEVICE_TYPE_MONITOR) {
- if (device->priv->voltage > 0)
- g_print (" voltage: %g V\n", device->priv->voltage);
- }
- if (device->priv->type == DKP_DEVICE_TYPE_BATTERY ||
- device->priv->type == DKP_DEVICE_TYPE_UPS) {
- if (device->priv->time_to_full > 0) {
- time_str = dkp_device_print_time_to_text (device->priv->time_to_full);
- g_print (" time to full: %s\n", time_str);
- g_free (time_str);
- }
- if (device->priv->time_to_empty > 0) {
- time_str = dkp_device_print_time_to_text (device->priv->time_to_empty);
- g_print (" time to empty: %s\n", time_str);
- g_free (time_str);
- }
- }
- if (device->priv->type == DKP_DEVICE_TYPE_BATTERY ||
- device->priv->type == DKP_DEVICE_TYPE_MOUSE ||
- device->priv->type == DKP_DEVICE_TYPE_KEYBOARD ||
- device->priv->type == DKP_DEVICE_TYPE_UPS)
- g_print (" percentage: %g%%\n", device->priv->percentage);
- if (device->priv->type == DKP_DEVICE_TYPE_BATTERY) {
- if (device->priv->capacity > 0)
- g_print (" capacity: %g%%\n", device->priv->capacity);
- }
- if (device->priv->type == DKP_DEVICE_TYPE_BATTERY) {
- if (device->priv->technology != DKP_DEVICE_TECHNOLOGY_UNKNOWN)
- g_print (" technology: %s\n", dkp_device_technology_to_text (device->priv->technology));
- }
- if (device->priv->type == DKP_DEVICE_TYPE_LINE_POWER)
- g_print (" online: %s\n", dkp_device_print_bool_to_text (device->priv->online));
- if (device->priv->type == DKP_DEVICE_TYPE_BATTERY) {
- if (device->priv->recall_notice) {
- g_print (" recall vendor: %s\n", device->priv->recall_vendor);
- g_print (" recall url: %s\n", device->priv->recall_url);
- }
- }
-
- /* if we can, get history */
- if (device->priv->has_history) {
- dkp_device_print_history (device, "charge");
- dkp_device_print_history (device, "rate");
- }
-
- return TRUE;
-}
-
-/**
- * dkp_device_refresh:
- **/
-gboolean
-dkp_device_refresh (DkpDevice *device, GError **error)
-{
- GError *error_local = NULL;
- gboolean ret;
-
- g_return_val_if_fail (DKP_IS_DEVICE (device), FALSE);
- g_return_val_if_fail (device->priv->proxy_device != NULL, FALSE);
-
- /* just refresh the device */
- ret = dbus_g_proxy_call (device->priv->proxy_device, "Refresh", &error_local,
- G_TYPE_INVALID, G_TYPE_INVALID);
- if (!ret) {
- g_set_error (error, 1, 0, "Refresh() on %s failed: %s", device->priv->object_path, error_local->message);
- g_error_free (error_local);
- goto out;
- }
-out:
- return ret;
-}
-
-/**
- * dkp_device_get_history:
- *
- * Returns an array of %DkpHistoryObj's, free with g_ptr_array_unref()
- **/
-GPtrArray *
-dkp_device_get_history (const DkpDevice *device, const gchar *type, guint timespec, guint resolution, GError **error)
-{
- GError *error_local = NULL;
- GType g_type_gvalue_array;
- GPtrArray *gvalue_ptr_array = NULL;
- GValueArray *gva;
- GValue *gv;
- guint i;
- DkpHistoryObj *obj;
- GPtrArray *array = NULL;
- gboolean ret;
-
- g_return_val_if_fail (DKP_IS_DEVICE (device), NULL);
- g_return_val_if_fail (device->priv->proxy_device != NULL, NULL);
-
- g_type_gvalue_array = dbus_g_type_get_collection ("GPtrArray",
- dbus_g_type_get_struct("GValueArray",
- G_TYPE_UINT,
- G_TYPE_DOUBLE,
- G_TYPE_UINT,
- G_TYPE_INVALID));
-
- /* get compound data */
- ret = dbus_g_proxy_call (device->priv->proxy_device, "GetHistory", &error_local,
- G_TYPE_STRING, type,
- G_TYPE_UINT, timespec,
- G_TYPE_UINT, resolution,
- G_TYPE_INVALID,
- g_type_gvalue_array, &gvalue_ptr_array,
- G_TYPE_INVALID);
- if (!ret) {
- g_set_error (error, 1, 0, "GetHistory(%s,%i) on %s failed: %s", type, timespec,
- device->priv->object_path, error_local->message);
- g_error_free (error_local);
- goto out;
- }
-
- /* no data */
- if (gvalue_ptr_array->len == 0) {
- g_set_error_literal (error, 1, 0, "no data");
- goto out;
- }
-
- /* convert */
- array = g_ptr_array_new_with_free_func ((GDestroyNotify) dkp_history_obj_free);
-
- for (i=0; i<gvalue_ptr_array->len; i++) {
- gva = (GValueArray *) g_ptr_array_index (gvalue_ptr_array, i);
- obj = dkp_history_obj_new ();
- /* 0 */
- gv = g_value_array_get_nth (gva, 0);
- obj->time = g_value_get_uint (gv);
- g_value_unset (gv);
- /* 1 */
- gv = g_value_array_get_nth (gva, 1);
- obj->value = g_value_get_double (gv);
- g_value_unset (gv);
- /* 2 */
- gv = g_value_array_get_nth (gva, 2);
- obj->state = g_value_get_uint (gv);
- g_value_unset (gv);
- g_ptr_array_add (array, obj);
- g_value_array_free (gva);
- }
-
-out:
- if (gvalue_ptr_array != NULL)
- g_ptr_array_free (gvalue_ptr_array, TRUE);
- return array;
-}
-
-/**
- * dkp_device_get_statistics:
- *
- * Returns an array of %DkpStatsObj's
- **/
-GPtrArray *
-dkp_device_get_statistics (const DkpDevice *device, const gchar *type, GError **error)
-{
- GError *error_local = NULL;
- GType g_type_gvalue_array;
- GPtrArray *gvalue_ptr_array = NULL;
- GValueArray *gva;
- GValue *gv;
- guint i;
- DkpStatsObj *obj;
- GPtrArray *array = NULL;
- gboolean ret;
-
- g_return_val_if_fail (DKP_IS_DEVICE (device), NULL);
- g_return_val_if_fail (device->priv->proxy_device != NULL, NULL);
-
- g_type_gvalue_array = dbus_g_type_get_collection ("GPtrArray",
- dbus_g_type_get_struct("GValueArray",
- G_TYPE_DOUBLE,
- G_TYPE_DOUBLE,
- G_TYPE_INVALID));
-
- /* get compound data */
- ret = dbus_g_proxy_call (device->priv->proxy_device, "GetStatistics", &error_local,
- G_TYPE_STRING, type,
- G_TYPE_INVALID,
- g_type_gvalue_array, &gvalue_ptr_array,
- G_TYPE_INVALID);
- if (!ret) {
- g_set_error (error, 1, 0, "GetStatistics(%s) on %s failed: %s", type,
- device->priv->object_path, error_local->message);
- g_error_free (error_local);
- goto out;
- }
-
- /* no data */
- if (gvalue_ptr_array->len == 0) {
- g_set_error_literal (error, 1, 0, "no data");
- goto out;
- }
-
- /* convert */
- array = g_ptr_array_new ();
-
- for (i=0; i<gvalue_ptr_array->len; i++) {
- gva = (GValueArray *) g_ptr_array_index (gvalue_ptr_array, i);
- obj = dkp_stats_obj_new ();
- /* 0 */
- gv = g_value_array_get_nth (gva, 0);
- obj->value = g_value_get_double (gv);
- g_value_unset (gv);
- /* 1 */
- gv = g_value_array_get_nth (gva, 1);
- obj->accuracy = g_value_get_double (gv);
- g_value_unset (gv);
- /* 2 */
- g_ptr_array_add (array, obj);
- g_value_array_free (gva);
- }
-out:
- if (gvalue_ptr_array != NULL)
- g_ptr_array_free (gvalue_ptr_array, TRUE);
- return array;
-}
-
-/**
- * dkp_device_set_property:
- **/
-static void
-dkp_device_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- DkpDevice *device = DKP_DEVICE (object);
-
- switch (prop_id) {
- case PROP_NATIVE_PATH:
- g_free (device->priv->native_path);
- device->priv->native_path = g_strdup (g_value_get_string (value));
- break;
- case PROP_VENDOR:
- g_free (device->priv->vendor);
- device->priv->vendor = g_strdup (g_value_get_string (value));
- break;
- case PROP_MODEL:
- g_free (device->priv->model);
- device->priv->model = g_strdup (g_value_get_string (value));
- break;
- case PROP_SERIAL:
- g_free (device->priv->serial);
- device->priv->serial = g_strdup (g_value_get_string (value));
- break;
- case PROP_UPDATE_TIME:
- device->priv->update_time = g_value_get_uint64 (value);
- break;
- case PROP_TYPE:
- device->priv->type = g_value_get_uint (value);
- break;
- case PROP_POWER_SUPPLY:
- device->priv->power_supply = g_value_get_boolean (value);
- break;
- case PROP_ONLINE:
- device->priv->online = g_value_get_boolean (value);
- break;
- case PROP_IS_PRESENT:
- device->priv->is_present = g_value_get_boolean (value);
- break;
- case PROP_IS_RECHARGEABLE:
- device->priv->is_rechargeable = g_value_get_boolean (value);
- break;
- case PROP_HAS_HISTORY:
- device->priv->has_history = g_value_get_boolean (value);
- break;
- case PROP_HAS_STATISTICS:
- device->priv->has_statistics = g_value_get_boolean (value);
- break;
- case PROP_STATE:
- device->priv->state = g_value_get_uint (value);
- break;
- case PROP_CAPACITY:
- device->priv->capacity = g_value_get_double (value);
- break;
- case PROP_ENERGY:
- device->priv->energy = g_value_get_double (value);
- break;
- case PROP_ENERGY_EMPTY:
- device->priv->energy_empty = g_value_get_double (value);
- break;
- case PROP_ENERGY_FULL:
- device->priv->energy_full = g_value_get_double (value);
- break;
- case PROP_ENERGY_FULL_DESIGN:
- device->priv->energy_full_design = g_value_get_double (value);
- break;
- case PROP_ENERGY_RATE:
- device->priv->energy_rate = g_value_get_double (value);
- break;
- case PROP_VOLTAGE:
- device->priv->voltage = g_value_get_double (value);
- break;
- case PROP_TIME_TO_EMPTY:
- device->priv->time_to_empty = g_value_get_int64 (value);
- break;
- case PROP_TIME_TO_FULL:
- device->priv->time_to_full = g_value_get_int64 (value);
- break;
- case PROP_PERCENTAGE:
- device->priv->percentage = g_value_get_double (value);
- break;
- case PROP_TECHNOLOGY:
- device->priv->technology = g_value_get_uint (value);
- break;
- case PROP_RECALL_NOTICE:
- device->priv->recall_notice = g_value_get_boolean (value);
- break;
- case PROP_RECALL_VENDOR:
- g_free (device->priv->recall_vendor);
- device->priv->recall_vendor = g_strdup (g_value_get_string (value));
- break;
- case PROP_RECALL_URL:
- g_free (device->priv->recall_url);
- device->priv->recall_url = g_strdup (g_value_get_string (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/**
- * dkp_device_get_property:
- **/
-static void
-dkp_device_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- DkpDevice *device = DKP_DEVICE (object);
-
- switch (prop_id) {
- case PROP_UPDATE_TIME:
- g_value_set_uint64 (value, device->priv->update_time);
- break;
- case PROP_VENDOR:
- g_value_set_string (value, device->priv->vendor);
- break;
- case PROP_MODEL:
- g_value_set_string (value, device->priv->model);
- break;
- case PROP_SERIAL:
- g_value_set_string (value, device->priv->serial);
- break;
- case PROP_NATIVE_PATH:
- g_value_set_string (value, device->priv->native_path);
- break;
- case PROP_POWER_SUPPLY:
- g_value_set_boolean (value, device->priv->power_supply);
- break;
- case PROP_ONLINE:
- g_value_set_boolean (value, device->priv->online);
- break;
- case PROP_IS_PRESENT:
- g_value_set_boolean (value, device->priv->is_present);
- break;
- case PROP_IS_RECHARGEABLE:
- g_value_set_boolean (value, device->priv->is_rechargeable);
- break;
- case PROP_HAS_HISTORY:
- g_value_set_boolean (value, device->priv->has_history);
- break;
- case PROP_HAS_STATISTICS:
- g_value_set_boolean (value, device->priv->has_statistics);
- break;
- case PROP_TYPE:
- g_value_set_uint (value, device->priv->type);
- break;
- case PROP_STATE:
- g_value_set_uint (value, device->priv->state);
- break;
- case PROP_TECHNOLOGY:
- g_value_set_uint (value, device->priv->technology);
- break;
- case PROP_CAPACITY:
- g_value_set_double (value, device->priv->capacity);
- break;
- case PROP_ENERGY:
- g_value_set_double (value, device->priv->energy);
- break;
- case PROP_ENERGY_EMPTY:
- g_value_set_double (value, device->priv->energy_empty);
- break;
- case PROP_ENERGY_FULL:
- g_value_set_double (value, device->priv->energy_full);
- break;
- case PROP_ENERGY_FULL_DESIGN:
- g_value_set_double (value, device->priv->energy_full_design);
- break;
- case PROP_ENERGY_RATE:
- g_value_set_double (value, device->priv->energy_rate);
- break;
- case PROP_VOLTAGE:
- g_value_set_double (value, device->priv->voltage);
- break;
- case PROP_TIME_TO_EMPTY:
- g_value_set_int64 (value, device->priv->time_to_empty);
- break;
- case PROP_TIME_TO_FULL:
- g_value_set_int64 (value, device->priv->time_to_full);
- break;
- case PROP_PERCENTAGE:
- g_value_set_double (value, device->priv->percentage);
- break;
- case PROP_RECALL_NOTICE:
- g_value_set_boolean (value, device->priv->recall_notice);
- break;
- case PROP_RECALL_VENDOR:
- g_value_set_string (value, device->priv->recall_vendor);
- break;
- case PROP_RECALL_URL:
- g_value_set_string (value, device->priv->recall_url);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/**
- * dkp_device_class_init:
- * @klass: The DkpDeviceClass
- **/
-static void
-dkp_device_class_init (DkpDeviceClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = dkp_device_finalize;
- object_class->set_property = dkp_device_set_property;
- object_class->get_property = dkp_device_get_property;
-
- /**
- * PkClient::changed:
- * @device: the #DkpDevice instance that emitted the signal
- * @obj: the #DkpObject that has changed //TODO
- *
- * The ::changed signal is emitted when the device data has changed.
- **/
- signals [DKP_DEVICE_CHANGED] =
- g_signal_new ("changed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (DkpDeviceClass, changed),
- NULL, NULL, g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
-
- /**
- * DkpDevice:update-time:
- */
- g_object_class_install_property (object_class,
- PROP_UPDATE_TIME,
- g_param_spec_uint64 ("update-time",
- NULL, NULL,
- 0, G_MAXUINT64, 0,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:vendor:
- */
- g_object_class_install_property (object_class,
- PROP_VENDOR,
- g_param_spec_string ("vendor",
- NULL, NULL,
- NULL,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:model:
- */
- g_object_class_install_property (object_class,
- PROP_MODEL,
- g_param_spec_string ("model",
- NULL, NULL,
- NULL,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:serial:
- */
- g_object_class_install_property (object_class,
- PROP_SERIAL,
- g_param_spec_string ("serial",
- NULL, NULL,
- NULL,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:native-path:
- */
- g_object_class_install_property (object_class,
- PROP_NATIVE_PATH,
- g_param_spec_string ("native-path",
- NULL, NULL,
- NULL,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:power-supply:
- */
- g_object_class_install_property (object_class,
- PROP_POWER_SUPPLY,
- g_param_spec_boolean ("power-supply",
- NULL, NULL,
- FALSE,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:online:
- */
- g_object_class_install_property (object_class,
- PROP_ONLINE,
- g_param_spec_boolean ("online",
- NULL, NULL,
- FALSE,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:is-present:
- */
- g_object_class_install_property (object_class,
- PROP_IS_PRESENT,
- g_param_spec_boolean ("is-present",
- NULL, NULL,
- FALSE,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:is-rechargeable:
- */
- g_object_class_install_property (object_class,
- PROP_IS_RECHARGEABLE,
- g_param_spec_boolean ("is-rechargeable",
- NULL, NULL,
- FALSE,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:has-history:
- */
- g_object_class_install_property (object_class,
- PROP_HAS_HISTORY,
- g_param_spec_boolean ("has-history",
- NULL, NULL,
- FALSE,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:has-statistics:
- */
- g_object_class_install_property (object_class,
- PROP_HAS_STATISTICS,
- g_param_spec_boolean ("has-statistics",
- NULL, NULL,
- FALSE,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:type:
- */
- g_object_class_install_property (object_class,
- PROP_TYPE,
- g_param_spec_uint ("type",
- NULL, NULL,
- DKP_DEVICE_TYPE_UNKNOWN,
- DKP_DEVICE_TYPE_LAST,
- DKP_DEVICE_TYPE_UNKNOWN,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:state:
- */
- g_object_class_install_property (object_class,
- PROP_STATE,
- g_param_spec_uint ("state",
- NULL, NULL,
- DKP_DEVICE_STATE_UNKNOWN,
- DKP_DEVICE_STATE_LAST,
- DKP_DEVICE_STATE_UNKNOWN,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:technology:
- */
- g_object_class_install_property (object_class,
- PROP_TECHNOLOGY,
- g_param_spec_uint ("technology",
- NULL, NULL,
- DKP_DEVICE_TECHNOLOGY_UNKNOWN,
- DKP_DEVICE_TECHNOLOGY_LAST,
- DKP_DEVICE_TECHNOLOGY_UNKNOWN,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:capacity:
- */
- g_object_class_install_property (object_class,
- PROP_CAPACITY,
- g_param_spec_double ("capacity", NULL, NULL,
- 0.0, 100.f, 100.0,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:energy:
- */
- g_object_class_install_property (object_class,
- PROP_ENERGY,
- g_param_spec_double ("energy", NULL, NULL,
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:energy-empty:
- */
- g_object_class_install_property (object_class,
- PROP_ENERGY_EMPTY,
- g_param_spec_double ("energy-empty", NULL, NULL,
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:energy-full:
- */
- g_object_class_install_property (object_class,
- PROP_ENERGY_FULL,
- g_param_spec_double ("energy-full", NULL, NULL,
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:energy-full-design:
- */
- g_object_class_install_property (object_class,
- PROP_ENERGY_FULL_DESIGN,
- g_param_spec_double ("energy-full-design", NULL, NULL,
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:energy-rate:
- */
- g_object_class_install_property (object_class,
- PROP_ENERGY_RATE,
- g_param_spec_double ("energy-rate", NULL, NULL,
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:voltage:
- */
- g_object_class_install_property (object_class,
- PROP_VOLTAGE,
- g_param_spec_double ("voltage", NULL, NULL,
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:time-to-empty:
- */
- g_object_class_install_property (object_class,
- PROP_TIME_TO_EMPTY,
- g_param_spec_int64 ("time-to-empty", NULL, NULL,
- 0, G_MAXINT64, 0,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:time-to-full:
- */
- g_object_class_install_property (object_class,
- PROP_TIME_TO_FULL,
- g_param_spec_int64 ("time-to-full", NULL, NULL,
- 0, G_MAXINT64, 0,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:percentage:
- */
- g_object_class_install_property (object_class,
- PROP_PERCENTAGE,
- g_param_spec_double ("percentage", NULL, NULL,
- 0.0, 100.f, 100.0,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:recall-notice:
- */
- g_object_class_install_property (object_class,
- PROP_RECALL_NOTICE,
- g_param_spec_boolean ("recall-notice",
- NULL, NULL,
- FALSE,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:recall-vendor:
- */
- g_object_class_install_property (object_class,
- PROP_RECALL_VENDOR,
- g_param_spec_string ("recall-vendor",
- NULL, NULL,
- NULL,
- G_PARAM_READWRITE));
- /**
- * DkpDevice:recall-url:
- */
- g_object_class_install_property (object_class,
- PROP_RECALL_URL,
- g_param_spec_string ("recall-url",
- NULL, NULL,
- NULL,
- G_PARAM_READWRITE));
-
- g_type_class_add_private (klass, sizeof (DkpDevicePrivate));
-}
-
-/**
- * dkp_device_init:
- * @device: This class instance
- **/
-static void
-dkp_device_init (DkpDevice *device)
-{
- device->priv = DKP_DEVICE_GET_PRIVATE (device);
- device->priv->object_path = NULL;
- device->priv->proxy_device = NULL;
- device->priv->proxy_props = NULL;
-}
-
-/**
- * dkp_device_finalize:
- * @object: The object to finalize
- **/
-static void
-dkp_device_finalize (GObject *object)
-{
- DkpDevice *device;
-
- g_return_if_fail (DKP_IS_DEVICE (object));
-
- device = DKP_DEVICE (object);
-
- g_free (device->priv->object_path);
- g_free (device->priv->vendor);
- g_free (device->priv->model);
- g_free (device->priv->serial);
- g_free (device->priv->native_path);
- g_free (device->priv->recall_vendor);
- g_free (device->priv->recall_url);
- if (device->priv->proxy_device != NULL)
- g_object_unref (device->priv->proxy_device);
- if (device->priv->proxy_props != NULL)
- g_object_unref (device->priv->proxy_props);
-
- G_OBJECT_CLASS (dkp_device_parent_class)->finalize (object);
-}
-
-/**
- * dkp_device_new:
- *
- * Return value: a new DkpDevice object.
- **/
-DkpDevice *
-dkp_device_new (void)
-{
- DkpDevice *device;
- device = g_object_new (DKP_TYPE_DEVICE, NULL);
- return DKP_DEVICE (device);
-}
-
diff --git a/devkit-power-gobject/dkp-device.h b/devkit-power-gobject/dkp-device.h
deleted file mode 100644
index 6bb70ea..0000000
--- a/devkit-power-gobject/dkp-device.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008 Richard Hughes <richard@hughsie.com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#if !defined (__UPOWER_H_INSIDE__) && !defined (UP_COMPILATION)
-#error "Only <devicekit-power.h> can be included directly."
-#endif
-
-#ifndef __DKP_DEVICE_H
-#define __DKP_DEVICE_H
-
-#include <glib-object.h>
-#include <devkit-power-gobject/dkp-enum.h>
-
-G_BEGIN_DECLS
-
-#define DKP_TYPE_DEVICE (dkp_device_get_type ())
-#define DKP_DEVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), DKP_TYPE_DEVICE, DkpDevice))
-#define DKP_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), DKP_TYPE_DEVICE, DkpDeviceClass))
-#define DKP_IS_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), DKP_TYPE_DEVICE))
-#define DKP_IS_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), DKP_TYPE_DEVICE))
-#define DKP_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DKP_TYPE_DEVICE, DkpDeviceClass))
-#define DKP_DEVICE_ERROR (dkp_device_error_quark ())
-#define DKP_DEVICE_TYPE_ERROR (dkp_device_error_get_type ())
-
-typedef struct DkpDevicePrivate DkpDevicePrivate;
-
-typedef struct
-{
- GObject parent;
- DkpDevicePrivate *priv;
-} DkpDevice;
-
-typedef struct
-{
- GObjectClass parent_class;
- void (*changed) (DkpDevice *device,
- gpointer *obj);
- /*< private >*/
- /* Padding for future expansion */
- void (*_dkp_device_reserved1) (void);
- void (*_dkp_device_reserved2) (void);
- void (*_dkp_device_reserved3) (void);
- void (*_dkp_device_reserved4) (void);
- void (*_dkp_device_reserved5) (void);
- void (*_dkp_device_reserved6) (void);
- void (*_dkp_device_reserved7) (void);
- void (*_dkp_device_reserved8) (void);
-} DkpDeviceClass;
-
-GType dkp_device_get_type (void);
-DkpDevice *dkp_device_new (void);
-
-const gchar *dkp_device_get_object_path (const DkpDevice *device);
-gboolean dkp_device_set_object_path (DkpDevice *device,
- const gchar *object_path,
- GError **error);
-gboolean dkp_device_print (const DkpDevice *device);
-gboolean dkp_device_refresh (DkpDevice *device,
- GError **error);
-GPtrArray *dkp_device_get_history (const DkpDevice *device,
- const gchar *type,
- guint timespec,
- guint resolution,
- GError **error);
-GPtrArray *dkp_device_get_statistics (const DkpDevice *device,
- const gchar *type,
- GError **error);
-
-G_END_DECLS
-
-#endif /* __DKP_DEVICE_H */
-
diff --git a/devkit-power-gobject/dkp-enum.c b/devkit-power-gobject/dkp-enum.c
deleted file mode 100644
index 3bb2c54..0000000
--- a/devkit-power-gobject/dkp-enum.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008 David Zeuthen <davidz@redhat.com>
- * Copyright (C) 2008 Richard Hughes <richard@hughsie.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#include <glib.h>
-#include <string.h>
-
-#include "dkp-enum.h"
-
-/**
- * dkp_device_type_to_text:
- **/
-const gchar *
-dkp_device_type_to_text (DkpDeviceType type_enum)
-{
- const gchar *type = NULL;
- switch (type_enum) {
- case DKP_DEVICE_TYPE_LINE_POWER:
- type = "line-power";
- break;
- case DKP_DEVICE_TYPE_BATTERY:
- type = "battery";
- break;
- case DKP_DEVICE_TYPE_UPS:
- type = "ups";
- break;
- case DKP_DEVICE_TYPE_MONITOR:
- type = "monitor";
- break;
- case DKP_DEVICE_TYPE_MOUSE:
- type = "mouse";
- break;
- case DKP_DEVICE_TYPE_KEYBOARD:
- type = "keyboard";
- break;
- case DKP_DEVICE_TYPE_PDA:
- type = "pda";
- break;
- case DKP_DEVICE_TYPE_PHONE:
- type = "phone";
- break;
- default:
- type = "unknown";
- break;
- }
- return type;
-}
-
-/**
- * dkp_device_type_from_text:
- **/
-DkpDeviceType
-dkp_device_type_from_text (const gchar *type)
-{
- if (type == NULL)
- return DKP_DEVICE_TYPE_UNKNOWN;
- if (g_strcmp0 (type, "line-power") == 0)
- return DKP_DEVICE_TYPE_LINE_POWER;
- if (g_strcmp0 (type, "battery") == 0)
- return DKP_DEVICE_TYPE_BATTERY;
- if (g_strcmp0 (type, "ups") == 0)
- return DKP_DEVICE_TYPE_UPS;
- if (g_strcmp0 (type, "monitor") == 0)
- return DKP_DEVICE_TYPE_MONITOR;
- if (g_strcmp0 (type, "mouse") == 0)
- return DKP_DEVICE_TYPE_MOUSE;
- if (g_strcmp0 (type, "keyboard") == 0)
- return DKP_DEVICE_TYPE_KEYBOARD;
- if (g_strcmp0 (type, "pda") == 0)
- return DKP_DEVICE_TYPE_PDA;
- if (g_strcmp0 (type, "phone") == 0)
- return DKP_DEVICE_TYPE_PHONE;
- return DKP_DEVICE_TYPE_UNKNOWN;
-}
-
-/**
- * dkp_device_state_to_text:
- **/
-const gchar *
-dkp_device_state_to_text (DkpDeviceState state_enum)
-{
- const gchar *state = NULL;
- switch (state_enum) {
- case DKP_DEVICE_STATE_CHARGING:
- state = "charging";
- break;
- case DKP_DEVICE_STATE_DISCHARGING:
- state = "discharging";
- break;
- case DKP_DEVICE_STATE_EMPTY:
- state = "empty";
- break;
- case DKP_DEVICE_STATE_FULLY_CHARGED:
- state = "fully-charged";
- break;
- case DKP_DEVICE_STATE_PENDING_CHARGE:
- state = "pending-charge";
- break;
- case DKP_DEVICE_STATE_PENDING_DISCHARGE:
- state = "pending-discharge";
- break;
- default:
- state = "unknown";
- break;
- }
- return state;
-}
-
-/**
- * dkp_device_state_from_text:
- **/
-DkpDeviceState
-dkp_device_state_from_text (const gchar *state)
-{
- if (state == NULL)
- return DKP_DEVICE_STATE_UNKNOWN;
- if (g_strcmp0 (state, "charging") == 0)
- return DKP_DEVICE_STATE_CHARGING;
- if (g_strcmp0 (state, "discharging") == 0)
- return DKP_DEVICE_STATE_DISCHARGING;
- if (g_strcmp0 (state, "empty") == 0)
- return DKP_DEVICE_STATE_EMPTY;
- if (g_strcmp0 (state, "fully-charged") == 0)
- return DKP_DEVICE_STATE_FULLY_CHARGED;
- if (g_strcmp0 (state, "pending-charge") == 0)
- return DKP_DEVICE_STATE_PENDING_CHARGE;
- if (g_strcmp0 (state, "pending-discharge") == 0)
- return DKP_DEVICE_STATE_PENDING_DISCHARGE;
- return DKP_DEVICE_STATE_UNKNOWN;
-}
-
-/**
- * dkp_device_technology_to_text:
- **/
-const gchar *
-dkp_device_technology_to_text (DkpDeviceTechnology technology_enum)
-{
- const gchar *technology = NULL;
- switch (technology_enum) {
- case DKP_DEVICE_TECHNOLOGY_LITHIUM_ION:
- technology = "lithium-ion";
- break;
- case DKP_DEVICE_TECHNOLOGY_LITHIUM_POLYMER:
- technology = "lithium-polymer";
- break;
- case DKP_DEVICE_TECHNOLOGY_LITHIUM_IRON_PHOSPHATE:
- technology = "lithium-iron-phosphate";
- break;
- case DKP_DEVICE_TECHNOLOGY_LEAD_ACID:
- technology = "lead-acid";
- break;
- case DKP_DEVICE_TECHNOLOGY_NICKEL_CADMIUM:
- technology = "nickel-cadmium";
- break;
- case DKP_DEVICE_TECHNOLOGY_NICKEL_METAL_HYDRIDE:
- technology = "nickel-metal-hydride";
- break;
- default:
- technology = "unknown";
- break;
- }
- return technology;
-}
-
-/**
- * dkp_device_technology_from_text:
- **/
-DkpDeviceTechnology
-dkp_device_technology_from_text (const gchar *technology)
-{
- if (technology == NULL)
- return DKP_DEVICE_TECHNOLOGY_UNKNOWN;
- if (g_strcmp0 (technology, "lithium-ion") == 0)
- return DKP_DEVICE_TECHNOLOGY_LITHIUM_ION;
- if (g_strcmp0 (technology, "lithium-polymer") == 0)
- return DKP_DEVICE_TECHNOLOGY_LITHIUM_POLYMER;
- if (g_strcmp0 (technology, "lithium-iron-phosphate") == 0)
- return DKP_DEVICE_TECHNOLOGY_LITHIUM_IRON_PHOSPHATE;
- if (g_strcmp0 (technology, "lead-acid") == 0)
- return DKP_DEVICE_TECHNOLOGY_LEAD_ACID;
- if (g_strcmp0 (technology, "nickel-cadmium") == 0)
- return DKP_DEVICE_TECHNOLOGY_NICKEL_CADMIUM;
- if (g_strcmp0 (technology, "nickel-metal-hydride") == 0)
- return DKP_DEVICE_TECHNOLOGY_NICKEL_METAL_HYDRIDE;
- return DKP_DEVICE_TECHNOLOGY_UNKNOWN;
-}
-
-/**
- * dkp_qos_type_to_text:
- **/
-const gchar *
-dkp_qos_type_to_text (DkpQosType type)
-{
- if (type == DKP_QOS_TYPE_NETWORK)
- return "network";
- if (type == DKP_QOS_TYPE_CPU_DMA)
- return "cpu_dma";
- return NULL;
-}
-
-/**
- * dkp_qos_type_from_text:
- **/
-DkpQosType
-dkp_qos_type_from_text (const gchar *type)
-{
- if (g_strcmp0 (type, "network") == 0)
- return DKP_QOS_TYPE_NETWORK;
- if (g_strcmp0 (type, "cpu_dma") == 0)
- return DKP_QOS_TYPE_CPU_DMA;
- return DKP_QOS_TYPE_UNKNOWN;
-}
-
diff --git a/devkit-power-gobject/dkp-enum.h b/devkit-power-gobject/dkp-enum.h
deleted file mode 100644
index 90b70ce..0000000
--- a/devkit-power-gobject/dkp-enum.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008 David Zeuthen <davidz@redhat.com>
- * Copyright (C) 2008 Richard Hughes <richard@hughsie.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#if !defined (__UPOWER_H_INSIDE__) && !defined (UP_COMPILATION)
-#error "Only <devicekit-power.h> can be included directly."
-#endif
-
-#ifndef __DKP_ENUM_H__
-#define __DKP_ENUM_H__
-
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-typedef enum {
- DKP_DEVICE_TYPE_UNKNOWN,
- DKP_DEVICE_TYPE_LINE_POWER,
- DKP_DEVICE_TYPE_BATTERY,
- DKP_DEVICE_TYPE_UPS,
- DKP_DEVICE_TYPE_MONITOR,
- DKP_DEVICE_TYPE_MOUSE,
- DKP_DEVICE_TYPE_KEYBOARD,
- DKP_DEVICE_TYPE_PDA,
- DKP_DEVICE_TYPE_PHONE,
- DKP_DEVICE_TYPE_LAST
-} DkpDeviceType;
-
-typedef enum {
- DKP_DEVICE_STATE_UNKNOWN,
- DKP_DEVICE_STATE_CHARGING,
- DKP_DEVICE_STATE_DISCHARGING,
- DKP_DEVICE_STATE_EMPTY,
- DKP_DEVICE_STATE_FULLY_CHARGED,
- DKP_DEVICE_STATE_PENDING_CHARGE,
- DKP_DEVICE_STATE_PENDING_DISCHARGE,
- DKP_DEVICE_STATE_LAST
-} DkpDeviceState;
-
-typedef enum {
- DKP_DEVICE_TECHNOLOGY_UNKNOWN,
- DKP_DEVICE_TECHNOLOGY_LITHIUM_ION,
- DKP_DEVICE_TECHNOLOGY_LITHIUM_POLYMER,
- DKP_DEVICE_TECHNOLOGY_LITHIUM_IRON_PHOSPHATE,
- DKP_DEVICE_TECHNOLOGY_LEAD_ACID,
- DKP_DEVICE_TECHNOLOGY_NICKEL_CADMIUM,
- DKP_DEVICE_TECHNOLOGY_NICKEL_METAL_HYDRIDE,
- DKP_DEVICE_TECHNOLOGY_LAST
-} DkpDeviceTechnology;
-
-typedef enum {
- DKP_QOS_TYPE_UNKNOWN,
- DKP_QOS_TYPE_NETWORK,
- DKP_QOS_TYPE_CPU_DMA,
- DKP_QOS_TYPE_LAST
-} DkpQosType;
-
-const gchar *dkp_device_type_to_text (DkpDeviceType type_enum);
-const gchar *dkp_device_state_to_text (DkpDeviceState state_enum);
-const gchar *dkp_device_technology_to_text (DkpDeviceTechnology technology_enum);
-DkpDeviceType dkp_device_type_from_text (const gchar *type);
-DkpDeviceState dkp_device_state_from_text (const gchar *state);
-DkpDeviceTechnology dkp_device_technology_from_text (const gchar *technology);
-const gchar *dkp_qos_type_to_text (DkpQosType type);
-DkpQosType dkp_qos_type_from_text (const gchar *type);
-
-G_END_DECLS
-
-#endif /* __DKP_ENUM_H__ */
-
diff --git a/devkit-power-gobject/dkp-history-obj.c b/devkit-power-gobject/dkp-history-obj.c
deleted file mode 100644
index 021377e..0000000
--- a/devkit-power-gobject/dkp-history-obj.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008 Richard Hughes <richard@hughsie.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#include <glib.h>
-#include <glib-object.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "dkp-enum.h"
-#include "dkp-history-obj.h"
-
-/**
- * dkp_history_obj_clear_internal:
- **/
-static void
-dkp_history_obj_clear_internal (DkpHistoryObj *obj)
-{
- obj->time = 0;
- obj->value = 0.0f;
- obj->state = 0;
-}
-
-/**
- * dkp_history_obj_copy:
- **/
-DkpHistoryObj *
-dkp_history_obj_copy (const DkpHistoryObj *cobj)
-{
- DkpHistoryObj *obj;
- obj = g_new0 (DkpHistoryObj, 1);
- obj->time = cobj->time;
- obj->value = cobj->value;
- obj->state = cobj->state;
- return obj;
-}
-
-/**
- * dkp_history_obj_equal:
- **/
-gboolean
-dkp_history_obj_equal (const DkpHistoryObj *obj1, const DkpHistoryObj *obj2)
-{
- if (obj1->time == obj2->time &&
- obj1->value == obj2->value &&
- obj1->state == obj2->state)
- return TRUE;
- return FALSE;
-}
-
-/**
- * dkp_history_obj_print:
- **/
-gboolean
-dkp_history_obj_print (const DkpHistoryObj *obj)
-{
- g_print ("%i\t%.3f\t%s", obj->time, obj->value, dkp_device_state_to_text (obj->state));
- return TRUE;
-}
-
-/**
- * dkp_history_obj_new:
- **/
-DkpHistoryObj *
-dkp_history_obj_new (void)
-{
- DkpHistoryObj *obj;
- obj = g_new0 (DkpHistoryObj, 1);
- dkp_history_obj_clear_internal (obj);
- return obj;
-}
-
-/**
- * dkp_history_obj_clear:
- **/
-gboolean
-dkp_history_obj_clear (DkpHistoryObj *obj)
-{
- if (obj == NULL)
- return FALSE;
- dkp_history_obj_free (obj);
- dkp_history_obj_clear_internal (obj);
- return TRUE;
-}
-
-/**
- * dkp_history_obj_free:
- **/
-void
-dkp_history_obj_free (DkpHistoryObj *obj)
-{
- if (obj == NULL)
- return;
- g_free (obj);
-}
-
-/**
- * dkp_history_obj_create:
- **/
-DkpHistoryObj *
-dkp_history_obj_create (gdouble value, DkpDeviceState state)
-{
- DkpHistoryObj *obj;
- GTimeVal timeval;
-
- g_get_current_time (&timeval);
- obj = dkp_history_obj_new ();
- obj->time = timeval.tv_sec;
- obj->value = value;
- obj->state = state;
- return obj;
-}
-
-/**
- * dkp_history_obj_from_string:
- **/
-DkpHistoryObj *
-dkp_history_obj_from_string (const gchar *text)
-{
- DkpHistoryObj *obj = NULL;
- gchar **parts = NULL;
- guint length;
-
- if (text == NULL)
- goto out;
-
- /* split by tab */
- parts = g_strsplit (text, "\t", 0);
- length = g_strv_length (parts);
- if (length != 3) {
- g_warning ("invalid string: '%s'", text);
- goto out;
- }
-
- /* parse and create */
- obj = dkp_history_obj_new ();
- obj->time = atoi (parts[0]);
- obj->value = atof (parts[1]);
- obj->state = dkp_device_state_from_text (parts[2]);
-out:
- g_strfreev (parts);
- return obj;
-}
-
-/**
- * dkp_history_obj_to_string:
- **/
-gchar *
-dkp_history_obj_to_string (const DkpHistoryObj *obj)
-{
- if (obj == NULL)
- return NULL;
- return g_strdup_printf ("%i\t%.3f\t%s", obj->time, obj->value, dkp_device_state_to_text (obj->state));
-}
-
diff --git a/devkit-power-gobject/dkp-history-obj.h b/devkit-power-gobject/dkp-history-obj.h
deleted file mode 100644
index ad7a90f..0000000
--- a/devkit-power-gobject/dkp-history-obj.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008 Richard Hughes <richard@hughsie.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#if !defined (__UPOWER_H_INSIDE__) && !defined (UP_COMPILATION)
-#error "Only <devicekit-power.h> can be included directly."
-#endif
-
-#ifndef __DKP_HISTORY_OBJ_H__
-#define __DKP_HISTORY_OBJ_H__
-
-#include <glib.h>
-#include <devkit-power-gobject/dkp-enum.h>
-
-G_BEGIN_DECLS
-
-typedef struct
-{
- guint time;
- gdouble value;
- DkpDeviceState state;
-} DkpHistoryObj;
-
-/* compat */
-typedef DkpHistoryObj UpHistoryObj;
-#define up_history_obj_new dkp_history_obj_new
-#define up_history_obj_create dkp_history_obj_create
-#define up_history_obj_copy dkp_history_obj_copy
-#define up_history_obj_free dkp_history_obj_free
-#define up_history_obj_from_string dkp_history_obj_from_string
-#define up_history_obj_to_string dkp_history_obj_to_string
-
-DkpHistoryObj *dkp_history_obj_new (void);
-gboolean dkp_history_obj_clear (DkpHistoryObj *obj);
-void dkp_history_obj_free (DkpHistoryObj *obj);
-DkpHistoryObj *dkp_history_obj_copy (const DkpHistoryObj *cobj);
-gboolean dkp_history_obj_print (const DkpHistoryObj *obj);
-DkpHistoryObj *dkp_history_obj_create (gdouble value,
- DkpDeviceState state);
-gboolean dkp_history_obj_equal (const DkpHistoryObj *obj1,
- const DkpHistoryObj *obj2);
-DkpHistoryObj *dkp_history_obj_from_string (const gchar *text);
-gchar *dkp_history_obj_to_string (const DkpHistoryObj *obj);
-
-G_END_DECLS
-
-#endif /* __DKP_HISTORY_OBJ_H__ */
-
diff --git a/devkit-power-gobject/dkp-qos-obj.c b/devkit-power-gobject/dkp-qos-obj.c
deleted file mode 100644
index 82fa16c..0000000
--- a/devkit-power-gobject/dkp-qos-obj.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2009 Richard Hughes <richard@hughsie.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#include <glib.h>
-#include <glib-object.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "dkp-enum.h"
-#include "dkp-qos-obj.h"
-
-/**
- * dkp_qos_obj_clear_internal:
- **/
-static void
-dkp_qos_obj_clear_internal (DkpQosObj *obj)
-{
- obj->uid = 0;
- obj->pid = 0;
- obj->sender = NULL; /* only used in the daemon */
- obj->cmdline = NULL;
- obj->cookie = 0;
- obj->timespec = 0;
- obj->persistent = FALSE;
- obj->type = DKP_QOS_TYPE_UNKNOWN;
- obj->value = 0;
-}
-
-/**
- * dkp_qos_obj_copy:
- **/
-DkpQosObj *
-dkp_qos_obj_copy (const DkpQosObj *cobj)
-{
- DkpQosObj *obj;
- obj = g_new0 (DkpQosObj, 1);
- obj->cookie = cobj->cookie;
- return obj;
-}
-
-/**
- * dkp_qos_obj_equal:
- **/
-gboolean
-dkp_qos_obj_equal (const DkpQosObj *obj1, const DkpQosObj *obj2)
-{
- if (obj1->cookie == obj2->cookie)
- return TRUE;
- return FALSE;
-}
-
-/**
- * dkp_qos_obj_print:
- **/
-gboolean
-dkp_qos_obj_print (const DkpQosObj *obj)
-{
- g_print ("cookie:%i\n", obj->cookie);
- return TRUE;
-}
-
-/**
- * dkp_qos_obj_new:
- **/
-DkpQosObj *
-dkp_qos_obj_new (void)
-{
- DkpQosObj *obj;
- obj = g_new0 (DkpQosObj, 1);
- dkp_qos_obj_clear_internal (obj);
- return obj;
-}
-
-/**
- * dkp_qos_obj_free:
- **/
-void
-dkp_qos_obj_free (DkpQosObj *obj)
-{
- if (obj == NULL)
- return;
- g_free (obj->cmdline);
- g_free (obj->sender);
- g_free (obj);
- return;
-}
-
-
diff --git a/devkit-power-gobject/dkp-qos-obj.h b/devkit-power-gobject/dkp-qos-obj.h
deleted file mode 100644
index 3ae6bcc..0000000
--- a/devkit-power-gobject/dkp-qos-obj.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2009 Richard Hughes <richard@hughsie.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#if !defined (__UPOWER_H_INSIDE__) && !defined (UP_COMPILATION)
-#error "Only <devicekit-power.h> can be included directly."
-#endif
-
-#ifndef __DKP_QOS_OBJ_H__
-#define __DKP_QOS_OBJ_H__
-
-#include <glib.h>
-#include <devkit-power-gobject/dkp-enum.h>
-
-G_BEGIN_DECLS
-
-typedef struct
-{
- guint uid;
- guint pid;
- gchar *sender; /* only used in the daemon */
- gchar *cmdline;
- guint cookie;
- guint64 timespec;
- gboolean persistent;
- DkpQosType type;
- gint value;
-} DkpQosObj;
-
-/* compat */
-typedef DkpQosObj UpQosObj;
-
-DkpQosObj *dkp_qos_obj_new (void);
-void dkp_qos_obj_free (DkpQosObj *obj);
-DkpQosObj *dkp_qos_obj_copy (const DkpQosObj *cobj);
-gboolean dkp_qos_obj_print (const DkpQosObj *obj);
-gboolean dkp_qos_obj_equal (const DkpQosObj *obj1,
- const DkpQosObj *obj2);
-
-G_END_DECLS
-
-#endif /* __DKP_QOS_OBJ_H__ */
-
diff --git a/devkit-power-gobject/dkp-stats-obj.c b/devkit-power-gobject/dkp-stats-obj.c
deleted file mode 100644
index 7818f29..0000000
--- a/devkit-power-gobject/dkp-stats-obj.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008 Richard Hughes <richard@hughsie.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#include <glib.h>
-#include <glib-object.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "dkp-stats-obj.h"
-
-/**
- * dkp_stats_obj_copy:
- **/
-DkpStatsObj *
-dkp_stats_obj_copy (const DkpStatsObj *cobj)
-{
- DkpStatsObj *obj;
- obj = g_new0 (DkpStatsObj, 1);
- obj->value = cobj->value;
- obj->accuracy = cobj->accuracy;
- return obj;
-}
-
-/**
- * dkp_stats_obj_new:
- **/
-DkpStatsObj *
-dkp_stats_obj_new (void)
-{
- DkpStatsObj *obj;
- obj = g_new0 (DkpStatsObj, 1);
- obj->value = 0.0f;
- obj->accuracy = 0;
- return obj;
-}
-
-/**
- * dkp_stats_obj_free:
- **/
-gboolean
-dkp_stats_obj_free (DkpStatsObj *obj)
-{
- if (obj == NULL)
- return FALSE;
- g_free (obj);
- return TRUE;
-}
-
-/**
- * dkp_stats_obj_create:
- **/
-DkpStatsObj *
-dkp_stats_obj_create (gdouble value, gdouble accuracy)
-{
- DkpStatsObj *obj;
- obj = dkp_stats_obj_new ();
- obj->value = value;
- obj->accuracy = accuracy;
- return obj;
-}
-
-/**
- * dkp_stats_obj_from_string:
- **/
-DkpStatsObj *
-dkp_stats_obj_from_string (const gchar *text)
-{
- DkpStatsObj *obj = NULL;
- gchar **parts = NULL;
- guint length;
-
- if (text == NULL)
- goto out;
-
- /* split by tab */
- parts = g_strsplit (text, "\t", 0);
- length = g_strv_length (parts);
- if (length != 2) {
- g_warning ("invalid string: '%s'", text);
- goto out;
- }
-
- /* parse and create */
- obj = dkp_stats_obj_new ();
- obj->value = atoi (parts[0]);
- obj->accuracy = atof (parts[1]);
-out:
- g_strfreev (parts);
- return obj;
-}
-
-/**
- * dkp_stats_obj_to_string:
- **/
-gchar *
-dkp_stats_obj_to_string (const DkpStatsObj *obj)
-{
- if (obj == NULL)
- return NULL;
- return g_strdup_printf ("%.2f\t%.2f", obj->value, obj->accuracy);
-}
-
diff --git a/devkit-power-gobject/dkp-stats-obj.h b/devkit-power-gobject/dkp-stats-obj.h
deleted file mode 100644
index 9555712..0000000
--- a/devkit-power-gobject/dkp-stats-obj.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008 Richard Hughes <richard@hughsie.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#if !defined (__UPOWER_H_INSIDE__) && !defined (UP_COMPILATION)
-#error "Only <devicekit-power.h> can be included directly."
-#endif
-
-#ifndef __DKP_STATS_OBJ_H__
-#define __DKP_STATS_OBJ_H__
-
-#include <glib.h>
-#include <devkit-power-gobject/dkp-enum.h>
-
-G_BEGIN_DECLS
-
-typedef struct
-{
- gdouble value;
- gdouble accuracy;
-} DkpStatsObj;
-
-typedef DkpStatsObj UpStatsObj;
-
-#define up_stats_obj_create dkp_stats_obj_create
-
-DkpStatsObj *dkp_stats_obj_new (void);
-gboolean dkp_stats_obj_free (DkpStatsObj *obj);
-DkpStatsObj *dkp_stats_obj_copy (const DkpStatsObj *cobj);
-DkpStatsObj *dkp_stats_obj_create (gdouble value,
- gdouble accuracy);
-DkpStatsObj *dkp_stats_obj_from_string (const gchar *text);
-gchar *dkp_stats_obj_to_string (const DkpStatsObj *obj);
-
-G_END_DECLS
-
-#endif /* __DKP_STATS_OBJ_H__ */
-
diff --git a/devkit-power-gobject/dkp-version.h.in b/devkit-power-gobject/dkp-version.h.in
deleted file mode 100644
index 34fc325..0000000
--- a/devkit-power-gobject/dkp-version.h.in
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2009 Richard Hughes <richard@hughsie.com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#if !defined (__UPOWER_H_INSIDE__) && !defined (UP_COMPILATION)
-#error "Only <devicekit-power.h> can be included directly."
-#endif
-
-#ifndef __DKP_VERSION_H
-#define __DKP_VERSION_H
-
-/* compile time version
- */
-#define DKP_COMPILE_VERSION (0x@VERSION@)
-
-/* check whether a the version is above the compile time version.
- */
-#define DKP_CHECK_VERSION(ver) (1)
-
-#endif /* __DKP_VERSION_H */
diff --git a/devkit-power-gobject/dkp-wakeups-obj.c b/devkit-power-gobject/dkp-wakeups-obj.c
deleted file mode 100644
index a20c800..0000000
--- a/devkit-power-gobject/dkp-wakeups-obj.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2009 Richard Hughes <richard@hughsie.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#include <glib.h>
-#include <glib-object.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "dkp-enum.h"
-#include "dkp-wakeups-obj.h"
-
-/**
- * dkp_wakeups_obj_clear_internal:
- **/
-static void
-dkp_wakeups_obj_clear_internal (DkpWakeupsObj *obj)
-{
- obj->id = 0;
- obj->old = 0;
- obj->value = 0.0f;
- obj->is_userspace = FALSE;
- obj->cmdline = NULL;
- obj->details = NULL;
-}
-
-/**
- * dkp_wakeups_obj_copy:
- **/
-DkpWakeupsObj *
-dkp_wakeups_obj_copy (const DkpWakeupsObj *cobj)
-{
- DkpWakeupsObj *obj;
- obj = g_new0 (DkpWakeupsObj, 1);
- obj->id = cobj->id;
- obj->value = cobj->value;
- obj->is_userspace = cobj->is_userspace;
- return obj;
-}
-
-/**
- * dkp_wakeups_obj_equal:
- **/
-gboolean
-dkp_wakeups_obj_equal (const DkpWakeupsObj *obj1, const DkpWakeupsObj *obj2)
-{
- if (obj1->id == obj2->id)
- return TRUE;
- return FALSE;
-}
-
-/**
- * dkp_wakeups_obj_print:
- **/
-gboolean
-dkp_wakeups_obj_print (const DkpWakeupsObj *obj)
-{
- g_print ("userspace:%i id:%i, interrupts:%.1f, cmdline:%s, details:%s\n", obj->is_userspace, obj->id, obj->value, obj->cmdline, obj->details);
- return TRUE;
-}
-
-/**
- * dkp_wakeups_obj_new:
- **/
-DkpWakeupsObj *
-dkp_wakeups_obj_new (void)
-{
- DkpWakeupsObj *obj;
- obj = g_new0 (DkpWakeupsObj, 1);
- dkp_wakeups_obj_clear_internal (obj);
- return obj;
-}
-
-/**
- * dkp_wakeups_obj_free:
- **/
-void
-dkp_wakeups_obj_free (DkpWakeupsObj *obj)
-{
- if (obj == NULL)
- return;
- g_free (obj->cmdline);
- g_free (obj->details);
- g_free (obj);
- return;
-}
-
diff --git a/devkit-power-gobject/dkp-wakeups-obj.h b/devkit-power-gobject/dkp-wakeups-obj.h
deleted file mode 100644
index 14f90bf..0000000
--- a/devkit-power-gobject/dkp-wakeups-obj.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2009 Richard Hughes <richard@hughsie.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#if !defined (__UPOWER_H_INSIDE__) && !defined (UP_COMPILATION)
-#error "Only <devicekit-power.h> can be included directly."
-#endif
-
-#ifndef __DKP_WAKEUPS_OBJ_H__
-#define __DKP_WAKEUPS_OBJ_H__
-
-#include <glib.h>
-#include <devkit-power-gobject/dkp-enum.h>
-
-G_BEGIN_DECLS
-
-typedef struct
-{
- gboolean is_userspace;
- guint id;
- guint old;
- gfloat value;
- gchar *cmdline;
- gchar *details;
-} DkpWakeupsObj;
-
-typedef DkpWakeupsObj UpWakeupsObj;
-#define up_wakeup_item_free dkp_wakeups_obj_free
-#define up_wakeup_item_new dkp_wakeups_obj_new
-
-DkpWakeupsObj *dkp_wakeups_obj_new (void);
-void dkp_wakeups_obj_free (DkpWakeupsObj *obj);
-DkpWakeupsObj *dkp_wakeups_obj_copy (const DkpWakeupsObj *cobj);
-gboolean dkp_wakeups_obj_print (const DkpWakeupsObj *obj);
-gboolean dkp_wakeups_obj_equal (const DkpWakeupsObj *obj1,
- const DkpWakeupsObj *obj2);
-
-G_END_DECLS
-
-#endif /* __DKP_WAKEUPS_OBJ_H__ */
-
diff --git a/devkit-power-gobject/dkp-wakeups.c b/devkit-power-gobject/dkp-wakeups.c
deleted file mode 100644
index c5950f7..0000000
--- a/devkit-power-gobject/dkp-wakeups.c
+++ /dev/null
@@ -1,350 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2009 Richard Hughes <richard@hughsie.com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <glib.h>
-#include <dbus/dbus-glib.h>
-
-#include "dkp-wakeups.h"
-
-static void dkp_wakeups_class_init (DkpWakeupsClass *klass);
-static void dkp_wakeups_init (DkpWakeups *wakeups);
-static void dkp_wakeups_finalize (GObject *object);
-
-#define DKP_WAKEUPS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DKP_TYPE_WAKEUPS, DkpWakeupsPrivate))
-
-struct DkpWakeupsPrivate
-{
- DBusGConnection *bus;
- DBusGProxy *proxy;
- DBusGProxy *prop_proxy;
- gboolean has_capability;
- gboolean have_properties;
-};
-
-enum {
- DKP_WAKEUPS_DATA_CHANGED,
- DKP_WAKEUPS_TOTAL_CHANGED,
- DKP_WAKEUPS_LAST_SIGNAL
-};
-
-static guint signals [DKP_WAKEUPS_LAST_SIGNAL] = { 0 };
-
-G_DEFINE_TYPE (DkpWakeups, dkp_wakeups, G_TYPE_OBJECT)
-
-/**
- * dkp_wakeups_get_total:
- **/
-guint
-dkp_wakeups_get_total (DkpWakeups *wakeups, GError **error)
-{
- guint total = 0;
- gboolean ret;
- GError *error_local = NULL;
-
- g_return_val_if_fail (DKP_IS_WAKEUPS (wakeups), FALSE);
- g_return_val_if_fail (wakeups->priv->proxy != NULL, FALSE);
-
- ret = dbus_g_proxy_call (wakeups->priv->proxy, "GetTotal", &error_local,
- G_TYPE_INVALID,
- G_TYPE_UINT, &total,
- G_TYPE_INVALID);
- if (!ret) {
- g_warning ("Couldn't get total: %s", error_local->message);
- g_set_error (error, 1, 0, "%s", error_local->message);
- g_error_free (error_local);
- }
- return total;
-}
-
-/**
- * dkp_wakeups_get_data:
- *
- * Returns an array of %DkpWakeupsObj's
- **/
-GPtrArray *
-dkp_wakeups_get_data (DkpWakeups *wakeups, GError **error)
-{
- GError *error_local = NULL;
- GType g_type_gvalue_array;
- GPtrArray *gvalue_ptr_array = NULL;
- GValueArray *gva;
- GValue *gv;
- guint i;
- DkpWakeupsObj *obj;
- GPtrArray *array = NULL;
- gboolean ret;
-
- g_return_val_if_fail (DKP_IS_WAKEUPS (wakeups), NULL);
- g_return_val_if_fail (wakeups->priv->proxy != NULL, NULL);
-
- g_type_gvalue_array = dbus_g_type_get_collection ("GPtrArray",
- dbus_g_type_get_struct("GValueArray",
- G_TYPE_BOOLEAN,
- G_TYPE_UINT,
- G_TYPE_DOUBLE,
- G_TYPE_STRING,
- G_TYPE_STRING,
- G_TYPE_INVALID));
-
- /* get compound data */
- ret = dbus_g_proxy_call (wakeups->priv->proxy, "GetData", &error_local,
- G_TYPE_INVALID,
- g_type_gvalue_array, &gvalue_ptr_array,
- G_TYPE_INVALID);
- if (!ret) {
- g_warning ("GetData on failed: %s", error_local->message);
- g_set_error (error, 1, 0, "%s", error_local->message);
- g_error_free (error_local);
- goto out;
- }
-
- /* no data */
- if (gvalue_ptr_array->len == 0)
- goto out;
-
- /* convert */
- array = g_ptr_array_new ();
- for (i=0; i<gvalue_ptr_array->len; i++) {
- gva = (GValueArray *) g_ptr_array_index (gvalue_ptr_array, i);
- obj = dkp_wakeups_obj_new ();
-
- /* 0 */
- gv = g_value_array_get_nth (gva, 0);
- obj->is_userspace = g_value_get_boolean (gv);
- g_value_unset (gv);
-
- /* 1 */
- gv = g_value_array_get_nth (gva, 1);
- obj->id = g_value_get_uint (gv);
- g_value_unset (gv);
-
- /* 2 */
- gv = g_value_array_get_nth (gva, 2);
- obj->value = g_value_get_double (gv);
- g_value_unset (gv);
-
- /* 3 */
- gv = g_value_array_get_nth (gva, 3);
- obj->cmdline = g_strdup (g_value_get_string (gv));
- g_value_unset (gv);
-
- /* 4 */
- gv = g_value_array_get_nth (gva, 4);
- obj->details = g_strdup (g_value_get_string (gv));
- g_value_unset (gv);
-
- /* add */
- g_ptr_array_add (array, obj);
- g_value_array_free (gva);
- }
-out:
- if (gvalue_ptr_array != NULL)
- g_ptr_array_unref (gvalue_ptr_array);
- return array;
-}
-
-/**
- * dkp_wakeups_ensure_properties:
- **/
-static void
-dkp_wakeups_ensure_properties (DkpWakeups *wakeups)
-{
- gboolean ret;
- GError *error;
- GHashTable *props;
- GValue *value;
-
- props = NULL;
-
- if (wakeups->priv->have_properties)
- goto out;
-
- error = NULL;
- ret = dbus_g_proxy_call (wakeups->priv->prop_proxy, "GetAll", &error,
- G_TYPE_STRING, "org.freedesktop.UPower.Wakeups",
- G_TYPE_INVALID,
- dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &props,
- G_TYPE_INVALID);
- if (!ret) {
- g_warning ("Error invoking GetAll() to get properties: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
- value = g_hash_table_lookup (props, "HasCapability");
- if (value == NULL) {
- g_warning ("No 'HasCapability' property");
- goto out;
- }
- wakeups->priv->has_capability = g_value_get_boolean (value);
-
- /* cached */
- wakeups->priv->have_properties = TRUE;
-
-out:
- if (props != NULL)
- g_hash_table_unref (props);
-}
-
-/**
- * dkp_wakeups_has_capability:
- **/
-gboolean
-dkp_wakeups_has_capability (DkpWakeups *wakeups)
-{
- g_return_val_if_fail (DKP_IS_WAKEUPS (wakeups), FALSE);
- dkp_wakeups_ensure_properties (wakeups);
- return wakeups->priv->has_capability;
-}
-
-/**
- * dkp_wakeups_total_changed_cb:
- **/
-static void
-dkp_wakeups_total_changed_cb (DBusGProxy *proxy, guint value, DkpWakeups *wakeups)
-{
- g_signal_emit (wakeups, signals [DKP_WAKEUPS_TOTAL_CHANGED], 0, value);
-}
-
-/**
- * dkp_wakeups_data_changed_cb:
- **/
-static void
-dkp_wakeups_data_changed_cb (DBusGProxy *proxy, DkpWakeups *wakeups)
-{
- g_signal_emit (wakeups, signals [DKP_WAKEUPS_DATA_CHANGED], 0);
-}
-
-/**
- * dkp_wakeups_class_init:
- * @klass: The DkpWakeupsClass
- **/
-static void
-dkp_wakeups_class_init (DkpWakeupsClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = dkp_wakeups_finalize;
-
- signals [DKP_WAKEUPS_DATA_CHANGED] =
- g_signal_new ("data-changed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (DkpWakeupsClass, data_changed),
- NULL, NULL, g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- signals [DKP_WAKEUPS_TOTAL_CHANGED] =
- g_signal_new ("total-changed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (DkpWakeupsClass, data_changed),
- NULL, NULL, g_cclosure_marshal_VOID__UINT,
- G_TYPE_NONE, 1, G_TYPE_UINT);
-
- g_type_class_add_private (klass, sizeof (DkpWakeupsPrivate));
-}
-
-/**
- * dkp_wakeups_init:
- * @wakeups: This class instance
- **/
-static void
-dkp_wakeups_init (DkpWakeups *wakeups)
-{
- GError *error = NULL;
-
- wakeups->priv = DKP_WAKEUPS_GET_PRIVATE (wakeups);
- wakeups->priv->has_capability = FALSE;
- wakeups->priv->have_properties = FALSE;
-
- /* get on the bus */
- wakeups->priv->bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
- if (wakeups->priv->bus == NULL) {
- g_warning ("Couldn't connect to system bus: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
- /* connect to properties interface */
- wakeups->priv->prop_proxy = dbus_g_proxy_new_for_name (wakeups->priv->bus,
- "org.freedesktop.UPower",
- "/org/freedesktop/UPower/Wakeups",
- "org.freedesktop.DBus.Properties");
- if (wakeups->priv->prop_proxy == NULL) {
- g_warning ("Couldn't connect to proxy");
- goto out;
- }
-
- /* connect to main interface */
- wakeups->priv->proxy = dbus_g_proxy_new_for_name (wakeups->priv->bus,
- "org.freedesktop.UPower",
- "/org/freedesktop/UPower/Wakeups",
- "org.freedesktop.UPower.Wakeups");
- if (wakeups->priv->proxy == NULL) {
- g_warning ("Couldn't connect to proxy");
- goto out;
- }
- dbus_g_proxy_add_signal (wakeups->priv->proxy, "TotalChanged", G_TYPE_UINT, G_TYPE_INVALID);
- dbus_g_proxy_add_signal (wakeups->priv->proxy, "DataChanged", G_TYPE_INVALID);
-
- /* all callbacks */
- dbus_g_proxy_connect_signal (wakeups->priv->proxy, "TotalChanged",
- G_CALLBACK (dkp_wakeups_total_changed_cb), wakeups, NULL);
- dbus_g_proxy_connect_signal (wakeups->priv->proxy, "DataChanged",
- G_CALLBACK (dkp_wakeups_data_changed_cb), wakeups, NULL);
-out:
- return;
-}
-
-/**
- * dkp_wakeups_finalize:
- * @object: The object to finalize
- **/
-static void
-dkp_wakeups_finalize (GObject *object)
-{
- DkpWakeups *wakeups;
-
- g_return_if_fail (DKP_IS_WAKEUPS (object));
-
- wakeups = DKP_WAKEUPS (object);
- if (wakeups->priv->proxy != NULL)
- g_object_unref (wakeups->priv->proxy);
- if (wakeups->priv->prop_proxy != NULL)
- g_object_unref (wakeups->priv->prop_proxy);
-
- G_OBJECT_CLASS (dkp_wakeups_parent_class)->finalize (object);
-}
-
-/**
- * dkp_wakeups_new:
- *
- * Return value: a new DkpWakeups object.
- **/
-DkpWakeups *
-dkp_wakeups_new (void)
-{
- DkpWakeups *wakeups;
- wakeups = g_object_new (DKP_TYPE_WAKEUPS, NULL);
- return DKP_WAKEUPS (wakeups);
-}
-
diff --git a/devkit-power-gobject/dkp-wakeups.h b/devkit-power-gobject/dkp-wakeups.h
deleted file mode 100644
index bca6ecf..0000000
--- a/devkit-power-gobject/dkp-wakeups.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2009 Richard Hughes <richard@hughsie.com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#if !defined (__UPOWER_H_INSIDE__) && !defined (UP_COMPILATION)
-#error "Only <devicekit-power.h> can be included directly."
-#endif
-
-#ifndef __DKP_WAKEUPS_H
-#define __DKP_WAKEUPS_H
-
-#include <glib-object.h>
-#include <devkit-power-gobject/dkp-enum.h>
-#include <devkit-power-gobject/dkp-device.h>
-#include <devkit-power-gobject/dkp-wakeups-obj.h>
-
-G_BEGIN_DECLS
-
-#define DKP_TYPE_WAKEUPS (dkp_wakeups_get_type ())
-#define DKP_WAKEUPS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), DKP_TYPE_WAKEUPS, DkpWakeups))
-#define DKP_WAKEUPS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), DKP_TYPE_WAKEUPS, DkpWakeupsClass))
-#define DKP_IS_WAKEUPS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), DKP_TYPE_WAKEUPS))
-#define DKP_IS_WAKEUPS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), DKP_TYPE_WAKEUPS))
-#define DKP_WAKEUPS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DKP_TYPE_WAKEUPS, DkpWakeupsClass))
-#define DKP_WAKEUPS_ERROR (dkp_wakeups_error_quark ())
-#define DKP_WAKEUPS_TYPE_ERROR (dkp_wakeups_error_get_type ())
-
-typedef struct DkpWakeupsPrivate DkpWakeupsPrivate;
-
-typedef struct
-{
- GObject parent;
- DkpWakeupsPrivate *priv;
-} DkpWakeups;
-
-typedef struct
-{
- GObjectClass parent_class;
- void (*data_changed) (DkpWakeups *wakeups);
- void (*total_changed) (DkpWakeups *wakeups,
- guint value);
-} DkpWakeupsClass;
-
-GType dkp_wakeups_get_type (void);
-DkpWakeups *dkp_wakeups_new (void);
-guint dkp_wakeups_get_total (DkpWakeups *wakeups,
- GError **error);
-GPtrArray *dkp_wakeups_get_data (DkpWakeups *wakeups,
- GError **error);
-gboolean dkp_wakeups_has_capability (DkpWakeups *wakeups);
-
-G_END_DECLS
-
-#endif /* __DKP_WAKEUPS_H */
-
diff --git a/devkit-power-gobject/up-client.h b/devkit-power-gobject/up-client.h
deleted file mode 120000
index 92b51d0..0000000
--- a/devkit-power-gobject/up-client.h
+++ /dev/null
@@ -1 +0,0 @@
-dkp-client.h \ No newline at end of file
diff --git a/devkit-power-gobject/up-device.h b/devkit-power-gobject/up-device.h
deleted file mode 120000
index 3234769..0000000
--- a/devkit-power-gobject/up-device.h
+++ /dev/null
@@ -1 +0,0 @@
-dkp-device.h \ No newline at end of file
diff --git a/devkit-power-gobject/up-history-obj.h b/devkit-power-gobject/up-history-obj.h
deleted file mode 120000
index b686e24..0000000
--- a/devkit-power-gobject/up-history-obj.h
+++ /dev/null
@@ -1 +0,0 @@
-dkp-history-obj.h \ No newline at end of file
diff --git a/devkit-power-gobject/up-qos-obj.h b/devkit-power-gobject/up-qos-obj.h
deleted file mode 120000
index d44eeaf..0000000
--- a/devkit-power-gobject/up-qos-obj.h
+++ /dev/null
@@ -1 +0,0 @@
-dkp-qos-obj.h \ No newline at end of file
diff --git a/devkit-power-gobject/up-stats-obj.h b/devkit-power-gobject/up-stats-obj.h
deleted file mode 120000
index 1b8d1fb..0000000
--- a/devkit-power-gobject/up-stats-obj.h
+++ /dev/null
@@ -1 +0,0 @@
-dkp-stats-obj.h \ No newline at end of file
diff --git a/devkit-power-gobject/up-wakeups-obj.h b/devkit-power-gobject/up-wakeups-obj.h
deleted file mode 100644
index 0119950..0000000
--- a/devkit-power-gobject/up-wakeups-obj.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2009 Richard Hughes <richard@hughsie.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#if !defined (__UPOWER_H_INSIDE__) && !defined (UP_COMPILATION)
-#error "Only <devicekit-power.h> can be included directly."
-#endif
-
-#ifndef __DKP_WAKEUPS_OBJ_H__
-#define __DKP_WAKEUPS_OBJ_H__
-
-#include <glib.h>
-#include <devkit-power-gobject/dkp-enum.h>
-
-G_BEGIN_DECLS
-
-typedef struct
-{
- gboolean is_userspace;
- guint id;
- guint old;
- gfloat value;
- gchar *cmdline;
- gchar *details;
-} DkpWakeupsObj;
-
-typedef DkpWakeupsObj UpWakeupsObj;
-#define up_wakeups_obj_free dkp_wakeups_obj_free
-#define up_wakeups_obj_new dkp_wakeups_obj_new
-
-DkpWakeupsObj *dkp_wakeups_obj_new (void);
-void dkp_wakeups_obj_free (DkpWakeupsObj *obj);
-DkpWakeupsObj *dkp_wakeups_obj_copy (const DkpWakeupsObj *cobj);
-gboolean dkp_wakeups_obj_print (const DkpWakeupsObj *obj);
-gboolean dkp_wakeups_obj_equal (const DkpWakeupsObj *obj1,
- const DkpWakeupsObj *obj2);
-
-G_END_DECLS
-
-#endif /* __DKP_WAKEUPS_OBJ_H__ */
-
diff --git a/devkit-power-gobject/up-wakeups.h b/devkit-power-gobject/up-wakeups.h
deleted file mode 120000
index 66a8fcb..0000000
--- a/devkit-power-gobject/up-wakeups.h
+++ /dev/null
@@ -1 +0,0 @@
-dkp-wakeups.h \ No newline at end of file