summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivek Dasmohapatra <vivek@collabora.co.uk>2011-03-24 19:48:47 +0000
committerVivek Dasmohapatra <vivek@collabora.co.uk>2011-04-05 14:19:10 +0100
commit5dcb0986d3473033491fd06f944c9e3b64ec4f09 (patch)
tree946a0fb4cec1e6e425028c172287538f00e5f401
parent1e23d9051b6f001e2ae77557783248ae1d7f5c33 (diff)
downloadtelepathy-mission-control-5dcb0986d3473033491fd06f944c9e3b64ec4f09.tar.gz
Tidy up the code used to set/check whether a dispatch operation is internal
-rw-r--r--src/mcd-dispatch-operation-priv.h4
-rw-r--r--src/mcd-dispatch-operation.c8
-rw-r--r--src/mcd-dispatcher.c11
3 files changed, 21 insertions, 2 deletions
diff --git a/src/mcd-dispatch-operation-priv.h b/src/mcd-dispatch-operation-priv.h
index 4bb7abf7..c92289c2 100644
--- a/src/mcd-dispatch-operation-priv.h
+++ b/src/mcd-dispatch-operation-priv.h
@@ -49,6 +49,7 @@ struct _McdDispatchOperationClass
GObjectClass parent_class;
};
+#define CDO_INTERNAL_HANDLER ""
#define MC_DISPATCH_OPERATION_DBUS_OBJECT_BASE "/org/freedesktop/Telepathy/DispatchOperation/"
@@ -115,6 +116,9 @@ G_GNUC_INTERNAL void _mcd_dispatch_operation_destroy_channels (
G_GNUC_INTERNAL void _mcd_dispatch_operation_forget_channels (
McdDispatchOperation *self);
+G_GNUC_INTERNAL gboolean _mcd_dispatch_operation_is_internal (
+ McdDispatchOperation *self);
+
G_END_DECLS
#endif
diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c
index 5724bb4d..df9703da 100644
--- a/src/mcd-dispatch-operation.c
+++ b/src/mcd-dispatch-operation.c
@@ -363,6 +363,14 @@ _mcd_dispatch_operation_get_cancelled (McdDispatchOperation *self)
return self->priv->cancelled;
}
+gboolean
+_mcd_dispatch_operation_is_internal (McdDispatchOperation *self)
+{
+ const gchar **handlers = self->priv->possible_handlers;
+
+ return (handlers != NULL && !tp_strdiff (CDO_INTERNAL_HANDLER, *handlers));
+}
+
static inline gboolean
_mcd_dispatch_operation_is_approved (McdDispatchOperation *self)
{
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index 02742494..04633955 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -294,6 +294,14 @@ channel_classes_equals (GHashTable *channel_class1, GHashTable *channel_class2)
}
static GStrv
+mcd_dispatcher_dup_internal_handlers ()
+{
+ const gchar * const internal_handlers[] = { CDO_INTERNAL_HANDLER, NULL };
+
+ return g_strdupv ((GStrv) internal_handlers);
+}
+
+static GStrv
mcd_dispatcher_dup_possible_handlers (McdDispatcher *self,
McdRequest *request,
const GList *channels,
@@ -1338,7 +1346,6 @@ _mcd_dispatcher_take_channels (McdDispatcher *dispatcher, GList *channels,
GStrv possible_handlers;
McdRequest *request = NULL;
gboolean internal_request = FALSE;
- const gchar * const internal_handlers[] = { "", NULL };
if (channels == NULL)
{
@@ -1385,7 +1392,7 @@ _mcd_dispatcher_take_channels (McdDispatcher *dispatcher, GList *channels,
/* See if there are any handlers that can take all these channels */
if (internal_request)
- possible_handlers = g_strdupv ((GStrv) internal_handlers);
+ possible_handlers = mcd_dispatcher_dup_internal_handlers ();
else
possible_handlers = mcd_dispatcher_dup_possible_handlers (dispatcher,
request,