00001 /* 00002 * This file is part of contentLister. 00003 * 00004 * contentLister is free software: you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation, either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * contentLister is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00040 #ifndef __PINCODE_IDLE_TIME_H__ 00041 #define __PINCODE_IDLE_TIME_H__ 00042 #ifdef __cplusplus 00043 extern "C" 00044 { 00045 #endif 00046 00047 #define TIMEOUT_INTERNAL 100 // milliseconds 00048 00049 typedef void on_threshold_t (); 00050 00051 typedef struct _accumulateIdleTime_t accumulateIdleTime_t; 00052 00053 struct _accumulateIdleTime_t 00054 { 00055 gint milliseconds; // user idle time in milliseconds 00056 gint threshold; // when 'milliseconds' reachs 'threshold', need to do something special 00057 // if threshold equals zero, that means, no threshold 00058 on_threshold_t *callback_on_threshold; // threshold callback function 00059 00060 gint internal; // private-increase 'milliseconds' once after 'internal' milliseconds 00061 gint timeout_handler_id; // private-timeout handler id 00062 }; 00063 00071 void accumulate_idle_time_begin (); 00072 00080 void accumulate_idle_time_end (); 00081 00091 void accumulate_idle_time_set_threshold (gint threshold); 00092 00101 void accumulate_idle_time_set_callback (on_threshold_t * func); 00102 00110 void accumulate_idle_time_reset (); 00111 00119 gint accumulate_idle_time_get (); 00120 00121 #ifdef __cplusplus 00122 } 00123 #endif 00124 00125 #endif /* __PINCODE_IDLE_TIME_H__ */