~xavi-garcia-mena/ubuntu/vivid/upower/percentages-power-off

« back to all changes in this revision

Viewing changes to libupower-glib/up-client.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2010-02-16 10:16:24 UTC
  • Revision ID: james.westby@ubuntu.com-20100216101624-2cmwqsr1ndftdd87
Tags: upstream-0.9.0+git20100216.72bb2
ImportĀ upstreamĀ versionĀ 0.9.0+git20100216.72bb2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
 
2
 *
 
3
 * Copyright (C) 2008-2010 Richard Hughes <richard@hughsie.com>
 
4
 *
 
5
 * Licensed under the GNU General Public License Version 2
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation; either version 2 of the License, or
 
10
 * (at your option) any later version.
 
11
 *
 
12
 * This program is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 * GNU General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU General Public License
 
18
 * along with this program; if not, write to the Free Software
 
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
20
 */
 
21
 
 
22
#if !defined (__UPOWER_H_INSIDE__) && !defined (UP_COMPILATION)
 
23
#error "Only <upower.h> can be included directly."
 
24
#endif
 
25
 
 
26
#ifndef __UP_CLIENT_H
 
27
#define __UP_CLIENT_H
 
28
 
 
29
#include <glib-object.h>
 
30
#include <gio/gio.h>
 
31
 
 
32
#include <libupower-glib/up-device.h>
 
33
 
 
34
G_BEGIN_DECLS
 
35
 
 
36
#define UP_TYPE_CLIENT                  (up_client_get_type ())
 
37
#define UP_CLIENT(o)                    (G_TYPE_CHECK_INSTANCE_CAST ((o), UP_TYPE_CLIENT, UpClient))
 
38
#define UP_CLIENT_CLASS(k)              (G_TYPE_CHECK_CLASS_CAST((k), UP_TYPE_CLIENT, UpClientClass))
 
39
#define UP_IS_CLIENT(o)                 (G_TYPE_CHECK_INSTANCE_TYPE ((o), UP_TYPE_CLIENT))
 
40
#define UP_IS_CLIENT_CLASS(k)           (G_TYPE_CHECK_CLASS_TYPE ((k), UP_TYPE_CLIENT))
 
41
#define UP_CLIENT_GET_CLASS(o)          (G_TYPE_INSTANCE_GET_CLASS ((o), UP_TYPE_CLIENT, UpClientClass))
 
42
#define UP_CLIENT_ERROR                 (up_client_error_quark ())
 
43
#define UP_CLIENT_TYPE_ERROR            (up_client_error_get_type ())
 
44
 
 
45
typedef struct _UpClientPrivate UpClientPrivate;
 
46
 
 
47
typedef struct
 
48
{
 
49
         GObject                 parent;
 
50
         UpClientPrivate        *priv;
 
51
} UpClient;
 
52
 
 
53
typedef struct
 
54
{
 
55
        GObjectClass             parent_class;
 
56
        void                    (*device_added)         (UpClient               *client,
 
57
                                                         UpDevice               *device);
 
58
        void                    (*device_changed)       (UpClient               *client,
 
59
                                                         UpDevice               *device);
 
60
        void                    (*device_removed)       (UpClient               *client,
 
61
                                                         UpDevice               *device);
 
62
        void                    (*changed)              (UpClient               *client);
 
63
        /*< private >*/
 
64
        /* Padding for future expansion */
 
65
        void (*_up_client_reserved1) (void);
 
66
        void (*_up_client_reserved2) (void);
 
67
        void (*_up_client_reserved3) (void);
 
68
        void (*_up_client_reserved4) (void);
 
69
        void (*_up_client_reserved5) (void);
 
70
        void (*_up_client_reserved6) (void);
 
71
        void (*_up_client_reserved7) (void);
 
72
        void (*_up_client_reserved8) (void);
 
73
} UpClientClass;
 
74
 
 
75
/* general */
 
76
GType            up_client_get_type                     (void);
 
77
UpClient        *up_client_new                          (void);
 
78
 
 
79
/* sync versions */
 
80
gboolean         up_client_get_properties_sync          (UpClient               *client,
 
81
                                                         GCancellable           *cancellable,
 
82
                                                         GError                 **error);
 
83
gboolean         up_client_enumerate_devices_sync       (UpClient               *client,
 
84
                                                         GCancellable           *cancellable,
 
85
                                                         GError                 **error);
 
86
gboolean         up_client_suspend_sync                 (UpClient               *client,
 
87
                                                         GCancellable           *cancellable,
 
88
                                                         GError                 **error);
 
89
gboolean         up_client_about_to_sleep_sync          (UpClient               *client,
 
90
                                                         GCancellable           *cancellable,
 
91
                                                         GError                 **error);
 
92
gboolean         up_client_hibernate_sync               (UpClient               *client,
 
93
                                                         GCancellable           *cancellable,
 
94
                                                         GError                 **error);
 
95
 
 
96
/* accessors */
 
97
GPtrArray       *up_client_get_devices                  (UpClient               *client);
 
98
const gchar     *up_client_get_daemon_version           (UpClient               *client);
 
99
gboolean         up_client_get_can_hibernate            (UpClient               *client);
 
100
gboolean         up_client_get_lid_is_closed            (UpClient               *client);
 
101
gboolean         up_client_get_can_suspend              (UpClient               *client);
 
102
gboolean         up_client_get_on_battery               (UpClient               *client);
 
103
gboolean         up_client_get_on_low_battery           (UpClient               *client);
 
104
 
 
105
G_END_DECLS
 
106
 
 
107
#endif /* __UP_CLIENT_H */
 
108