~ubuntu-branches/ubuntu/vivid/gnome-flashback/vivid

« back to all changes in this revision

Viewing changes to gnome-flashback/libidle-monitor/meta-idle-monitor.h

  • Committer: Package Import Robot
  • Author(s): Dmitry Shachnev
  • Date: 2014-09-19 17:09:43 UTC
  • Revision ID: package-import@ubuntu.com-20140919170943-oboafsedi6z69951
Tags: upstream-3.10.0
ImportĀ upstreamĀ versionĀ 3.10.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2013 Red Hat, Inc.
 
3
 *
 
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.
 
8
 *
 
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.
 
13
 *
 
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/>.
 
16
 */
 
17
 
 
18
#ifndef META_IDLE_MONITOR_H
 
19
#define META_IDLE_MONITOR_H
 
20
 
 
21
#include <glib-object.h>
 
22
 
 
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))
 
29
 
 
30
typedef struct _MetaIdleMonitor        MetaIdleMonitor;
 
31
typedef struct _MetaIdleMonitorClass   MetaIdleMonitorClass;
 
32
 
 
33
typedef void (*MetaIdleMonitorWatchFunc) (MetaIdleMonitor *monitor,
 
34
                                          guint            watch_id,
 
35
                                          gpointer         user_data);
 
36
 
 
37
typedef struct
 
38
{
 
39
  MetaIdleMonitor          *monitor;
 
40
  guint                     id;
 
41
  MetaIdleMonitorWatchFunc  callback;
 
42
  gpointer                  user_data;
 
43
  GDestroyNotify            notify;
 
44
  guint64                   timeout_msec;
 
45
  int                       idle_source_id;
 
46
} MetaIdleMonitorWatch;
 
47
 
 
48
void _meta_idle_monitor_watch_fire (MetaIdleMonitorWatch *watch);
 
49
 
 
50
struct _MetaIdleMonitor
 
51
{
 
52
  GObject parent_instance;
 
53
 
 
54
  GHashTable *watches;
 
55
  int device_id;
 
56
};
 
57
 
 
58
struct _MetaIdleMonitorClass
 
59
{
 
60
  GObjectClass parent_class;
 
61
 
 
62
  gint64 (*get_idletime) (MetaIdleMonitor *monitor);
 
63
  MetaIdleMonitorWatch * (*make_watch) (MetaIdleMonitor           *monitor,
 
64
                                        guint64                    timeout_msec,
 
65
                                        MetaIdleMonitorWatchFunc   callback,
 
66
                                        gpointer                   user_data,
 
67
                                        GDestroyNotify             notify);
 
68
};
 
69
 
 
70
GType meta_idle_monitor_get_type (void);
 
71
 
 
72
MetaIdleMonitor *meta_idle_monitor_get_core (void);
 
73
MetaIdleMonitor *meta_idle_monitor_get_for_device (int device_id);
 
74
 
 
75
guint         meta_idle_monitor_add_idle_watch        (MetaIdleMonitor          *monitor,
 
76
                                                       guint64                   interval_msec,
 
77
                                                       MetaIdleMonitorWatchFunc  callback,
 
78
                                                       gpointer                  user_data,
 
79
                                                       GDestroyNotify            notify);
 
80
 
 
81
guint         meta_idle_monitor_add_user_active_watch (MetaIdleMonitor          *monitor,
 
82
                                                       MetaIdleMonitorWatchFunc  callback,
 
83
                                                       gpointer                  user_data,
 
84
                                                       GDestroyNotify            notify);
 
85
 
 
86
void          meta_idle_monitor_remove_watch          (MetaIdleMonitor          *monitor,
 
87
                                                       guint                     id);
 
88
gint64        meta_idle_monitor_get_idletime          (MetaIdleMonitor          *monitor);
 
89
 
 
90
#endif