aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/gossip-chatrooms-window.c
diff options
context:
space:
mode:
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)
{