aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-chatroom.c
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy/empathy-chatroom.c')
-rw-r--r--libempathy/empathy-chatroom.c47
1 files changed, 45 insertions, 2 deletions
diff --git a/libempathy/empathy-chatroom.c b/libempathy/empathy-chatroom.c
index 0920c8a14..16707bd15 100644
--- a/libempathy/empathy-chatroom.c
+++ b/libempathy/empathy-chatroom.c
@@ -35,7 +35,8 @@ typedef struct {
gchar *room;
gchar *name;
gboolean auto_connect;
- gboolean favorite;
+ gboolean favorite;
+ EmpathyTpChat *tp_chat;
} EmpathyChatroomPriv;
@@ -55,7 +56,8 @@ enum {
PROP_ROOM,
PROP_NAME,
PROP_AUTO_CONNECT,
- PROP_FAVORITE,
+ PROP_FAVORITE,
+ PROP_TP_CHAT,
};
G_DEFINE_TYPE (EmpathyChatroom, empathy_chatroom, G_TYPE_OBJECT);
@@ -113,6 +115,14 @@ empathy_chatroom_class_init (EmpathyChatroomClass *klass)
G_PARAM_STATIC_NICK |
G_PARAM_STATIC_BLURB));
+ g_object_class_install_property (object_class,
+ PROP_TP_CHAT,
+ g_param_spec_object ("tp-chat",
+ "Chatroom channel wrapper",
+ "The wrapper for the chatroom channel if there is one",
+ EMPATHY_TYPE_TP_CHAT,
+ G_PARAM_READWRITE));
+
g_type_class_add_private (object_class, sizeof (EmpathyChatroomPriv));
}
@@ -132,6 +142,9 @@ chatroom_finalize (GObject *object)
priv = GET_PRIV (object);
+ if (priv->tp_chat != NULL)
+ g_object_unref (priv->tp_chat);
+
g_object_unref (priv->account);
g_free (priv->room);
g_free (priv->name);
@@ -165,6 +178,9 @@ chatroom_get_property (GObject *object,
case PROP_FAVORITE:
g_value_set_boolean (value, priv->favorite);
break;
+ case PROP_TP_CHAT:
+ g_value_set_object (value, priv->tp_chat);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -206,6 +222,22 @@ chatroom_set_property (GObject *object,
FALSE);
}
break;
+ case PROP_TP_CHAT: {
+ GObject *chat = g_value_dup_object (value);
+
+ if (chat == (GObject *) priv->tp_chat)
+ break;
+
+ g_assert (chat == NULL || priv->tp_chat == NULL);
+
+ if (priv->tp_chat != NULL) {
+ g_object_unref (priv->tp_chat);
+ priv->tp_chat = NULL;
+ } else {
+ priv->tp_chat = EMPATHY_TP_CHAT (chat);
+ }
+ break;
+ }
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -389,3 +421,14 @@ empathy_chatroom_equal (gconstpointer v1,
return empathy_account_equal (account_a, account_b) && !tp_strdiff (room_a,
room_b);
}
+
+EmpathyTpChat *
+empathy_chatroom_get_tp_chat (EmpathyChatroom *chatroom) {
+ EmpathyChatroomPriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_CHATROOM (chatroom), NULL);
+
+ priv = GET_PRIV (chatroom);
+
+ return priv->tp_chat;
+}