1 /* vi: set et sw=4 ts=8 cino=t0,(0: */
2 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 8 -*- */
3 /*
4  * This file is part of mission-control
5  *
6  * Copyright (C) 2007 Nokia Corporation.
7  *
8  * Contact: Naba Kumar  <naba.kumar@nokia.com>
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public License
12  * version 2.1 as published by the Free Software Foundation.
13  *
14  * This library is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22  * 02110-1301 USA
23  *
24  */
25 
26 #ifndef MCD_OPERATION_H
27 #define MCD_OPERATION_H
28 
29 #include <glib.h>
30 #include <glib-object.h>
31 
32 #include "mcd-mission.h"
33 
34 G_BEGIN_DECLS
35 #define MCD_TYPE_OPERATION         (mcd_operation_get_type ())
36 #define MCD_OPERATION(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), MCD_TYPE_OPERATION, McdOperation))
37 #define MCD_OPERATION_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), MCD_TYPE_OPERATION, McdOperationClass))
38 #define MCD_IS_OPERATION(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), MCD_TYPE_OPERATION))
39 #define MCD_IS_OPERATION_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), MCD_TYPE_OPERATION))
40 #define MCD_OPERATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MCD_TYPE_OPERATION, McdOperationClass))
41 typedef struct _McdOperation McdOperation;
42 typedef struct _McdOperationClass McdOperationClass;
43 
44 struct _McdOperation
45 {
46     McdMission parent;
47 };
48 
49 struct _McdOperationClass
50 {
51     McdMissionClass parent_class;
52 
53     /* signals */
54     void (*mission_taken_signal) (McdOperation * operation,
55 				  McdMission * mission);
56     void (*mission_removed_signal) (McdOperation * operation,
57 				    McdMission * mission);
58 
59     /* virtual methods */
60     void (*take_mission) (McdOperation * operation, McdMission * mission);
61     void (*remove_mission) (McdOperation * operation, McdMission * mission);
62 };
63 
64 GType mcd_operation_get_type (void);
65 McdOperation *mcd_operation_new (void);
66 
67 /* Takes the ownership of mission */
68 void mcd_operation_take_mission (McdOperation * operation,
69 				 McdMission * mission);
70 void mcd_operation_remove_mission (McdOperation * operation,
71 				   McdMission * mission);
72 void mcd_operation_foreach (McdOperation * operation,
73 			    GFunc func, gpointer user_data);
74 const GList * mcd_operation_get_missions (McdOperation * operation);
75 
76 G_END_DECLS
77 #endif /* MCD_OPERATION_H */
78