aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/gossip-chatrooms-window.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2007-06-02 04:25:05 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2007-06-02 04:25:05 +0800
commit9223336edde583afe690a3757d71188ed6ebf16d (patch)
tree1554ddeff64a9fcdb14978076ce6cb63a29d0aeb /libempathy-gtk/gossip-chatrooms-window.c
parent7a99a96e5b81b8d573104d1809364d5969b6b83d (diff)
downloadgsoc2013-empathy-9223336edde583afe690a3757d71188ed6ebf16d.tar
gsoc2013-empathy-9223336edde583afe690a3757d71188ed6ebf16d.tar.gz
gsoc2013-empathy-9223336edde583afe690a3757d71188ed6ebf16d.tar.bz2
gsoc2013-empathy-9223336edde583afe690a3757d71188ed6ebf16d.tar.lz
gsoc2013-empathy-9223336edde583afe690a3757d71188ed6ebf16d.tar.xz
gsoc2013-empathy-9223336edde583afe690a3757d71188ed6ebf16d.tar.zst
gsoc2013-empathy-9223336edde583afe690a3757d71188ed6ebf16d.zip
Monitor changes on chatrooms.xml file and relead it when it's modified.
2007-06-01 Xavier Claessens <xclaesse@gmail.com> * libempathy-gtk/gossip-chatrooms-window.c: * libempathy-gtk/gossip-chat-window.c: * libempathy/gossip-chatroom.c: * libempathy/gossip-chatroom-manager.c: * configure.ac: Monitor changes on chatrooms.xml file and relead it when it's modified. connect chatroom-added/removed in some places where needed. svn path=/trunk/; revision=111
Diffstat (limited to 'libempathy-gtk/gossip-chatrooms-window.c')
-rw-r--r--libempathy-gtk/gossip-chatrooms-window.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/libempathy-gtk/gossip-chatrooms-window.c b/libempathy-gtk/gossip-chatrooms-window.c
index 5ff5d8812..4d4333e8d 100644
--- a/libempathy-gtk/gossip-chatrooms-window.c
+++ b/libempathy-gtk/gossip-chatrooms-window.c
@@ -84,6 +84,13 @@ static void chatrooms_window_button_close_clicked_cb (GtkWid
static void chatrooms_window_chatroom_added_cb (GossipChatroomManager *manager,
GossipChatroom *chatroom,
GossipChatroomsWindow *window);
+static void chatrooms_window_chatroom_removed_cb (GossipChatroomManager *manager,
+ GossipChatroom *chatroom,
+ GossipChatroomsWindow *window);
+static gboolean chatrooms_window_remove_chatroom_foreach (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ GossipChatroom *chatroom);
static void chatrooms_window_account_changed_cb (GtkWidget *combo_box,
GossipChatroomsWindow *window);
@@ -139,6 +146,9 @@ gossip_chatrooms_window_show (GtkWindow *parent)
g_signal_connect (window->manager, "chatroom-added",
G_CALLBACK (chatrooms_window_chatroom_added_cb),
window);
+ g_signal_connect (window->manager, "chatroom-removed",
+ G_CALLBACK (chatrooms_window_chatroom_removed_cb),
+ window);
/* Account chooser for chat rooms */
window->account_chooser = gossip_account_chooser_new ();
@@ -522,6 +532,41 @@ chatrooms_window_chatroom_added_cb (GossipChatroomManager *manager,
}
static void
+chatrooms_window_chatroom_removed_cb (GossipChatroomManager *manager,
+ GossipChatroom *chatroom,
+ GossipChatroomsWindow *window)
+{
+ GtkTreeModel *model;
+
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (window->treeview));
+
+ gtk_tree_model_foreach (model,
+ (GtkTreeModelForeachFunc) chatrooms_window_remove_chatroom_foreach,
+ chatroom);
+}
+
+static gboolean
+chatrooms_window_remove_chatroom_foreach (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ GossipChatroom *chatroom)
+{
+ GossipChatroom *this_chatroom;
+
+ gtk_tree_model_get (model, iter, COL_POINTER, &this_chatroom, -1);
+
+ if (gossip_chatroom_equal (chatroom, this_chatroom)) {
+ gtk_list_store_remove (GTK_LIST_STORE (model), iter);
+ g_object_unref (this_chatroom);
+ return TRUE;
+ }
+
+ g_object_unref (this_chatroom);
+
+ return FALSE;
+}
+
+static void
chatrooms_window_account_changed_cb (GtkWidget *combo_box,
GossipChatroomsWindow *window)
{