aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-chatroom-manager.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-10-13 15:54:59 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-10-13 15:54:59 +0800
commitd9c01063fec33821f1aff0b37afa4ace240498c7 (patch)
tree42fa7725835a54b25c442800e6c110c61517bd7b /libempathy/empathy-chatroom-manager.c
parentf1520d6a028a5c615d26d4e61f03603cb7dbd3db (diff)
downloadgsoc2013-empathy-d9c01063fec33821f1aff0b37afa4ace240498c7.tar
gsoc2013-empathy-d9c01063fec33821f1aff0b37afa4ace240498c7.tar.gz
gsoc2013-empathy-d9c01063fec33821f1aff0b37afa4ace240498c7.tar.bz2
gsoc2013-empathy-d9c01063fec33821f1aff0b37afa4ace240498c7.tar.lz
gsoc2013-empathy-d9c01063fec33821f1aff0b37afa4ace240498c7.tar.xz
gsoc2013-empathy-d9c01063fec33821f1aff0b37afa4ace240498c7.tar.zst
gsoc2013-empathy-d9c01063fec33821f1aff0b37afa4ace240498c7.zip
chatroom-mgr: store the file when a chatroom changes its favorite state
svn path=/trunk/; revision=1564
Diffstat (limited to 'libempathy/empathy-chatroom-manager.c')
-rw-r--r--libempathy/empathy-chatroom-manager.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/libempathy/empathy-chatroom-manager.c b/libempathy/empathy-chatroom-manager.c
index 839e5da8e..add543172 100644
--- a/libempathy/empathy-chatroom-manager.c
+++ b/libempathy/empathy-chatroom-manager.c
@@ -232,6 +232,26 @@ empathy_chatroom_manager_new (const gchar *file)
return manager;
}
+static void
+chatroom_favorite_changed_cb (EmpathyChatroom *chatroom,
+ GParamSpec *spec,
+ EmpathyChatroomManager *self)
+{
+ chatroom_manager_file_save (self);
+}
+
+static void
+add_chatroom (EmpathyChatroomManager *self,
+ EmpathyChatroom *chatroom)
+{
+ EmpathyChatroomManagerPriv *priv = GET_PRIV (self);
+
+ priv->chatrooms = g_list_prepend (priv->chatrooms, g_object_ref (chatroom));
+
+ g_signal_connect (chatroom, "notify::favorite",
+ G_CALLBACK (chatroom_favorite_changed_cb), self);
+}
+
gboolean
empathy_chatroom_manager_add (EmpathyChatroomManager *manager,
EmpathyChatroom *chatroom)
@@ -247,7 +267,7 @@ empathy_chatroom_manager_add (EmpathyChatroomManager *manager,
if (!empathy_chatroom_manager_find (manager,
empathy_chatroom_get_account (chatroom),
empathy_chatroom_get_room (chatroom))) {
- priv->chatrooms = g_list_prepend (priv->chatrooms, g_object_ref (chatroom));
+ add_chatroom (manager, chatroom);
chatroom_manager_file_save (manager);
g_signal_emit (manager, signals[CHATROOM_ADDED], 0, chatroom);
@@ -517,7 +537,7 @@ chatroom_manager_parse_chatroom (EmpathyChatroomManager *manager,
chatroom = empathy_chatroom_new_full (account, room, name, auto_connect);
g_object_set (chatroom, "favorite", TRUE, NULL);
- priv->chatrooms = g_list_prepend (priv->chatrooms, chatroom);
+ add_chatroom (manager, chatroom);
g_signal_emit (manager, signals[CHATROOM_ADDED], 0, chatroom);
g_object_unref (account);