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

action.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 _ACTION_H_
00023 #define _ACTION_H_
00024 
00025 #include <glib/gtypes.h>
00026 #include <glib-object.h>
00027 #include "object.h"
00028 #include "include/timer-interface.h"
00029 
00030 /**
00031  * SECTION:action
00032  * @short_description: Base class for any actions done on events.
00033  * @see_also: #AlarmdActionDialog, #AlarmdActionExec, #AlarmdActionDbus.
00034  *
00035  * #AlarmdAction is a base class for objects that define the action run when
00036  * event is due. It itself does nothing, and should not be used as-is.
00037  **/
00038 
00039 /**
00040  * AlarmdActionAckType:
00041  * @ACK_NORMAL: The action was normally acknowledged.
00042  * @ACK_SNOOZE: The action was snoozed.
00043  *
00044  * Defines the ways a action can be acknowledged.
00045  **/
00046 typedef enum {
00047         ACK_NORMAL,
00048         ACK_SNOOZE
00049 } AlarmdActionAckType;
00050 
00051 #define ALARMD_TYPE_ACTION (alarmd_action_get_type())
00052 #define ALARMD_ACTION(object) (G_TYPE_CHECK_INSTANCE_CAST((object), ALARMD_TYPE_ACTION, AlarmdAction))
00053 #define ALARMD_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ALARMD_TYPE_ACTION, AlarmdActionClass))
00054 #define ALARMD_IS_ACTION(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), ALARMD_TYPE_ACTION))
00055 #define ALARMD_IS_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), ALARMD_TYPE_ACTION))
00056 #define ALARMD_ACTION_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), ALARMD_TYPE_ACTION, AlarmdActionClass))
00057 
00058 typedef struct _AlarmdAction AlarmdAction;
00059 struct _AlarmdAction
00060 {
00061         AlarmdObject parent_instance;
00062 };
00063 
00064 typedef struct _AlarmdActionClass AlarmdActionClass;
00065 struct _AlarmdActionClass
00066 {
00067         AlarmdObjectClass parent_class;
00068         
00069         void (*run)(AlarmdAction *action, gboolean delayed);
00070         void (*acknowledge)(AlarmdAction *action, AlarmdActionAckType ack_type);
00071         gboolean (*need_power_up)(AlarmdAction *action);
00072 };
00073 
00074 /**
00075  * AlarmdAction::acknowledge:
00076  * @action: The action that is acknowledged.
00077  * @ack_type: How was the @action acknowledged, as defined by
00078  * #AlarmdActionAckType.
00079  *
00080  * When an #AlarmdAction is acknowledged, it should emit the acknowledge
00081  * signal.
00082  **/
00083 
00084 /**
00085  * AlarmdAction::run:
00086  * @action: The action that is run.
00087  * @delayed: Specifies if the execution of @action is delayed.
00088  *
00089  * When an #AlarmdAction should be run, this signal should be emitted.
00090  **/
00091 
00092 GType alarmd_action_get_type(void);
00093 
00094 /**
00095  * alarmd_action_new:
00096  *
00097  * Creates new alarmd action.
00098  * Returns: Newly created #AlarmdAction.
00099  **/
00100 AlarmdAction *alarmd_action_new(void);
00101 
00102 /**
00103  * alarmd_action_run:
00104  * @action: A #AlarmdAction that should be run.
00105  * @delayed: Whether the #AlarmdAction is run on time or after it.
00106  *
00107  * Emits "run" signal on the given #AlarmdAction. The interpretion of the
00108  * @delayed flag depends on the action type.
00109  **/
00110 void alarmd_action_run(AlarmdAction *action, gboolean delayed);
00111 
00112 /**
00113  * alarmd_action_acknowledge:
00114  * @action: #AlarmdAction that is acknowledged.
00115  * @ack_type: %ACK_NORMAL if the action was normally acknowledged or
00116  * %ACK_SNOOZE if it was snoozed.
00117  * 
00118  * Emits "acknowledge" -signal on the given #AlarmdAction.
00119  **/
00120 void alarmd_action_acknowledge(AlarmdAction *action,
00121                 AlarmdActionAckType ack_type);
00122 
00123 /**
00124  * alarmd_action_need_power_up:
00125  * @action: #AlarmdAction that is being queried.
00126  *
00127  * Queries the given #AlarmdAction, if it needs power up functionality.
00128  *
00129  * Returns: TRUE if the #AlarmdAction needs power up, FALSE otherwise.
00130  **/
00131 gboolean alarmd_action_need_power_up(AlarmdAction *action);
00132 
00133 #endif /* _ACTION_H_ */

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