1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- 2 * 3 * Copyright (C) 2007 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 #ifndef __GPM_IDLETIME_H 23 #define __GPM_IDLETIME_H 24 25 #include <glib-object.h> 26 27 G_BEGIN_DECLS 28 29 #define GPM_IDLETIME_TYPE (gpm_idletime_get_type ()) 30 #define GPM_IDLETIME(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GPM_IDLETIME_TYPE, GpmIdletime)) 31 #define GPM_IDLETIME_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GPM_IDLETIME_TYPE, GpmIdletimeClass)) 32 #define GPM_IS_IDLETIME(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GPM_IDLETIME_TYPE)) 33 #define GPM_IS_IDLETIME_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GPM_IDLETIME_TYPE)) 34 #define GPM_IDLETIME_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GPM_IDLETIME_TYPE, GpmIdletimeClass)) 35 36 typedef struct GpmIdletimePrivate GpmIdletimePrivate; 37 38 typedef struct 39 { 40 GObject parent; 41 GpmIdletimePrivate *priv; 42 } GpmIdletime; 43 44 typedef struct 45 { 46 GObjectClass parent_class; 47 void (* alarm_expired) (GpmIdletime *idletime, 48 guint timer_id); 49 void (* reset) (GpmIdletime *idletime); 50 } GpmIdletimeClass; 51 52 GType gpm_idletime_get_type (void); 53 GpmIdletime *gpm_idletime_new (void); 54 55 void gpm_idletime_alarm_reset_all (GpmIdletime *idletime); 56 gboolean gpm_idletime_alarm_set (GpmIdletime *idletime, 57 guint alarm_id, 58 guint timeout); 59 gboolean gpm_idletime_alarm_remove (GpmIdletime *idletime, 60 guint alarm_id); 61 gint64 gpm_idletime_get_time (GpmIdletime *idletime); 62 63 G_END_DECLS 64 65 #endif /* __GPM_IDLETIME_H */ 66