2
* Copyright 2013 Red Hat, Inc.
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 3 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
#ifndef META_IDLE_MONITOR_H
19
#define META_IDLE_MONITOR_H
21
#include <glib-object.h>
23
#define META_TYPE_IDLE_MONITOR (meta_idle_monitor_get_type ())
24
#define META_IDLE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_IDLE_MONITOR, MetaIdleMonitor))
25
#define META_IDLE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_IDLE_MONITOR, MetaIdleMonitorClass))
26
#define META_IS_IDLE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_IDLE_MONITOR))
27
#define META_IS_IDLE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_IDLE_MONITOR))
28
#define META_IDLE_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_IDLE_MONITOR, MetaIdleMonitorClass))
30
typedef struct _MetaIdleMonitor MetaIdleMonitor;
31
typedef struct _MetaIdleMonitorClass MetaIdleMonitorClass;
33
typedef void (*MetaIdleMonitorWatchFunc) (MetaIdleMonitor *monitor,
39
MetaIdleMonitor *monitor;
41
MetaIdleMonitorWatchFunc callback;
43
GDestroyNotify notify;
46
} MetaIdleMonitorWatch;
48
void _meta_idle_monitor_watch_fire (MetaIdleMonitorWatch *watch);
50
struct _MetaIdleMonitor
52
GObject parent_instance;
58
struct _MetaIdleMonitorClass
60
GObjectClass parent_class;
62
gint64 (*get_idletime) (MetaIdleMonitor *monitor);
63
MetaIdleMonitorWatch * (*make_watch) (MetaIdleMonitor *monitor,
65
MetaIdleMonitorWatchFunc callback,
67
GDestroyNotify notify);
70
GType meta_idle_monitor_get_type (void);
72
MetaIdleMonitor *meta_idle_monitor_get_core (void);
73
MetaIdleMonitor *meta_idle_monitor_get_for_device (int device_id);
75
guint meta_idle_monitor_add_idle_watch (MetaIdleMonitor *monitor,
76
guint64 interval_msec,
77
MetaIdleMonitorWatchFunc callback,
79
GDestroyNotify notify);
81
guint meta_idle_monitor_add_user_active_watch (MetaIdleMonitor *monitor,
82
MetaIdleMonitorWatchFunc callback,
84
GDestroyNotify notify);
86
void meta_idle_monitor_remove_watch (MetaIdleMonitor *monitor,
88
gint64 meta_idle_monitor_get_idletime (MetaIdleMonitor *monitor);