From 4ce14ebec31f60a4a6bdd781f88607731912f557 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Wed, 13 Jun 2007 21:58:16 +0000 Subject: New window for viewing logs. 2007-06-13 Xavier Claessens * libempathy-gtk/Makefile.am: * libempathy-gtk/gossip-log-window.glade: * libempathy-gtk/gossip-log-window.h: * libempathy-gtk/gossip-log-window.c: * libempathy/empathy-log-manager.c: * libempathy/empathy-log-manager.h: * libempathy-gtk/gossip-chat.c: * libempathy-gtk/empathy-main-window.c: New window for viewing logs. * libempathy-gtk/gossip-chat-view.c: Do not use smooth scroll when resizing the view. * libempathy-gtk/gossip-contact-list-store.c: Do not set active contacts when creating the store, and when contact groups changed. * src/empathy-main.c: Fix warning when using command-line options. * libempathy/empathy-tp-contact-list.c: Check if we have an aliasing iface before setting the alias of a contact. * TODO: Updated. * data/jabber.profile: Ignore ssl errors by default. This is a security vulnerability but we don't really have the choice. * libempathy/gossip-contact.h: * libempathy/gossip-contact.c: Add a "is-user" property to know if it's our self contact. * libempathy/gossip-message.h: * libempathy/gossip-message.c: Add a "receiver" property like that we have our self contact for nick highlight. svn path=/trunk/; revision=148 --- libempathy/gossip-message.c | 56 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 4 deletions(-) (limited to 'libempathy/gossip-message.c') diff --git a/libempathy/gossip-message.c b/libempathy/gossip-message.c index c4844e655..a46a2a5dc 100644 --- a/libempathy/gossip-message.c +++ b/libempathy/gossip-message.c @@ -33,6 +33,7 @@ typedef struct _GossipMessagePriv GossipMessagePriv; struct _GossipMessagePriv { GossipMessageType type; GossipContact *sender; + GossipContact *receiver; gchar *body; GossipTime timestamp; @@ -54,6 +55,7 @@ enum { PROP_0, PROP_TYPE, PROP_SENDER, + PROP_RECEIVER, PROP_BODY, PROP_TIMESTAMP, }; @@ -114,7 +116,13 @@ gossip_message_class_init (GossipMessageClass *class) "The sender of the message", GOSSIP_TYPE_CONTACT, G_PARAM_READWRITE)); - + g_object_class_install_property (object_class, + PROP_RECEIVER, + g_param_spec_object ("receiver", + "Message Receiver", + "The receiver of the message", + GOSSIP_TYPE_CONTACT, + G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_BODY, g_param_spec_string ("body", @@ -144,9 +152,6 @@ gossip_message_init (GossipMessage *message) priv = GET_PRIV (message); - priv->type = GOSSIP_MESSAGE_TYPE_NORMAL; - priv->sender = NULL; - priv->body = NULL; priv->timestamp = gossip_time_get_current (); } @@ -160,6 +165,9 @@ gossip_message_finalize (GObject *object) if (priv->sender) { g_object_unref (priv->sender); } + if (priv->receiver) { + g_object_unref (priv->receiver); + } g_free (priv->body); @@ -183,6 +191,9 @@ message_get_property (GObject *object, case PROP_SENDER: g_value_set_object (value, priv->sender); break; + case PROP_RECEIVER: + g_value_set_object (value, priv->receiver); + break; case PROP_BODY: g_value_set_string (value, priv->body); break; @@ -211,6 +222,10 @@ message_set_property (GObject *object, gossip_message_set_sender (GOSSIP_MESSAGE (object), GOSSIP_CONTACT (g_value_get_object (value))); break; + case PROP_RECEIVER: + gossip_message_set_receiver (GOSSIP_MESSAGE (object), + GOSSIP_CONTACT (g_value_get_object (value))); + break; case PROP_BODY: gossip_message_set_body (GOSSIP_MESSAGE (object), g_value_get_string (value)); @@ -290,6 +305,39 @@ gossip_message_set_sender (GossipMessage *message, GossipContact *contact) g_object_notify (G_OBJECT (message), "sender"); } +GossipContact * +gossip_message_get_receiver (GossipMessage *message) +{ + GossipMessagePriv *priv; + + g_return_val_if_fail (GOSSIP_IS_MESSAGE (message), NULL); + + priv = GET_PRIV (message); + + return priv->receiver; +} + +void +gossip_message_set_receiver (GossipMessage *message, GossipContact *contact) +{ + GossipMessagePriv *priv; + GossipContact *old_receiver; + + g_return_if_fail (GOSSIP_IS_MESSAGE (message)); + g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + + priv = GET_PRIV (message); + + old_receiver = priv->receiver; + priv->receiver = g_object_ref (contact); + + if (old_receiver) { + g_object_unref (old_receiver); + } + + g_object_notify (G_OBJECT (message), "receiver"); +} + const gchar * gossip_message_get_body (GossipMessage *message) { -- cgit v1.2.3