summaryrefslogtreecommitdiff
path: root/libupower-glib
diff options
context:
space:
mode:
authorBenjamin Berg <bberg@redhat.com>2022-03-24 16:08:16 +0100
committerBenjamin Berg <bberg@redhat.com>2022-03-24 17:02:27 +0100
commit9058d45685d1c7c08d52fb64c393fed9eeed542b (patch)
tree4edf5610042ef6a734b436ebf6513523646317d4 /libupower-glib
parent1003d5c2a69e6c28dcf68adf10181b5180b5defa (diff)
downloadupower-9058d45685d1c7c08d52fb64c393fed9eeed542b.tar.gz
Remove Wakeups API
The API relied on /proc/timer_stats which has been removed from the kernel in 2017. Since then, the API has been non-functional (yet incorrectly reporting support because the support test was buggy). Just remove it completely. The debian codesearch does not uncover any API users. Also, I doubt that any new API (based on tracing scheduler events as perf would do) would map well to what exists now. i.e. if something like this is re-implemented in UPower or elsewhere, then the API should likely look different. And, realistically, if this does need root privileges (i.e. can't be moved to use BPF programs or so on user units), then we can also create a new small daemon that is launched on-demand just for that.
Diffstat (limited to 'libupower-glib')
-rw-r--r--libupower-glib/meson.build4
-rw-r--r--libupower-glib/up-autocleanups.h2
-rw-r--r--libupower-glib/up-wakeup-item.c452
-rw-r--r--libupower-glib/up-wakeup-item.h78
-rw-r--r--libupower-glib/up-wakeups.c296
-rw-r--r--libupower-glib/up-wakeups.h83
-rw-r--r--libupower-glib/upower.h2
7 files changed, 0 insertions, 917 deletions
diff --git a/libupower-glib/meson.build b/libupower-glib/meson.build
index 2ff7baf..56926d4 100644
--- a/libupower-glib/meson.build
+++ b/libupower-glib/meson.build
@@ -19,10 +19,8 @@ libupower_glib_headers = [
'up-autocleanups.h',
'up-types.h',
'up-device.h',
- 'up-wakeup-item.h',
'up-stats-item.h',
'up-history-item.h',
- 'up-wakeups.h',
'up-client.h',
up_version_h,
]
@@ -30,8 +28,6 @@ libupower_glib_headers = [
libupower_glib_sources = [
'up-types.c',
'up-client.c',
- 'up-wakeups.c',
- 'up-wakeup-item.c',
'up-stats-item.c',
'up-history-item.c',
'up-device.c',
diff --git a/libupower-glib/up-autocleanups.h b/libupower-glib/up-autocleanups.h
index 534ee80..5cbca59 100644
--- a/libupower-glib/up-autocleanups.h
+++ b/libupower-glib/up-autocleanups.h
@@ -32,8 +32,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(UpClient, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(UpDevice, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(UpHistoryItem, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(UpStatsItem, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(UpWakeupItem, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(UpWakeups, g_object_unref)
#endif
diff --git a/libupower-glib/up-wakeup-item.c b/libupower-glib/up-wakeup-item.c
deleted file mode 100644
index 82c7c6f..0000000
--- a/libupower-glib/up-wakeup-item.c
+++ /dev/null
@@ -1,452 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008-2010 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.
- */
-
-/**
- * SECTION:up-wakeup-item
- * @short_description: Helper object representing one item of wakeup data.
- * @see_also: #UpDevice, #UpClient
- *
- * This object represents one item of data which may be returned from the
- * daemon in response to a query.
- */
-
-#include "config.h"
-
-#include <glib.h>
-
-#include "up-wakeup-item.h"
-
-static void up_wakeup_item_class_init (UpWakeupItemClass *klass);
-static void up_wakeup_item_init (UpWakeupItem *wakeup_item);
-static void up_wakeup_item_finalize (GObject *object);
-
-struct UpWakeupItemPrivate
-{
- gboolean is_userspace;
- guint id;
- guint old;
- gdouble value;
- gchar *cmdline;
- gchar *details;
-};
-
-enum {
- PROP_0,
- PROP_IS_USERSPACE,
- PROP_ID,
- PROP_OLD,
- PROP_VALUE,
- PROP_CMDLINE,
- PROP_DETAILS,
- PROP_LAST
-};
-
-G_DEFINE_TYPE_WITH_PRIVATE (UpWakeupItem, up_wakeup_item, G_TYPE_OBJECT)
-
-/**
- * up_wakeup_item_get_is_userspace:
- * @wakeup_item: #UpWakeupItem
- *
- * Gets if the item is userspace.
- *
- * Return value: the value
- *
- * Since: 0.9.0
- **/
-gboolean
-up_wakeup_item_get_is_userspace (UpWakeupItem *wakeup_item)
-{
- g_return_val_if_fail (UP_IS_WAKEUP_ITEM (wakeup_item), FALSE);
- return wakeup_item->priv->is_userspace;
-}
-
-/**
- * up_wakeup_item_set_is_userspace:
- * @wakeup_item: #UpWakeupItem
- * @is_userspace: the new value
- *
- * Sets if the item is userspace.
- *
- * Since: 0.9.0
- **/
-void
-up_wakeup_item_set_is_userspace (UpWakeupItem *wakeup_item, gboolean is_userspace)
-{
- g_return_if_fail (UP_IS_WAKEUP_ITEM (wakeup_item));
- wakeup_item->priv->is_userspace = is_userspace;
- g_object_notify (G_OBJECT(wakeup_item), "is-userspace");
-}
-
-/**
- * up_wakeup_item_get_id:
- * @wakeup_item: #UpWakeupItem
- *
- * Gets the item id.
- *
- * Return value: the value
- *
- * Since: 0.9.0
- **/
-guint
-up_wakeup_item_get_id (UpWakeupItem *wakeup_item)
-{
- g_return_val_if_fail (UP_IS_WAKEUP_ITEM (wakeup_item), G_MAXUINT);
- return wakeup_item->priv->id;
-}
-
-/**
- * up_wakeup_item_set_id:
- * @wakeup_item: #UpWakeupItem
- * @id: the new value
- *
- * Sets the item id.
- *
- * Since: 0.9.0
- **/
-void
-up_wakeup_item_set_id (UpWakeupItem *wakeup_item, guint id)
-{
- g_return_if_fail (UP_IS_WAKEUP_ITEM (wakeup_item));
- wakeup_item->priv->id = id;
- g_object_notify (G_OBJECT(wakeup_item), "id");
-}
-
-/**
- * up_wakeup_item_get_old:
- * @wakeup_item: #UpWakeupItem
- *
- * Gets the item old.
- *
- * Return value: the value
- *
- * Since: 0.9.0
- **/
-guint
-up_wakeup_item_get_old (UpWakeupItem *wakeup_item)
-{
- g_return_val_if_fail (UP_IS_WAKEUP_ITEM (wakeup_item), G_MAXUINT);
- return wakeup_item->priv->old;
-}
-
-/**
- * up_wakeup_item_set_old:
- * @wakeup_item: #UpWakeupItem
- * @old: the new value
- *
- * Sets the item old.
- *
- * Since: 0.9.0
- **/
-void
-up_wakeup_item_set_old (UpWakeupItem *wakeup_item, guint old)
-{
- g_return_if_fail (UP_IS_WAKEUP_ITEM (wakeup_item));
- wakeup_item->priv->old = old;
- g_object_notify (G_OBJECT(wakeup_item), "old");
-}
-
-/**
- * up_wakeup_item_get_value:
- * @wakeup_item: #UpWakeupItem
- *
- * Gets the item value.
- *
- * Return value: the value
- *
- * Since: 0.9.0
- **/
-gdouble
-up_wakeup_item_get_value (UpWakeupItem *wakeup_item)
-{
- g_return_val_if_fail (UP_IS_WAKEUP_ITEM (wakeup_item), G_MAXDOUBLE);
- return wakeup_item->priv->value;
-}
-
-/**
- * up_wakeup_item_set_value:
- * @wakeup_item: #UpWakeupItem
- * @value: the new value
- *
- * Sets the item value.
- *
- * Since: 0.9.0
- **/
-void
-up_wakeup_item_set_value (UpWakeupItem *wakeup_item, gdouble value)
-{
- g_return_if_fail (UP_IS_WAKEUP_ITEM (wakeup_item));
- wakeup_item->priv->value = value;
- g_object_notify (G_OBJECT(wakeup_item), "value");
-}
-
-/**
- * up_wakeup_item_get_cmdline:
- * @wakeup_item: #UpWakeupItem
- *
- * Gets the item cmdline.
- *
- * Return value: the value
- *
- * Since: 0.9.0
- **/
-const gchar *
-up_wakeup_item_get_cmdline (UpWakeupItem *wakeup_item)
-{
- g_return_val_if_fail (UP_IS_WAKEUP_ITEM (wakeup_item), NULL);
- return wakeup_item->priv->cmdline;
-}
-
-/**
- * up_wakeup_item_set_cmdline:
- * @wakeup_item: #UpWakeupItem
- * @cmdline: the new value
- *
- * Sets the item cmdline.
- *
- * Since: 0.9.0
- **/
-void
-up_wakeup_item_set_cmdline (UpWakeupItem *wakeup_item, const gchar *cmdline)
-{
- g_return_if_fail (UP_IS_WAKEUP_ITEM (wakeup_item));
- g_free (wakeup_item->priv->cmdline);
- wakeup_item->priv->cmdline = g_strdup (cmdline);
- g_object_notify (G_OBJECT(wakeup_item), "cmdline");
-}
-
-/**
- * up_wakeup_item_get_details:
- * @wakeup_item: #UpWakeupItem
- *
- * Gets the item details.
- *
- * Return value: the value
- *
- * Since: 0.9.0
- **/
-const gchar *
-up_wakeup_item_get_details (UpWakeupItem *wakeup_item)
-{
- g_return_val_if_fail (UP_IS_WAKEUP_ITEM (wakeup_item), NULL);
- return wakeup_item->priv->details;
-}
-
-/**
- * up_wakeup_item_set_details:
- * @wakeup_item: #UpWakeupItem
- * @details: the new value
- *
- * Sets the item details.
- *
- * Since: 0.9.0
- **/
-void
-up_wakeup_item_set_details (UpWakeupItem *wakeup_item, const gchar *details)
-{
- g_return_if_fail (UP_IS_WAKEUP_ITEM (wakeup_item));
- g_free (wakeup_item->priv->details);
- wakeup_item->priv->details = g_strdup (details);
- g_object_notify (G_OBJECT(wakeup_item), "details");
-}
-
-/**
- * up_wakeup_item_set_property:
- **/
-static void
-up_wakeup_item_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- UpWakeupItem *wakeup_item = UP_WAKEUP_ITEM (object);
-
- switch (prop_id) {
- case PROP_IS_USERSPACE:
- wakeup_item->priv->is_userspace = g_value_get_boolean (value);
- break;
- case PROP_ID:
- wakeup_item->priv->id = g_value_get_uint (value);
- break;
- case PROP_OLD:
- wakeup_item->priv->old = g_value_get_uint (value);
- break;
- case PROP_VALUE:
- wakeup_item->priv->value = g_value_get_double (value);
- break;
- case PROP_CMDLINE:
- g_free (wakeup_item->priv->cmdline);
- wakeup_item->priv->cmdline = g_strdup (g_value_get_string (value));
- break;
- case PROP_DETAILS:
- g_free (wakeup_item->priv->details);
- wakeup_item->priv->details = g_strdup (g_value_get_string (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/**
- * up_wakeup_item_get_property:
- **/
-static void
-up_wakeup_item_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- UpWakeupItem *wakeup_item = UP_WAKEUP_ITEM (object);
-
- switch (prop_id) {
- case PROP_IS_USERSPACE:
- g_value_set_boolean (value, wakeup_item->priv->is_userspace);
- break;
- case PROP_ID:
- g_value_set_uint (value, wakeup_item->priv->id);
- break;
- case PROP_OLD:
- g_value_set_uint (value, wakeup_item->priv->old);
- break;
- case PROP_VALUE:
- g_value_set_double (value, wakeup_item->priv->value);
- break;
- case PROP_CMDLINE:
- g_value_set_string (value, wakeup_item->priv->cmdline);
- break;
- case PROP_DETAILS:
- g_value_set_string (value, wakeup_item->priv->details);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/**
- * up_wakeup_item_class_init:
- * @klass: The UpWakeupItemClass
- **/
-static void
-up_wakeup_item_class_init (UpWakeupItemClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = up_wakeup_item_finalize;
- object_class->set_property = up_wakeup_item_set_property;
- object_class->get_property = up_wakeup_item_get_property;
-
- /**
- * UpWakeupItem:is-userspace:
- *
- * Since: 0.9.0
- **/
- g_object_class_install_property (object_class,
- PROP_IS_USERSPACE,
- g_param_spec_boolean ("is-userspace", NULL, NULL,
- FALSE,
- G_PARAM_READWRITE));
- /**
- * UpWakeupItem:id:
- *
- * Since: 0.9.0
- **/
- g_object_class_install_property (object_class,
- PROP_ID,
- g_param_spec_uint ("id", NULL, NULL,
- 0, G_MAXUINT, 0,
- G_PARAM_READWRITE));
- /**
- * UpWakeupItem:old:
- *
- * Since: 0.9.0
- **/
- g_object_class_install_property (object_class,
- PROP_OLD,
- g_param_spec_uint ("old", NULL, NULL,
- 0, G_MAXUINT, 0,
- G_PARAM_READWRITE));
- /**
- * UpWakeupItem:value:
- *
- * Since: 0.9.0
- **/
- g_object_class_install_property (object_class,
- PROP_VALUE,
- g_param_spec_double ("value", NULL, NULL,
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
- /**
- * UpWakeupItem:cmdline:
- *
- * Since: 0.9.0
- **/
- g_object_class_install_property (object_class,
- PROP_CMDLINE,
- g_param_spec_string ("cmdline", NULL, NULL,
- NULL,
- G_PARAM_READWRITE));
- /**
- * UpWakeupItem:details:
- *
- * Since: 0.9.0
- **/
- g_object_class_install_property (object_class,
- PROP_DETAILS,
- g_param_spec_string ("details", NULL, NULL,
- NULL,
- G_PARAM_READWRITE));
-}
-
-/**
- * up_wakeup_item_init:
- * @wakeup_item: This class instance
- **/
-static void
-up_wakeup_item_init (UpWakeupItem *wakeup_item)
-{
- wakeup_item->priv = up_wakeup_item_get_instance_private (wakeup_item);
-}
-
-/**
- * up_wakeup_item_finalize:
- * @object: The object to finalize
- **/
-static void
-up_wakeup_item_finalize (GObject *object)
-{
- UpWakeupItem *wakeup_item;
-
- g_return_if_fail (UP_IS_WAKEUP_ITEM (object));
-
- wakeup_item = UP_WAKEUP_ITEM (object);
- g_free (wakeup_item->priv->cmdline);
- g_free (wakeup_item->priv->details);
-
- G_OBJECT_CLASS (up_wakeup_item_parent_class)->finalize (object);
-}
-
-/**
- * up_wakeup_item_new:
- *
- * Return value: a new UpWakeupItem object.
- *
- * Since: 0.9.0
- **/
-UpWakeupItem *
-up_wakeup_item_new (void)
-{
- return UP_WAKEUP_ITEM (g_object_new (UP_TYPE_WAKEUP_ITEM, NULL));
-}
-
diff --git a/libupower-glib/up-wakeup-item.h b/libupower-glib/up-wakeup-item.h
deleted file mode 100644
index e0dd6b3..0000000
--- a/libupower-glib/up-wakeup-item.h
+++ /dev/null
@@ -1,78 +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 <upower.h> can be included directly."
-#endif
-
-#ifndef __UP_WAKEUP_ITEM_H
-#define __UP_WAKEUP_ITEM_H
-
-#include <glib-object.h>
-#include <libupower-glib/up-types.h>
-
-G_BEGIN_DECLS
-
-#define UP_TYPE_WAKEUP_ITEM (up_wakeup_item_get_type ())
-#define UP_WAKEUP_ITEM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), UP_TYPE_WAKEUP_ITEM, UpWakeupItem))
-#define UP_WAKEUP_ITEM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), UP_TYPE_WAKEUP_ITEM, UpWakeupItemClass))
-#define UP_IS_WAKEUP_ITEM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), UP_TYPE_WAKEUP_ITEM))
-#define UP_IS_WAKEUP_ITEM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), UP_TYPE_WAKEUP_ITEM))
-#define UP_WAKEUP_ITEM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), UP_TYPE_WAKEUP_ITEM, UpWakeupItemClass))
-
-typedef struct UpWakeupItemPrivate UpWakeupItemPrivate;
-
-typedef struct {
- GObject parent;
- UpWakeupItemPrivate *priv;
-} UpWakeupItem;
-
-typedef struct {
- GObjectClass parent_class;
-} UpWakeupItemClass;
-
-GType up_wakeup_item_get_type (void);
-UpWakeupItem *up_wakeup_item_new (void);
-
-/* accessors */
-gboolean up_wakeup_item_get_is_userspace (UpWakeupItem *wakeup_item);
-void up_wakeup_item_set_is_userspace (UpWakeupItem *wakeup_item,
- gboolean is_userspace);
-guint up_wakeup_item_get_id (UpWakeupItem *wakeup_item);
-void up_wakeup_item_set_id (UpWakeupItem *wakeup_item,
- guint id);
-guint up_wakeup_item_get_old (UpWakeupItem *wakeup_item);
-void up_wakeup_item_set_old (UpWakeupItem *wakeup_item,
- guint old);
-gdouble up_wakeup_item_get_value (UpWakeupItem *wakeup_item);
-void up_wakeup_item_set_value (UpWakeupItem *wakeup_item,
- gdouble value);
-const gchar *up_wakeup_item_get_cmdline (UpWakeupItem *wakeup_item);
-void up_wakeup_item_set_cmdline (UpWakeupItem *wakeup_item,
- const gchar *cmdline);
-const gchar *up_wakeup_item_get_details (UpWakeupItem *wakeup_item);
-void up_wakeup_item_set_details (UpWakeupItem *wakeup_item,
- const gchar *details);
-
-G_END_DECLS
-
-#endif /* __UP_WAKEUP_ITEM_H */
-
diff --git a/libupower-glib/up-wakeups.c b/libupower-glib/up-wakeups.c
deleted file mode 100644
index 20390ee..0000000
--- a/libupower-glib/up-wakeups.c
+++ /dev/null
@@ -1,296 +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <glib-object.h>
-
-#include "up-wakeups.h"
-#include "up-wakeups-generated.h"
-
-static void up_wakeups_class_init (UpWakeupsClass *klass);
-static void up_wakeups_init (UpWakeups *wakeups);
-static void up_wakeups_finalize (GObject *object);
-
-struct UpWakeupsPrivate
-{
- UpExportedWakeups *proxy;
-};
-
-enum {
- UP_WAKEUPS_DATA_CHANGED,
- UP_WAKEUPS_TOTAL_CHANGED,
- UP_WAKEUPS_LAST_SIGNAL
-};
-
-static guint signals [UP_WAKEUPS_LAST_SIGNAL] = { 0 };
-
-G_DEFINE_TYPE_WITH_PRIVATE (UpWakeups, up_wakeups, G_TYPE_OBJECT)
-
-/**
- * up_wakeups_get_total_sync:
- * @wakeups: a #UpWakeups instance.
- * @cancellable: a #GCancellable or %NULL
- * @error: a #GError, or %NULL.
- *
- * Gets the the total number of wakeups per second from the daemon.
- *
- * Return value: number of wakeups per second.
- *
- * Since: 0.9.1
- **/
-guint
-up_wakeups_get_total_sync (UpWakeups *wakeups, GCancellable *cancellable, GError **error)
-{
- guint total = 0;
- gboolean ret;
-
- g_return_val_if_fail (UP_IS_WAKEUPS (wakeups), FALSE);
- g_return_val_if_fail (wakeups->priv->proxy != NULL, FALSE);
-
- ret = up_exported_wakeups_call_get_total_sync (wakeups->priv->proxy, &total,
- cancellable, error);
- if (!ret)
- total = 0;
- return total;
-}
-
-/**
- * up_wakeups_get_data_sync:
- * @wakeups: a #UpWakeups instance.
- * @cancellable: a #GCancellable or %NULL
- * @error: a #GError, or %NULL.
- *
- * Gets the wakeups data from the daemon.
- *
- * Return value: (element-type UpWakeupItem) (transfer full): an array of %UpWakeupItem's
- *
- * Since: 0.9.1
- **/
-GPtrArray *
-up_wakeups_get_data_sync (UpWakeups *wakeups, GCancellable *cancellable, GError **error)
-{
- GError *error_local = NULL;
- GVariant *gva;
- guint i;
- GPtrArray *array = NULL;
- gboolean ret;
- gsize len;
- GVariantIter *iter;
-
- g_return_val_if_fail (UP_IS_WAKEUPS (wakeups), NULL);
- g_return_val_if_fail (wakeups->priv->proxy != NULL, NULL);
-
- /* get compound data */
- ret = up_exported_wakeups_call_get_data_sync (wakeups->priv->proxy,
- &gva,
- NULL,
- &error_local);
-
- 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 */
- iter = g_variant_iter_new (gva);
- len = g_variant_iter_n_children (iter);
- if (len == 0) {
- g_variant_iter_free (iter);
- goto out;
- }
-
- /* convert */
- array = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
- for (i = 0; i < len; i++) {
- UpWakeupItem *obj;
- GVariant *v;
- gboolean is_userspace;
- guint32 id;
- double value;
- char *cmdline;
- char *details;
-
- v = g_variant_iter_next_value (iter);
- g_variant_get (v, "(budss)",
- &is_userspace, &id, &value, &cmdline, &details);
- g_variant_unref (v);
-
- obj = up_wakeup_item_new ();
- up_wakeup_item_set_is_userspace (obj, is_userspace);
- up_wakeup_item_set_id (obj, id);
- up_wakeup_item_set_value (obj, value);
- up_wakeup_item_set_cmdline (obj, cmdline);
- up_wakeup_item_set_details (obj, details);
- g_free (cmdline);
- g_free (details);
-
- g_ptr_array_add (array, obj);
- }
- g_variant_iter_free (iter);
-out:
- g_clear_pointer (&gva, g_variant_unref);
- return array;
-}
-
-/**
- * up_wakeups_get_properties_sync:
- * @wakeups: a #UpWakeups instance.
- * @cancellable: a #GCancellable or %NULL
- * @error: a #GError, or %NULL.
- *
- * Gets properties from the daemon about wakeup data.
- *
- * Return value: %TRUE if supported
- *
- * Since: 0.9.1
- **/
-gboolean
-up_wakeups_get_properties_sync (UpWakeups *wakeups, GCancellable *cancellable, GError **error)
-{
- g_return_val_if_fail (UP_IS_WAKEUPS (wakeups), FALSE);
- /* Nothing to do here */
- return TRUE;
-}
-
-/**
- * up_wakeups_get_has_capability:
- * @wakeups: a #UpWakeups instance.
- *
- * Returns if the daemon supports getting the wakeup data.
- *
- * Return value: %TRUE if supported
- *
- * Since: 0.9.1
- **/
-gboolean
-up_wakeups_get_has_capability (UpWakeups *wakeups)
-{
- g_return_val_if_fail (UP_IS_WAKEUPS (wakeups), FALSE);
- return up_exported_wakeups_get_has_capability (wakeups->priv->proxy);
-}
-
-/**
- * up_wakeups_total_changed_cb:
- **/
-static void
-up_wakeups_total_changed_cb (UpExportedWakeups *proxy, guint value, UpWakeups *wakeups)
-{
- g_signal_emit (wakeups, signals [UP_WAKEUPS_TOTAL_CHANGED], 0, value);
-}
-
-/**
- * up_wakeups_data_changed_cb:
- **/
-static void
-up_wakeups_data_changed_cb (UpExportedWakeups *proxy, UpWakeups *wakeups)
-{
- g_signal_emit (wakeups, signals [UP_WAKEUPS_DATA_CHANGED], 0);
-}
-
-/**
- * up_wakeups_class_init:
- **/
-static void
-up_wakeups_class_init (UpWakeupsClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = up_wakeups_finalize;
-
- signals [UP_WAKEUPS_DATA_CHANGED] =
- g_signal_new ("data-changed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (UpWakeupsClass, data_changed),
- NULL, NULL, g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- signals [UP_WAKEUPS_TOTAL_CHANGED] =
- g_signal_new ("total-changed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (UpWakeupsClass, data_changed),
- NULL, NULL, g_cclosure_marshal_VOID__UINT,
- G_TYPE_NONE, 1, G_TYPE_UINT);
-}
-
-/**
- * up_wakeups_init:
- **/
-static void
-up_wakeups_init (UpWakeups *wakeups)
-{
- GError *error = NULL;
-
- wakeups->priv = up_wakeups_get_instance_private (wakeups);
-
- /* connect to main interface */
- wakeups->priv->proxy = up_exported_wakeups_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- "org.freedesktop.UPower",
- "/org/freedesktop/UPower/Wakeups",
- NULL,
- &error);
- if (wakeups->priv->proxy == NULL) {
- g_warning ("Couldn't connect to proxy: %s", error->message);
- g_error_free (error);
- return;
- }
-
- /* all callbacks */
- g_signal_connect (wakeups->priv->proxy, "total-changed",
- G_CALLBACK (up_wakeups_total_changed_cb), wakeups);
- g_signal_connect (wakeups->priv->proxy, "data-changed",
- G_CALLBACK (up_wakeups_data_changed_cb), wakeups);
-}
-
-/**
- * up_wakeups_finalize:
- **/
-static void
-up_wakeups_finalize (GObject *object)
-{
- UpWakeups *wakeups;
-
- g_return_if_fail (UP_IS_WAKEUPS (object));
-
- wakeups = UP_WAKEUPS (object);
- g_clear_object (&wakeups->priv->proxy);
-
- G_OBJECT_CLASS (up_wakeups_parent_class)->finalize (object);
-}
-
-/**
- * up_wakeups_new:
- *
- * Gets a new object to allow querying the wakeups data from the server.
- *
- * Return value: the a new @UpWakeups object.
- *
- * Since: 0.9.1
- **/
-UpWakeups *
-up_wakeups_new (void)
-{
- return UP_WAKEUPS (g_object_new (UP_TYPE_WAKEUPS, NULL));
-}
-
diff --git a/libupower-glib/up-wakeups.h b/libupower-glib/up-wakeups.h
deleted file mode 100644
index 745971b..0000000
--- a/libupower-glib/up-wakeups.h
+++ /dev/null
@@ -1,83 +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#if !defined (__UPOWER_H_INSIDE__) && !defined (UP_COMPILATION)
-#error "Only <upower.h> can be included directly."
-#endif
-
-#ifndef __UP_WAKEUPS_H
-#define __UP_WAKEUPS_H
-
-#include <glib-object.h>
-#include <gio/gio.h>
-
-#include <libupower-glib/up-types.h>
-#include <libupower-glib/up-device.h>
-#include <libupower-glib/up-wakeup-item.h>
-
-G_BEGIN_DECLS
-
-#define UP_TYPE_WAKEUPS (up_wakeups_get_type ())
-#define UP_WAKEUPS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), UP_TYPE_WAKEUPS, UpWakeups))
-#define UP_WAKEUPS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), UP_TYPE_WAKEUPS, UpWakeupsClass))
-#define UP_IS_WAKEUPS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), UP_TYPE_WAKEUPS))
-#define UP_IS_WAKEUPS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), UP_TYPE_WAKEUPS))
-#define UP_WAKEUPS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), UP_TYPE_WAKEUPS, UpWakeupsClass))
-#define UP_WAKEUPS_ERROR (up_wakeups_error_quark ())
-#define UP_WAKEUPS_TYPE_ERROR (up_wakeups_error_get_type ())
-
-typedef struct UpWakeupsPrivate UpWakeupsPrivate;
-
-typedef struct
-{
- GObject parent;
- UpWakeupsPrivate *priv;
-} UpWakeups;
-
-typedef struct
-{
- GObjectClass parent_class;
- void (*data_changed) (UpWakeups *wakeups);
- void (*total_changed) (UpWakeups *wakeups,
- guint value);
-} UpWakeupsClass;
-
-GType up_wakeups_get_type (void);
-UpWakeups *up_wakeups_new (void);
-
-/* sync versions */
-guint up_wakeups_get_total_sync (UpWakeups *wakeups,
- GCancellable *cancellable,
- GError **error);
-GPtrArray *up_wakeups_get_data_sync (UpWakeups *wakeups,
- GCancellable *cancellable,
- GError **error);
-gboolean up_wakeups_get_properties_sync (UpWakeups *wakeups,
- GCancellable *cancellable,
- GError **error);
-
-/* accessors */
-gboolean up_wakeups_get_has_capability (UpWakeups *wakeups);
-
-G_END_DECLS
-
-#endif /* __UP_WAKEUPS_H */
-
diff --git a/libupower-glib/upower.h b/libupower-glib/upower.h
index 3d7c98e..60974cb 100644
--- a/libupower-glib/upower.h
+++ b/libupower-glib/upower.h
@@ -39,8 +39,6 @@
#include <libupower-glib/up-device.h>
#include <libupower-glib/up-history-item.h>
#include <libupower-glib/up-stats-item.h>
-#include <libupower-glib/up-wakeup-item.h>
-#include <libupower-glib/up-wakeups.h>
#include <libupower-glib/up-autocleanups.h>