aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-02-26 21:31:27 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-02-26 21:31:27 +0800
commit049b44f2b14fb6bf14751ec8374366d336237c6b (patch)
tree5bebb68c4b86dd998fcc09e52c29b02dcaacc315 /libempathy
parenta0ee1678efd3c01d3856c324b8e29fd591d75dd4 (diff)
downloadgsoc2013-empathy-049b44f2b14fb6bf14751ec8374366d336237c6b.tar
gsoc2013-empathy-049b44f2b14fb6bf14751ec8374366d336237c6b.tar.gz
gsoc2013-empathy-049b44f2b14fb6bf14751ec8374366d336237c6b.tar.bz2
gsoc2013-empathy-049b44f2b14fb6bf14751ec8374366d336237c6b.tar.lz
gsoc2013-empathy-049b44f2b14fb6bf14751ec8374366d336237c6b.tar.xz
gsoc2013-empathy-049b44f2b14fb6bf14751ec8374366d336237c6b.tar.zst
gsoc2013-empathy-049b44f2b14fb6bf14751ec8374366d336237c6b.zip
Watch name owner changes to know when s-e falls off the bus.
svn path=/trunk/; revision=671
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-tp-call.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/libempathy/empathy-tp-call.c b/libempathy/empathy-tp-call.c
index 25c47cd2c..f92aef492 100644
--- a/libempathy/empathy-tp-call.c
+++ b/libempathy/empathy-tp-call.c
@@ -25,6 +25,7 @@
#include <libtelepathy/tp-connmgr.h>
#include <libtelepathy/tp-helpers.h>
#include <telepathy-glib/proxy-subclass.h>
+#include <telepathy-glib/dbus.h>
#include <libmissioncontrol/mc-account.h>
@@ -51,6 +52,7 @@ struct _EmpathyTpCallPriv
TpConn *connection;
TpChan *channel;
TpProxy *stream_engine;
+ TpDBusDaemon *dbus_daemon;
EmpathyTpGroup *group;
EmpathyContact *contact;
gboolean is_incoming;
@@ -503,6 +505,19 @@ tp_call_invalidated_cb (TpProxy *stream_engine,
}
static void
+tp_call_watch_name_owner_cb (TpDBusDaemon *daemon,
+ const gchar *name,
+ const gchar *new_owner,
+ gpointer call)
+{
+ if (G_STR_EMPTY (new_owner))
+ {
+ empathy_debug (DEBUG_DOMAIN, "Stream engine falled off the bus");
+ empathy_tp_call_close_channel (call);
+ }
+}
+
+static void
tp_call_start_stream_engine (EmpathyTpCall *call)
{
EmpathyTpCallPriv *priv = GET_PRIV (call);
@@ -521,6 +536,11 @@ tp_call_start_stream_engine (EmpathyTpCall *call)
g_signal_connect (priv->stream_engine, "invalidated",
G_CALLBACK (tp_call_invalidated_cb),
call);
+
+ priv->dbus_daemon = tp_dbus_daemon_new (tp_get_bus ());
+ tp_dbus_daemon_watch_name_owner (priv->dbus_daemon, STREAM_ENGINE_BUS_NAME,
+ tp_call_watch_name_owner_cb,
+ call, NULL);
emp_cli_channel_handler_call_handle_channel (priv->stream_engine, -1,
dbus_g_proxy_get_bus_name (DBUS_G_PROXY (priv->connection)),
@@ -607,9 +627,12 @@ tp_call_finalize (GObject *object)
if (priv->stream_engine != NULL)
g_object_unref (priv->stream_engine);
- if (priv->contact)
+ if (priv->contact != NULL)
g_object_unref (priv->contact);
+ if (priv->dbus_daemon != NULL)
+ g_object_unref (priv->dbus_daemon);
+
(G_OBJECT_CLASS (empathy_tp_call_parent_class)->finalize) (object);
}