aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libempathy/empathy-tp-roomlist.c42
-rw-r--r--src/empathy-new-chatroom-dialog.c6
2 files changed, 43 insertions, 5 deletions
diff --git a/libempathy/empathy-tp-roomlist.c b/libempathy/empathy-tp-roomlist.c
index 5999663fb..ab29f6252 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 1861993e8..67f870fbc 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));