[telepathy-mission-control/master] McdDispatchOperation: add an accessor for the unique name of the process that claimed us

Simon McVittie simon.mcvittie at collabora.co.uk
Tue May 26 05:43:21 PDT 2009


---
 src/mcd-dispatch-operation-priv.h |    2 ++
 src/mcd-dispatch-operation.c      |   15 ++++++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/mcd-dispatch-operation-priv.h b/src/mcd-dispatch-operation-priv.h
index cd0fe50..16ceb37 100644
--- a/src/mcd-dispatch-operation-priv.h
+++ b/src/mcd-dispatch-operation-priv.h
@@ -41,6 +41,8 @@ G_GNUC_INTERNAL void _mcd_dispatch_operation_block_finished (
     McdDispatchOperation *self);
 G_GNUC_INTERNAL void _mcd_dispatch_operation_unblock_finished (
     McdDispatchOperation *self);
+G_GNUC_INTERNAL const gchar *_mcd_dispatch_operation_get_claimer (
+    McdDispatchOperation *operation);
 
 G_END_DECLS
 
diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c
index 61eeb42..3d95e1f 100644
--- a/src/mcd-dispatch-operation.c
+++ b/src/mcd-dispatch-operation.c
@@ -32,6 +32,8 @@
 #include <string.h>
 
 #include <dbus/dbus.h>
+#include <dbus/dbus-glib-lowlevel.h>
+
 #include <glib/gi18n.h>
 #include <glib/gstdio.h>
 #include <telepathy-glib/gtypes.h>
@@ -80,8 +82,8 @@ struct _McdDispatchOperationPrivate
 
     /* Results */
     guint finished : 1;
-    guint claimed : 1;
     gchar *handler;
+    gchar *claimer;
 
     /* DBUS connection */
     TpDBusDaemon *dbus_daemon;
@@ -263,7 +265,7 @@ dispatch_operation_claim (McSvcChannelDispatchOperation *self,
         return;
     }
 
-    priv->claimed = TRUE;
+    priv->claimer = dbus_g_method_get_sender (context);
     mc_svc_channel_dispatch_operation_return_from_claim (context);
 
     mcd_dispatch_operation_finish (MCD_DISPATCH_OPERATION (self));
@@ -585,7 +587,14 @@ gboolean
 mcd_dispatch_operation_is_claimed (McdDispatchOperation *operation)
 {
     g_return_val_if_fail (MCD_IS_DISPATCH_OPERATION (operation), FALSE);
-    return operation->priv->claimed;
+    return (operation->priv->claimer != NULL);
+}
+
+const gchar *
+_mcd_dispatch_operation_get_claimer (McdDispatchOperation *operation)
+{
+    g_return_val_if_fail (MCD_IS_DISPATCH_OPERATION (operation), NULL);
+    return operation->priv->claimer;
 }
 
 /*
-- 
1.5.6.5




More information about the telepathy-commits mailing list