Main Page | Data Structures | File List | Data Fields | Globals

event.h

Go to the documentation of this file.
00001 /**
00002  * This file is part of alarmd
00003  *
00004  * Contact Person: David Weinehall <david.weinehall@nokia.com>
00005  *
00006  * Copyright (C) 2006 Nokia Corporation
00007  * alarmd and libalarm are free software; you can redistribute them
00008  * and/or modify them under the terms of the GNU Lesser General Public
00009  * License version 2.1 as published by the Free Software Foundation.
00010  *
00011  * alarmd and libalarm are distributed in the hope that they will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this software; if not, write to the Free
00018  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00019  * 02110-1301 USA
00020  */
00021 
00022 #ifndef _EVENT_H_
00023 #define _EVENT_H_
00024 
00025 #include <glib/gtypes.h>
00026 #include <glib-object.h>
00027 #include "object.h"
00028 #include "include/timer-interface.h"
00029 
00030 #define ALARMD_TYPE_EVENT (alarmd_event_get_type())
00031 #define ALARMD_EVENT(object) (G_TYPE_CHECK_INSTANCE_CAST((object), ALARMD_TYPE_EVENT, AlarmdEvent))
00032 #define ALARMD_EVENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ALARMD_TYPE_EVENT, AlarmdEventClass))
00033 #define ALARMD_IS_EVENT(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), ALARMD_TYPE_EVENT))
00034 #define ALARMD_IS_EVENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), ALARMD_TYPE_EVENT))
00035 #define ALARMD_EVENT_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), ALARMD_TYPE_EVENT, AlarmdEventClass))
00036 
00037 typedef struct _AlarmdEvent AlarmdEvent;
00038 struct _AlarmdEvent
00039 {
00040         AlarmdObject parent_instance;
00041 };
00042 
00043 typedef struct _AlarmdEventClass AlarmdEventClass;
00044 struct _AlarmdEventClass
00045 {
00046         AlarmdObjectClass parent_class;
00047         
00048         void (*fire)(AlarmdEvent *event, gboolean delayed);
00049         void (*cancel)(AlarmdEvent *event);
00050         void (*acknowledge)(AlarmdEvent *event);
00051         void (*snooze)(AlarmdEvent *event);
00052         void (*queue)(AlarmdEvent *event, TimerPlugin *applet);
00053         void (*dequeue)(AlarmdEvent *event);
00054         gint32 (*get_flags)(AlarmdEvent *event);
00055 
00056         time_t (*get_time)(AlarmdEvent *event);
00057         gboolean (*need_power_up)(AlarmdEvent *event);
00058 };
00059 
00060 /**
00061  * SECTION:event
00062  * @short_description: Base class for events.
00063  * @see_also: #AlarmdEventRecurring, #AlarmdQueue
00064  *
00065  * A simple event that waits in the queue for being put on a timer and
00066  * finally getting fired. Launches the action in #AlarmdEvent:action and
00067  * after it has finished, removes self from the queue.
00068  **/
00069 
00070 /**
00071  * AlarmdEvent::acknowledge:
00072  * @event: The #AlarmdEvent that received the signal.
00073  *
00074  * Whenever an event is acknowledged, this signal is emitted.
00075  **/
00076 
00077 /**
00078  * AlarmdEvent::cancel:
00079  * @event: The #AlarmdEvent that is being cancelled.
00080  *
00081  * Whenever an #AlarmdEvent should be removed from queue, a
00082  * #AlarmdEvent::cancel signal is emitted.
00083  **/
00084 
00085 /**
00086  * AlarmdEvent::dequeue:
00087  * @event: The #AlarmdEvent that is taken off the timer.
00088  *
00089  * Whenever an #AlarmdEvent is taken off a timer, a #AlarmdEvent::dequeue
00090  * signal is emitted.
00091  **/
00092 
00093 /**
00094  * AlarmdEvent::fire:
00095  * @event: The #AlarmdEvent that should be fired.
00096  * @delayed: TRUE if the event is fired delayed.
00097  *
00098  * Whenever an #AlarmdEvent is due, a #AlarmdEvent::fire signal is emitted.
00099  **/
00100 
00101 /**
00102  * AlarmdEvent::queue:
00103  * @event: The #AlarmdEvent that is put on a timer.
00104  *
00105  * Whenever an #AlarmdEvent is put on a timer, a #AlarmdEvent::queue signal is
00106  * emitted.
00107  **/
00108 
00109 /**
00110  * AlarmdEvent::snooze:
00111  * @event: The #AlarmdEvent that is being snoozed.
00112  *
00113  * Whenever an #AlarmdEvent is snoozed, a #AlarmdEvent::snooze signal is
00114  * emitted.
00115  **/
00116 
00117 GType alarmd_event_get_type(void);
00118 
00119 /**
00120  * alarmd_event_new:
00121  *
00122  * Creates new alarmd event.
00123  * Returns: Newly created #AlarmdEvent
00124  **/
00125 AlarmdEvent *alarmd_event_new(void);
00126 
00127 /**
00128  * alarmd_event_fire:
00129  * @event: Event that should be fired.
00130  * @delayed: TRUE if the event is fired delayed.
00131  *
00132  * Emits a #AlarmdEvent::fire signal on the given @event.
00133  **/
00134 void alarmd_event_fire(AlarmdEvent *event, gboolean delayed);
00135 
00136 /**
00137  * alarmd_event_cancel:
00138  * @event: Event that should be cancelled.
00139  *
00140  * Emits a #AlarmdEvent::cancel signal on the given @event.
00141  **/
00142 void alarmd_event_cancel(AlarmdEvent *event);
00143 
00144 /**
00145  * alarmd_event_snooze:
00146  * @event: Event that should be snoozed.
00147  *
00148  * Emits a #AlarmdEvent::snooze signal on the given @event.
00149  **/
00150 void alarmd_event_snooze(AlarmdEvent *event);
00151 
00152 /**
00153  * alarmd_event_acknowledge:
00154  * @event: Event that should be acknowledged.
00155  *
00156  * Emits a #AlarmdEvent::acknowledge signal on the given @event.
00157  **/
00158 void alarmd_event_acknowledge(AlarmdEvent *event);
00159 
00160 /**
00161  * alarmd_event_queue:
00162  * @event: Event that should be put on a timer.
00163  * @plugin: The timer the event should be put on.
00164  *
00165  * Emits a #AlarmdEvent::queue signal on the given @event.
00166  **/
00167 void alarmd_event_queue(AlarmdEvent *event, TimerPlugin *plugin);
00168 
00169 /**
00170  * alarmd_event_dequeue:
00171  * @event: Event that should be taken off a timer.
00172  *
00173  * Emits a #AlarmdEvent::dequeue signal on the given @event.
00174  **/
00175 void alarmd_event_dequeue(AlarmdEvent *event);
00176 
00177 /**
00178  * alarmd_event_get_time:
00179  * @event: #AlarmdEvent to get the time from.
00180  *
00181  * Gets the next time an event should be run.
00182  * Returns: The time that the event should next be run.
00183  **/
00184 time_t alarmd_event_get_time(AlarmdEvent *event);
00185 
00186 /**
00187  * alarmd_event_need_power_up:
00188  * @event: The #AlarmdEvent that is being queried.
00189  *
00190  * Queries an event, if it needs the "power up" feature.
00191  * Returns: TRUE if the power up feature is needed.
00192  **/
00193 gboolean alarmd_event_need_power_up(AlarmdEvent *event);
00194 
00195 /**
00196  * alarmd_event_get_flags:
00197  * @event: The #AlarmdEvent that is being queried.
00198  *
00199  * Queries an event for its flags.
00200  * Returns: The bitfield for the flags.
00201  **/
00202 gint32 alarmd_event_get_flags(AlarmdEvent *event);
00203 
00204 #endif /* _EVENT_H_ */

Generated on Thu Dec 21 18:23:30 2006 for Alarmd by  doxygen 1.4.2