1 /* Mission Control plugin API - representation of a ChannelRequest
2  *
3  * Copyright © 2009 Nokia Corporation
4  * Copyright © 2009-2010 Collabora Ltd.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  */
20 
21 #ifndef MCP_REQUEST_H
22 #define MCP_REQUEST_H
23 
24 #ifndef _MCP_IN_MISSION_CONTROL_PLUGINS_H
25 #error Use <mission-control-plugins/mission-control-plugins.h> instead
26 #endif
27 
28 #include <mission-control-plugins/request.h>
29 
30 G_BEGIN_DECLS
31 
32 typedef struct _McpRequest McpRequest;
33 typedef struct _McpRequestIface McpRequestIface;
34 
35 /* Opaque token representing a request being stalled until an asynchronous
36  * policy action */
37 typedef struct _McpRequestDelay McpRequestDelay;
38 
39 #define MCP_TYPE_REQUEST \
40   (mcp_request_get_type ())
41 #define MCP_REQUEST(o) \
42   (G_TYPE_CHECK_INSTANCE_CAST ((o), MCP_TYPE_REQUEST, McpRequest))
43 #define MCP_IS_REQUEST(o) \
44   (G_TYPE_CHECK_INSTANCE_TYPE ((o), MCP_TYPE_REQUEST))
45 #define MCP_REQUEST_GET_IFACE(o) \
46   (G_TYPE_INSTANCE_GET_INTERFACE ((o), MCP_TYPE_REQUEST, \
47                                   McpRequestIface))
48 
49 GType mcp_request_get_type (void) G_GNUC_CONST;
50 
51 /* utility functions which will work on any implementation of this interface */
52 
53 gboolean mcp_request_find_request_by_type (McpRequest *self,
54     guint start_from, GQuark channel_type,
55     guint *ret_index, GHashTable **ret_ref_requested_properties);
56 
57 /* virtual methods */
58 
59 const gchar *mcp_request_get_account_path (McpRequest *self);
60 const gchar *mcp_request_get_protocol (McpRequest *self);
61 const gchar *mcp_request_get_cm_name (McpRequest *self);
62 
63 gint64 mcp_request_get_user_action_time (McpRequest *self);
64 guint mcp_request_get_n_requests (McpRequest *self);
65 GHashTable *mcp_request_ref_nth_request (McpRequest *self, guint n);
66 
67 void mcp_request_deny (McpRequest *self, GQuark domain, gint code,
68     const gchar *message);
69 
70 McpRequestDelay *mcp_request_start_delay (McpRequest *self);
71 void mcp_request_end_delay (McpRequest *self, McpRequestDelay *delay);
72 
73 G_END_DECLS
74 
75 #endif
76