[empathy] Fix bug #579484: Join Chatroom dialog doesn't list rooms when changing



commit a725caa3c5d33b0e7ecab6395b6790d88a9308c6
Author: Gabriel Millaire <millaire gabriel gmail com>
Date:   Fri May 8 10:15:20 2009 -0400

    Fix bug #579484: Join Chatroom dialog doesn't list rooms when changing
    account
    
    By remembering to start listing rooms when the channel is ready.
---
 libempathy/empathy-tp-roomlist.c  |   42 ++++++++++++++++++++++++++++++++----
 src/empathy-new-chatroom-dialog.c |    6 +++++
 2 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/libempathy/empathy-tp-roomlist.c b/libempathy/empathy-tp-roomlist.c
index 5999663..ab29f62 100644
--- a/libempathy/empathy-tp-roomlist.c
+++ b/libempathy/empathy-tp-roomlist.c
@@ -42,6 +42,7 @@ typedef struct {
 	TpChannel    *channel;
 	McAccount    *account;
 	gboolean      is_listing;
+	gboolean      start_requested;
 } EmpathyTpRoomlistPriv;
 
 enum {
@@ -236,6 +237,28 @@ tp_roomlist_invalidated_cb (TpChannel         *channel,
 }
 
 static void
+call_list_rooms_cb (TpChannel *proxy,
+		    const GError *error,
+		    gpointer user_data,
+		    GObject *weak_object)
+{
+	if (error != NULL) {
+		DEBUG ("Error listing rooms: %s", error->message);
+	}
+}
+
+static void
+stop_listing_cb (TpChannel *proxy,
+		 const GError *error,
+		 gpointer user_data,
+		 GObject *weak_object)
+{
+	if (error != NULL) {
+		DEBUG ("Error on stop listing: %s", error->message);
+	}
+}
+
+static void
 channel_ready_cb (TpChannel *channel,
 		  const GError *error,
 		  gpointer user_data)
@@ -269,6 +292,11 @@ channel_ready_cb (TpChannel *channel,
 							      NULL, NULL,
 							      G_OBJECT (list));
 
+	if (priv->start_requested == TRUE) {
+		tp_cli_channel_type_room_list_call_list_rooms (priv->channel, -1,
+			call_list_rooms_cb, NULL, NULL, NULL);
+		priv->start_requested = FALSE;
+	}
 }
 
 static void
@@ -434,6 +462,8 @@ empathy_tp_roomlist_init (EmpathyTpRoomlist *list)
 		EMPATHY_TYPE_TP_ROOMLIST, EmpathyTpRoomlistPriv);
 
 	list->priv = priv;
+	priv->start_requested = FALSE;
+	priv->is_listing = FALSE;
 }
 
 EmpathyTpRoomlist *
@@ -474,10 +504,12 @@ empathy_tp_roomlist_start (EmpathyTpRoomlist *list)
 	EmpathyTpRoomlistPriv *priv = GET_PRIV (list);
 
 	g_return_if_fail (EMPATHY_IS_TP_ROOMLIST (list));
-	g_return_if_fail (TP_IS_CHANNEL (priv->channel));
-
-	tp_cli_channel_type_room_list_call_list_rooms (priv->channel, -1,
-						       NULL, NULL, NULL, NULL);
+	if (priv->channel != NULL) {
+		tp_cli_channel_type_room_list_call_list_rooms (priv->channel, -1,
+			call_list_rooms_cb, NULL, NULL, NULL);
+	} else {
+		priv->start_requested = TRUE;
+	}
 }
 
 void
@@ -489,6 +521,6 @@ empathy_tp_roomlist_stop (EmpathyTpRoomlist *list)
 	g_return_if_fail (TP_IS_CHANNEL (priv->channel));
 
 	tp_cli_channel_type_room_list_call_stop_listing (priv->channel, -1,
-							 NULL, NULL, NULL, NULL);
+							 stop_listing_cb, NULL, NULL, NULL);
 }
 
diff --git a/src/empathy-new-chatroom-dialog.c b/src/empathy-new-chatroom-dialog.c
index 1861993..67f870f 100644
--- a/src/empathy-new-chatroom-dialog.c
+++ b/src/empathy-new-chatroom-dialog.c
@@ -388,6 +388,7 @@ new_chatroom_dialog_account_changed_cb (GtkComboBox             *combobox,
 	EmpathyAccountChooser *account_chooser;
 	McAccount             *account;
 	gboolean               listing = FALSE;
+	gboolean               expanded = FALSE;
 
 	if (dialog->room_list) {
 		g_object_unref (dialog->room_list);
@@ -411,6 +412,11 @@ new_chatroom_dialog_account_changed_cb (GtkComboBox             *combobox,
 				  G_CALLBACK (new_chatroom_dialog_listing_cb),
 				  dialog);
 
+		expanded = gtk_expander_get_expanded (GTK_EXPANDER (dialog->expander_browse));
+		if (expanded) {
+			new_chatroom_dialog_browse_start (dialog);
+		}
+
 		listing = empathy_tp_roomlist_is_listing (dialog->room_list);
 		if (listing) {
 			ephy_spinner_start (EPHY_SPINNER (dialog->throbber));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]