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
24
* @short_description: Request object, implemented by Mission Control
25
* @see_also: #McpRequestPolicy
26
* @include: mission-control-plugins/mission-control-plugins.h
29
#include <mission-control-plugins/mission-control-plugins.h>
30
#include <mission-control-plugins/implementation.h>
32
#include <telepathy-glib/dbus.h>
33
#include <telepathy-glib/interfaces.h>
36
mcp_request_get_type (void)
38
static gsize once = 0;
39
static GType type = 0;
41
if (g_once_init_enter (&once))
43
static const GTypeInfo info = {
44
sizeof (McpRequestIface),
46
NULL, /* base_finalize */
47
NULL, /* class_init */
48
NULL, /* class_finalize */
49
NULL, /* class_data */
50
0, /* instance_size */
52
NULL, /* instance_init */
53
NULL /* value_table */
56
type = g_type_register_static (G_TYPE_INTERFACE, "McpRequest",
58
g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
60
g_once_init_leave (&once, 1);
67
mcp_request_get_account_path (McpRequest *self)
69
McpRequestIface *iface = MCP_REQUEST_GET_IFACE (self);
71
g_return_val_if_fail (iface != NULL, NULL);
72
g_return_val_if_fail (iface->get_account_path != NULL, NULL);
73
return iface->get_account_path (self);
77
mcp_request_get_protocol (McpRequest *self)
79
McpRequestIface *iface = MCP_REQUEST_GET_IFACE (self);
81
g_return_val_if_fail (iface != NULL, NULL);
82
g_return_val_if_fail (iface->get_protocol != NULL, NULL);
83
return iface->get_protocol (self);
87
mcp_request_get_cm_name (McpRequest *self)
89
McpRequestIface *iface = MCP_REQUEST_GET_IFACE (self);
91
g_return_val_if_fail (iface != NULL, NULL);
92
g_return_val_if_fail (iface->get_cm_name != NULL, NULL);
93
return iface->get_cm_name (self);
97
mcp_request_get_user_action_time (McpRequest *self)
99
McpRequestIface *iface = MCP_REQUEST_GET_IFACE (self);
101
g_return_val_if_fail (iface != NULL, 0);
102
g_return_val_if_fail (iface->get_user_action_time != NULL, 0);
103
return iface->get_user_action_time (self);
107
mcp_request_get_n_requests (McpRequest *self)
109
McpRequestIface *iface = MCP_REQUEST_GET_IFACE (self);
111
g_return_val_if_fail (iface != NULL, 0);
112
g_return_val_if_fail (iface->get_n_requests != NULL, 0);
113
return iface->get_n_requests (self);
117
mcp_request_ref_nth_request (McpRequest *self,
120
McpRequestIface *iface = MCP_REQUEST_GET_IFACE (self);
122
g_return_val_if_fail (iface != NULL, NULL);
123
g_return_val_if_fail (iface->ref_nth_request != NULL, NULL);
124
return iface->ref_nth_request (self, n);
128
mcp_request_deny (McpRequest *self,
131
const gchar *message)
133
McpRequestIface *iface = MCP_REQUEST_GET_IFACE (self);
135
g_return_if_fail (iface != NULL);
136
g_return_if_fail (domain != 0);
137
g_return_if_fail (message != NULL);
138
g_return_if_fail (iface->deny != NULL);
140
iface->deny (self, domain, code, message);
144
mcp_request_find_request_by_type (McpRequest *self,
148
GHashTable **ret_ref_requested_properties)
150
guint i = start_from;
154
GHashTable *req = mcp_request_ref_nth_request (self, i);
159
if (channel_type == 0 ||
160
channel_type == g_quark_try_string (
161
tp_asv_get_string (req, TP_IFACE_CHANNEL ".ChannelType")))
163
if (ret_index != NULL)
166
if (ret_ref_requested_properties != NULL)
167
*ret_ref_requested_properties = req;
169
g_hash_table_unref (req);
174
g_hash_table_unref (req);