diff options
author | Sjoerd Simons <sjoerd@luon.net> | 2008-02-16 03:08:54 +0800 |
---|---|---|
committer | Sjoerd Simons <sjoerd@luon.net> | 2008-02-16 03:08:54 +0800 |
commit | 977b799331bea35a58fb07dde467ec7914d94fb1 (patch) | |
tree | 3f4df8f42df046dd1e640d9aa72f67d33556b76f /libempathy/empathy-utils.c | |
parent | 295b1892fd68f7acbe0abb19852c556cd0df2a6e (diff) | |
download | gsoc2013-empathy-977b799331bea35a58fb07dde467ec7914d94fb1.tar gsoc2013-empathy-977b799331bea35a58fb07dde467ec7914d94fb1.tar.gz gsoc2013-empathy-977b799331bea35a58fb07dde467ec7914d94fb1.tar.bz2 gsoc2013-empathy-977b799331bea35a58fb07dde467ec7914d94fb1.tar.lz gsoc2013-empathy-977b799331bea35a58fb07dde467ec7914d94fb1.tar.xz gsoc2013-empathy-977b799331bea35a58fb07dde467ec7914d94fb1.tar.zst gsoc2013-empathy-977b799331bea35a58fb07dde467ec7914d94fb1.zip |
Make empathy_call_with_contact_id wait untill the handle for the contact is
discovered, before calling empathy_call_with_contact
Diffstat (limited to 'libempathy/empathy-utils.c')
-rw-r--r-- | libempathy/empathy-utils.c | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c index 8c6edafc5..2bcdfe1a6 100644 --- a/libempathy/empathy-utils.c +++ b/libempathy/empathy-utils.c @@ -456,6 +456,28 @@ empathy_call_with_contact (EmpathyContact *contact) #endif } +#ifdef HAVE_VOIP +struct empathy_call_cb_user_data { + guint handler; + GObject *factory; +}; + +static void +empathy_call_with_contact_id_got_handle_cb (EmpathyContact *contact, + GParamSpec *property, gpointer user_data) { + + struct empathy_call_cb_user_data *ud = + (struct empathy_call_cb_user_data *) user_data; + + g_signal_handler_disconnect (contact, ud->handler); + + empathy_call_with_contact (contact); + g_object_unref (ud->factory); + g_object_unref (contact); + g_free (ud); +} +#endif + void empathy_call_with_contact_id (McAccount *account, const gchar *contact_id) { @@ -465,9 +487,19 @@ empathy_call_with_contact_id (McAccount *account, const gchar *contact_id) factory = empathy_contact_factory_new (); contact = empathy_contact_factory_get_from_id (factory, account, contact_id); - empathy_call_with_contact (contact); - g_object_unref (contact); - g_object_unref (factory); + + if (empathy_contact_get_handle (contact) != 0) { + empathy_call_with_contact (contact); + g_object_unref (contact); + g_object_unref (factory); + } else { + struct empathy_call_cb_user_data *ud; + ud = g_malloc0 (sizeof (struct empathy_call_cb_user_data)); + ud->factory = G_OBJECT (factory); + ud->handler = g_signal_connect (G_OBJECT (contact), "notify::handle", + G_CALLBACK (empathy_call_with_contact_id_got_handle_cb), ud); + } + #endif } |