~ubuntu-branches/ubuntu/precise/telepathy-mission-control-5/precise

« back to all changes in this revision

Viewing changes to mission-control-plugins/dispatch-operation-policy.c

Tags: upstream-5.5.0
ImportĀ upstreamĀ versionĀ 5.5.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Mission Control plugin API - ChannelDispatchOperation policy hook.
 
2
 *
 
3
 * Copyright (C) 2009 Nokia Corporation
 
4
 * Copyright (C) 2009 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
#include <mission-control-plugins/mission-control-plugins.h>
 
22
 
 
23
struct _McpDispatchOperationPolicyIface {
 
24
    GTypeInterface parent;
 
25
 
 
26
    void (*check) (McpDispatchOperationPolicy *, McpDispatchOperation *);
 
27
};
 
28
 
 
29
GType
 
30
mcp_dispatch_operation_policy_get_type (void)
 
31
{
 
32
  static gsize once = 0;
 
33
  static GType type = 0;
 
34
 
 
35
  if (g_once_init_enter (&once))
 
36
    {
 
37
      static const GTypeInfo info = {
 
38
          sizeof (McpDispatchOperationPolicyIface),
 
39
          NULL, /* base_init */
 
40
          NULL, /* base_finalize */
 
41
          NULL, /* class_init */
 
42
          NULL, /* class_finalize */
 
43
          NULL, /* class_data */
 
44
          0, /* instance_size */
 
45
          0, /* n_preallocs */
 
46
          NULL, /* instance_init */
 
47
          NULL /* value_table */
 
48
      };
 
49
 
 
50
      type = g_type_register_static (G_TYPE_INTERFACE,
 
51
          "McpDispatchOperationPolicy", &info, 0);
 
52
      g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
 
53
 
 
54
      g_once_init_leave (&once, 1);
 
55
    }
 
56
 
 
57
  return type;
 
58
}
 
59
 
 
60
void
 
61
mcp_dispatch_operation_policy_check (McpDispatchOperationPolicy *policy,
 
62
    McpDispatchOperation *dispatch_operation)
 
63
{
 
64
  McpDispatchOperationPolicyIface *iface =
 
65
    MCP_DISPATCH_OPERATION_POLICY_GET_IFACE (policy);
 
66
 
 
67
  g_return_if_fail (iface != NULL);
 
68
 
 
69
  if (iface->check != NULL)
 
70
    iface->check (policy, dispatch_operation);
 
71
}
 
72
 
 
73
void
 
74
mcp_dispatch_operation_policy_iface_implement_check (
 
75
    McpDispatchOperationPolicyIface *iface,
 
76
    void (*impl) (McpDispatchOperationPolicy *, McpDispatchOperation *))
 
77
{
 
78
  iface->check = impl;
 
79
}