empathy r2051 - trunk/libempathy
- From: xclaesse svn gnome org
- To: svn-commits-list gnome org
- Subject: empathy r2051 - trunk/libempathy
- Date: Tue, 6 Jan 2009 16:47:22 +0000 (UTC)
Author: xclaesse
Date: Tue Jan 6 16:47:22 2009
New Revision: 2051
URL: http://svn.gnome.org/viewvc/empathy?rev=2051&view=rev
Log:
Add a "presence-changed" signal so that we can keep track of the
previous presence of a contact when it changes.
Modified:
trunk/libempathy/empathy-contact.c
Modified: trunk/libempathy/empathy-contact.c
==============================================================================
--- trunk/libempathy/empathy-contact.c (original)
+++ trunk/libempathy/empathy-contact.c Tue Jan 6 16:47:22 2009
@@ -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 @@
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_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 @@
McPresence presence)
{
EmpathyContactPriv *priv;
+ McPresence old_presence;
g_return_if_fail (EMPATHY_IS_CONTACT (contact));
@@ -514,8 +535,11 @@
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");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]