aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-contact.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-04-11 21:10:34 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-04-11 21:10:34 +0800
commit6ff47c69851682968332a7eb55fbf1b7e13d1ed4 (patch)
treedba1460f554f941b6b09b58208be411ba09f847b /libempathy/empathy-contact.c
parent3346d34f028b478093817ab18d8c8591e7319dad (diff)
downloadgsoc2013-empathy-6ff47c69851682968332a7eb55fbf1b7e13d1ed4.tar
gsoc2013-empathy-6ff47c69851682968332a7eb55fbf1b7e13d1ed4.tar.gz
gsoc2013-empathy-6ff47c69851682968332a7eb55fbf1b7e13d1ed4.tar.bz2
gsoc2013-empathy-6ff47c69851682968332a7eb55fbf1b7e13d1ed4.tar.lz
gsoc2013-empathy-6ff47c69851682968332a7eb55fbf1b7e13d1ed4.tar.xz
gsoc2013-empathy-6ff47c69851682968332a7eb55fbf1b7e13d1ed4.tar.zst
gsoc2013-empathy-6ff47c69851682968332a7eb55fbf1b7e13d1ed4.zip
Make use of empathy_run_until_ready_full
svn path=/trunk/; revision=893
Diffstat (limited to 'libempathy/empathy-contact.c')
-rw-r--r--libempathy/empathy-contact.c55
1 files changed, 10 insertions, 45 deletions
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index d1c6b8284..636fb5e8c 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -752,23 +752,16 @@ empathy_contact_hash (gconstpointer key)
return priv->hash;
}
-typedef struct {
- EmpathyContactReady ready;
- GMainLoop *loop;
-} RunUntilReadyData;
-
-static void
-contact_ready_notify_cb (EmpathyContact *contact,
- GParamSpec *param,
- RunUntilReadyData *data)
+static gboolean
+contact_is_ready_func (GObject *contact,
+ gpointer user_data)
{
EmpathyContactPriv *priv = GET_PRIV (contact);
+ EmpathyContactReady ready;
- if ((priv->ready & data->ready) == data->ready) {
- empathy_debug (DEBUG_DOMAIN, "contact %s (%d) ready %d",
- priv->id, priv->handle, priv->ready);
- g_main_loop_quit (data->loop);
- }
+ ready = GPOINTER_TO_UINT (user_data);
+
+ return (priv->ready & ready) == ready;
}
void
@@ -776,36 +769,8 @@ empathy_contact_run_until_ready (EmpathyContact *contact,
EmpathyContactReady ready,
GMainLoop **loop)
{
- EmpathyContactPriv *priv = GET_PRIV (contact);
- RunUntilReadyData data;
- gulong signal_id;
-
- g_return_if_fail (EMPATHY_IS_CONTACT (contact));
-
- if ((priv->ready & ready) == ready) {
- return;
- }
-
- empathy_debug (DEBUG_DOMAIN, "Run until ready=%d for contact %s (%d)",
- ready, priv->id, priv->handle);
-
- data.ready = ready;
- data.loop = g_main_loop_new (NULL, FALSE);
-
- signal_id = g_signal_connect (contact, "notify::ready",
- G_CALLBACK (contact_ready_notify_cb),
- &data);
- if (loop != NULL) {
- *loop = data.loop;
- }
-
- g_main_loop_run (data.loop);
-
- if (loop != NULL) {
- *loop = NULL;
- }
-
- g_signal_handler_disconnect (contact, signal_id);
- g_main_loop_unref (data.loop);
+ empathy_run_until_ready_full (contact, "notify::ready",
+ contact_is_ready_func, GUINT_TO_POINTER (ready),
+ loop);
}