1
/* Mission Control plugin API - representation of a ChannelRequest
3
* Copyright (C) 2009 Nokia Corporation
4
* Copyright (C) 2009 Collabora Ltd.
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.
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.
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
21
#include <mission-control-plugins/mission-control-plugins.h>
22
#include <mission-control-plugins/implementation.h>
24
#include <telepathy-glib/dbus.h>
25
#include <telepathy-glib/interfaces.h>
28
mcp_request_get_type (void)
30
static gsize once = 0;
31
static GType type = 0;
33
if (g_once_init_enter (&once))
35
static const GTypeInfo info = {
36
sizeof (McpRequestIface),
38
NULL, /* base_finalize */
39
NULL, /* class_init */
40
NULL, /* class_finalize */
41
NULL, /* class_data */
42
0, /* instance_size */
44
NULL, /* instance_init */
45
NULL /* value_table */
48
type = g_type_register_static (G_TYPE_INTERFACE, "McpRequest",
50
g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
52
g_once_init_leave (&once, 1);
59
mcp_request_get_account_path (McpRequest *self)
61
McpRequestIface *iface = MCP_REQUEST_GET_IFACE (self);
63
g_return_val_if_fail (iface != NULL, NULL);
64
g_return_val_if_fail (iface->get_account_path != NULL, NULL);
65
return iface->get_account_path (self);
69
mcp_request_get_protocol (McpRequest *self)
71
McpRequestIface *iface = MCP_REQUEST_GET_IFACE (self);
73
g_return_val_if_fail (iface != NULL, NULL);
74
g_return_val_if_fail (iface->get_protocol != NULL, NULL);
75
return iface->get_protocol (self);
79
mcp_request_get_cm_name (McpRequest *self)
81
McpRequestIface *iface = MCP_REQUEST_GET_IFACE (self);
83
g_return_val_if_fail (iface != NULL, NULL);
84
g_return_val_if_fail (iface->get_cm_name != NULL, NULL);
85
return iface->get_cm_name (self);
89
mcp_request_get_user_action_time (McpRequest *self)
91
McpRequestIface *iface = MCP_REQUEST_GET_IFACE (self);
93
g_return_val_if_fail (iface != NULL, 0);
94
g_return_val_if_fail (iface->get_user_action_time != NULL, 0);
95
return iface->get_user_action_time (self);
99
mcp_request_get_n_requests (McpRequest *self)
101
McpRequestIface *iface = MCP_REQUEST_GET_IFACE (self);
103
g_return_val_if_fail (iface != NULL, 0);
104
g_return_val_if_fail (iface->get_n_requests != NULL, 0);
105
return iface->get_n_requests (self);
109
mcp_request_ref_nth_request (McpRequest *self,
112
McpRequestIface *iface = MCP_REQUEST_GET_IFACE (self);
114
g_return_val_if_fail (iface != NULL, NULL);
115
g_return_val_if_fail (iface->ref_nth_request != NULL, NULL);
116
return iface->ref_nth_request (self, n);
120
mcp_request_deny (McpRequest *self,
123
const gchar *message)
125
McpRequestIface *iface = MCP_REQUEST_GET_IFACE (self);
127
g_return_if_fail (iface != NULL);
128
g_return_if_fail (domain != 0);
129
g_return_if_fail (message != NULL);
130
g_return_if_fail (iface->deny != NULL);
132
iface->deny (self, domain, code, message);
136
mcp_request_find_request_by_type (McpRequest *self,
140
GHashTable **ret_ref_requested_properties)
142
guint i = start_from;
146
GHashTable *req = mcp_request_ref_nth_request (self, i);
151
if (channel_type == 0 ||
152
channel_type == g_quark_try_string (
153
tp_asv_get_string (req, TP_IFACE_CHANNEL ".ChannelType")))
155
if (ret_index != NULL)
158
if (ret_ref_requested_properties != NULL)
159
*ret_ref_requested_properties = req;
161
g_hash_table_unref (req);
166
g_hash_table_unref (req);