diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2009-01-07 00:47:22 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2009-01-07 00:47:22 +0800 |
commit | 78d63cbc4b87ec4bad3a844a9bd4400e1e71c613 (patch) | |
tree | cc74aeec3830b2e720a3b2e9b1315e694522c1e8 | |
parent | 0004ebaad62474cfa2eb5f5c6bf8f29b6e6e4070 (diff) | |
download | gsoc2013-empathy-78d63cbc4b87ec4bad3a844a9bd4400e1e71c613.tar gsoc2013-empathy-78d63cbc4b87ec4bad3a844a9bd4400e1e71c613.tar.gz gsoc2013-empathy-78d63cbc4b87ec4bad3a844a9bd4400e1e71c613.tar.bz2 gsoc2013-empathy-78d63cbc4b87ec4bad3a844a9bd4400e1e71c613.tar.lz gsoc2013-empathy-78d63cbc4b87ec4bad3a844a9bd4400e1e71c613.tar.xz gsoc2013-empathy-78d63cbc4b87ec4bad3a844a9bd4400e1e71c613.tar.zst gsoc2013-empathy-78d63cbc4b87ec4bad3a844a9bd4400e1e71c613.zip |
Add a "presence-changed" signal so that we can keep track of the
previous presence of a contact when it changes.
svn path=/trunk/; revision=2051
-rw-r--r-- | libempathy/empathy-contact.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c index 314082b86..541858673 100644 --- a/libempathy/empathy-contact.c +++ b/libempathy/empathy-contact.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */ /* * Copyright (C) 2004 Imendio AB * Copyright (C) 2007-2008 Collabora Ltd. @@ -30,10 +30,12 @@ #include <glib/gi18n-lib.h> #include <telepathy-glib/util.h> +#include <libmissioncontrol/mc-enum-types.h> #include "empathy-contact.h" #include "empathy-utils.h" #include "empathy-enum-types.h" +#include "empathy-marshal.h" #define DEBUG_FLAG EMPATHY_DEBUG_CONTACT #include "empathy-debug.h" @@ -76,6 +78,13 @@ enum PROP_READY }; +enum { + PRESENCE_CHANGED, + LAST_SIGNAL +}; + +static guint signals[LAST_SIGNAL]; + static void empathy_contact_class_init (EmpathyContactClass *class) { @@ -173,6 +182,17 @@ empathy_contact_class_init (EmpathyContactClass *class) EMPATHY_CONTACT_READY_NONE, G_PARAM_READABLE)); + signals[PRESENCE_CHANGED] = + g_signal_new ("presence-changed", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + _empathy_marshal_VOID__ENUM_ENUM, + G_TYPE_NONE, + 2, MC_TYPE_PRESENCE, + MC_TYPE_PRESENCE); + g_type_class_add_private (object_class, sizeof (EmpathyContactPriv)); } @@ -506,6 +526,7 @@ empathy_contact_set_presence (EmpathyContact *contact, McPresence presence) { EmpathyContactPriv *priv; + McPresence old_presence; g_return_if_fail (EMPATHY_IS_CONTACT (contact)); @@ -514,8 +535,11 @@ empathy_contact_set_presence (EmpathyContact *contact, if (presence == priv->presence) return; + old_presence = priv->presence; priv->presence = presence; + g_signal_emit (contact, signals[PRESENCE_CHANGED], 0, presence, old_presence); + g_object_notify (G_OBJECT (contact), "presence"); } |