1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 
3 /*
4  * Copyright 2013 Red Hat, Inc.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of the
9  * License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef META_IDLE_MONITOR_H
21 #define META_IDLE_MONITOR_H
22 
23 #include <glib-object.h>
24 #include <meta/types.h>
25 
26 #define META_TYPE_IDLE_MONITOR (meta_idle_monitor_get_type ())
27 META_EXPORT
28 G_DECLARE_FINAL_TYPE (MetaIdleMonitor, meta_idle_monitor,
29                       META, IDLE_MONITOR,
30                       GObject)
31 
32 typedef void (*MetaIdleMonitorWatchFunc) (MetaIdleMonitor *monitor,
33                                           guint            watch_id,
34                                           gpointer         user_data);
35 
36 META_EXPORT
37 guint         meta_idle_monitor_add_idle_watch        (MetaIdleMonitor          *monitor,
38 						       guint64                   interval_msec,
39 						       MetaIdleMonitorWatchFunc  callback,
40 						       gpointer                  user_data,
41 						       GDestroyNotify            notify);
42 
43 META_EXPORT
44 guint         meta_idle_monitor_add_user_active_watch (MetaIdleMonitor          *monitor,
45 						       MetaIdleMonitorWatchFunc  callback,
46 						       gpointer                  user_data,
47 						       GDestroyNotify            notify);
48 
49 META_EXPORT
50 void          meta_idle_monitor_remove_watch          (MetaIdleMonitor          *monitor,
51 						       guint                     id);
52 
53 META_EXPORT
54 gint64        meta_idle_monitor_get_idletime          (MetaIdleMonitor          *monitor);
55 
56 #endif
57