1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Copyright (C) 2006-2007 Imendio AB
4 * Copyright (C) 2007-2008 Collabora Ltd.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public
17 * License along with this program; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19 * Boston, MA 02110-1301 USA
21 * Authors: Martyn Russell <martyn@imendio.com>
22 * Xavier Claessens <xclaesse@gmail.com>
31 #include <glib/gi18n.h>
32 #include <glib/gprintf.h>
34 #include <telepathy-glib/interfaces.h>
36 #include <libempathy/empathy-tp-roomlist.h>
37 #include <libempathy/empathy-chatroom.h>
38 #include <libempathy/empathy-utils.h>
39 #include <libempathy/empathy-request-util.h>
41 #include <libempathy-gtk/empathy-account-chooser.h>
42 #include <libempathy-gtk/empathy-ui-utils.h>
44 #include "empathy-new-chatroom-dialog.h"
46 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
47 #include <libempathy/empathy-debug.h>
50 EmpathyTpRoomlist
*room_list
;
51 /* Currently selected account */
53 /* Signal id of the "status-changed" signal connected on the currently
55 gulong status_changed_id
;
58 GtkWidget
*vbox_widgets
;
59 GtkWidget
*table_info
;
60 GtkWidget
*label_account
;
61 GtkWidget
*account_chooser
;
62 GtkWidget
*label_server
;
63 GtkWidget
*entry_server
;
64 GtkWidget
*label_room
;
65 GtkWidget
*entry_room
;
66 GtkWidget
*expander_browse
;
67 GtkWidget
*hbox_expander
;
71 GtkWidget
*button_join
;
72 GtkWidget
*label_error_message
;
73 GtkWidget
*viewport_error
;
74 } EmpathyNewChatroomDialog
;
87 static void new_chatroom_dialog_response_cb (GtkWidget
*widget
,
89 EmpathyNewChatroomDialog
*dialog
);
90 static void new_chatroom_dialog_destroy_cb (GtkWidget
*widget
,
91 EmpathyNewChatroomDialog
*dialog
);
92 static void new_chatroom_dialog_model_setup (EmpathyNewChatroomDialog
*dialog
);
93 static void new_chatroom_dialog_model_add_columns (EmpathyNewChatroomDialog
*dialog
);
94 static void new_chatroom_dialog_update_widgets (EmpathyNewChatroomDialog
*dialog
);
95 static void new_chatroom_dialog_account_changed_cb (GtkComboBox
*combobox
,
96 EmpathyNewChatroomDialog
*dialog
);
97 static void new_chatroom_dialog_roomlist_destroy_cb (EmpathyTpRoomlist
*room_list
,
98 EmpathyNewChatroomDialog
*dialog
);
99 static void new_chatroom_dialog_new_room_cb (EmpathyTpRoomlist
*room_list
,
100 EmpathyChatroom
*chatroom
,
101 EmpathyNewChatroomDialog
*dialog
);
102 static void new_chatroom_dialog_listing_cb (EmpathyTpRoomlist
*room_list
,
104 EmpathyNewChatroomDialog
*dialog
);
105 static void start_listing_error_cb (EmpathyTpRoomlist
*room_list
,
107 EmpathyNewChatroomDialog
*dialog
);
108 static void stop_listing_error_cb (EmpathyTpRoomlist
*room_list
,
110 EmpathyNewChatroomDialog
*dialog
);
111 static void new_chatroom_dialog_model_clear (EmpathyNewChatroomDialog
*dialog
);
112 static void new_chatroom_dialog_model_row_activated_cb (GtkTreeView
*tree_view
,
114 GtkTreeViewColumn
*column
,
115 EmpathyNewChatroomDialog
*dialog
);
116 static void new_chatroom_dialog_model_selection_changed (GtkTreeSelection
*selection
,
117 EmpathyNewChatroomDialog
*dialog
);
118 static void new_chatroom_dialog_join (EmpathyNewChatroomDialog
*dialog
);
119 static void new_chatroom_dialog_entry_changed_cb (GtkWidget
*entry
,
120 EmpathyNewChatroomDialog
*dialog
);
121 static void new_chatroom_dialog_browse_start (EmpathyNewChatroomDialog
*dialog
);
122 static void new_chatroom_dialog_browse_stop (EmpathyNewChatroomDialog
*dialog
);
123 static void new_chatroom_dialog_entry_server_activate_cb (GtkWidget
*widget
,
124 EmpathyNewChatroomDialog
*dialog
);
125 static void new_chatroom_dialog_expander_browse_activate_cb (GtkWidget
*widget
,
126 EmpathyNewChatroomDialog
*dialog
);
127 static gboolean
new_chatroom_dialog_entry_server_focus_out_cb (GtkWidget
*widget
,
128 GdkEventFocus
*event
,
129 EmpathyNewChatroomDialog
*dialog
);
130 static void new_chatroom_dialog_button_close_error_clicked_cb (GtkButton
*button
,
131 EmpathyNewChatroomDialog
*dialog
);
133 static EmpathyNewChatroomDialog
*dialog_p
= NULL
;
137 empathy_new_chatroom_dialog_show (GtkWindow
*parent
)
139 EmpathyNewChatroomDialog
*dialog
;
141 GtkSizeGroup
*size_group
;
145 gtk_window_present (GTK_WINDOW (dialog_p
->window
));
149 dialog_p
= dialog
= g_new0 (EmpathyNewChatroomDialog
, 1);
151 filename
= empathy_file_lookup ("empathy-new-chatroom-dialog.ui", "src");
152 gui
= empathy_builder_get_file (filename
,
153 "new_chatroom_dialog", &dialog
->window
,
154 "table_info", &dialog
->table_info
,
155 "label_account", &dialog
->label_account
,
156 "label_server", &dialog
->label_server
,
157 "label_room", &dialog
->label_room
,
158 "entry_server", &dialog
->entry_server
,
159 "entry_room", &dialog
->entry_room
,
160 "treeview", &dialog
->treeview
,
161 "button_join", &dialog
->button_join
,
162 "expander_browse", &dialog
->expander_browse
,
163 "hbox_expander", &dialog
->hbox_expander
,
164 "label_error_message", &dialog
->label_error_message
,
165 "viewport_error", &dialog
->viewport_error
,
169 empathy_builder_connect (gui
, dialog
,
170 "new_chatroom_dialog", "response", new_chatroom_dialog_response_cb
,
171 "new_chatroom_dialog", "destroy", new_chatroom_dialog_destroy_cb
,
172 "entry_server", "changed", new_chatroom_dialog_entry_changed_cb
,
173 "entry_server", "activate", new_chatroom_dialog_entry_server_activate_cb
,
174 "entry_server", "focus-out-event", new_chatroom_dialog_entry_server_focus_out_cb
,
175 "entry_room", "changed", new_chatroom_dialog_entry_changed_cb
,
176 "expander_browse", "activate", new_chatroom_dialog_expander_browse_activate_cb
,
177 "button_close_error", "clicked", new_chatroom_dialog_button_close_error_clicked_cb
,
180 g_object_unref (gui
);
182 g_object_add_weak_pointer (G_OBJECT (dialog
->window
), (gpointer
) &dialog_p
);
184 /* Label alignment */
185 size_group
= gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL
);
187 gtk_size_group_add_widget (size_group
, dialog
->label_account
);
188 gtk_size_group_add_widget (size_group
, dialog
->label_server
);
189 gtk_size_group_add_widget (size_group
, dialog
->label_room
);
191 g_object_unref (size_group
);
193 /* Set up chatrooms treeview */
194 new_chatroom_dialog_model_setup (dialog
);
197 dialog
->throbber
= gtk_spinner_new ();
198 gtk_box_pack_start (GTK_BOX (dialog
->hbox_expander
), dialog
->throbber
,
201 /* Account chooser for custom */
202 dialog
->account_chooser
= empathy_account_chooser_new ();
203 empathy_account_chooser_set_filter (EMPATHY_ACCOUNT_CHOOSER (dialog
->account_chooser
),
204 empathy_account_chooser_filter_supports_chatrooms
,
206 gtk_table_attach_defaults (GTK_TABLE (dialog
->table_info
),
207 dialog
->account_chooser
,
209 gtk_widget_show (dialog
->account_chooser
);
211 g_signal_connect (GTK_COMBO_BOX (dialog
->account_chooser
), "changed",
212 G_CALLBACK (new_chatroom_dialog_account_changed_cb
),
214 new_chatroom_dialog_account_changed_cb (GTK_COMBO_BOX (dialog
->account_chooser
),
218 gtk_window_set_transient_for (GTK_WINDOW (dialog
->window
),
219 GTK_WINDOW (parent
));
222 gtk_widget_show (dialog
->window
);
226 new_chatroom_dialog_response_cb (GtkWidget
*widget
,
228 EmpathyNewChatroomDialog
*dialog
)
230 if (response
== GTK_RESPONSE_OK
) {
231 new_chatroom_dialog_join (dialog
);
234 gtk_widget_destroy (widget
);
238 new_chatroom_dialog_destroy_cb (GtkWidget
*widget
,
239 EmpathyNewChatroomDialog
*dialog
)
241 if (dialog
->room_list
) {
242 g_object_unref (dialog
->room_list
);
244 g_object_unref (dialog
->model
);
246 if (dialog
->account
!= NULL
) {
247 g_signal_handler_disconnect (dialog
->account
, dialog
->status_changed_id
);
248 g_object_unref (dialog
->account
);
255 new_chatroom_dialog_model_setup (EmpathyNewChatroomDialog
*dialog
)
259 GtkTreeSelection
*selection
;
262 view
= GTK_TREE_VIEW (dialog
->treeview
);
264 g_signal_connect (view
, "row-activated",
265 G_CALLBACK (new_chatroom_dialog_model_row_activated_cb
),
269 store
= gtk_list_store_new (COL_COUNT
,
270 G_TYPE_STRING
, /* Invite */
271 G_TYPE_STRING
, /* Password */
272 G_TYPE_STRING
, /* Name */
273 G_TYPE_STRING
, /* Room */
274 G_TYPE_STRING
, /* Member count */
275 G_TYPE_INT
, /* Member count int */
276 G_TYPE_STRING
); /* Tool tip */
278 dialog
->model
= GTK_TREE_MODEL (store
);
279 gtk_tree_view_set_model (view
, dialog
->model
);
280 gtk_tree_view_set_tooltip_column (view
, COL_TOOLTIP
);
281 gtk_tree_view_set_search_column (view
, COL_NAME
);
284 selection
= gtk_tree_view_get_selection (view
);
285 gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store
),
286 COL_NAME
, GTK_SORT_ASCENDING
);
288 g_signal_connect (selection
, "changed",
289 G_CALLBACK (new_chatroom_dialog_model_selection_changed
),
293 new_chatroom_dialog_model_add_columns (dialog
);
297 new_chatroom_dialog_model_add_columns (EmpathyNewChatroomDialog
*dialog
)
300 GtkTreeViewColumn
*column
;
301 GtkCellRenderer
*cell
;
304 gtk_icon_size_lookup (GTK_ICON_SIZE_MENU
, &width
, &height
);
306 view
= GTK_TREE_VIEW (dialog
->treeview
);
308 cell
= gtk_cell_renderer_pixbuf_new ();
312 "stock-size", GTK_ICON_SIZE_MENU
,
314 column
= gtk_tree_view_column_new_with_attributes (NULL
,
316 "stock-id", COL_INVITE_ONLY
,
319 gtk_tree_view_column_set_sort_column_id (column
, COL_INVITE_ONLY
);
320 gtk_tree_view_append_column (view
, column
);
322 column
= gtk_tree_view_column_new_with_attributes (NULL
,
324 "stock-id", COL_NEED_PASSWORD
,
327 gtk_tree_view_column_set_sort_column_id (column
, COL_NEED_PASSWORD
);
328 gtk_tree_view_append_column (view
, column
);
330 cell
= gtk_cell_renderer_text_new ();
334 "ellipsize", PANGO_ELLIPSIZE_END
,
337 column
= gtk_tree_view_column_new_with_attributes (_("Chat Room"),
342 gtk_tree_view_column_set_sort_column_id (column
, COL_NAME
);
343 gtk_tree_view_column_set_expand (column
, TRUE
);
344 gtk_tree_view_append_column (view
, column
);
346 cell
= gtk_cell_renderer_text_new ();
350 "ellipsize", PANGO_ELLIPSIZE_END
,
351 "alignment", PANGO_ALIGN_RIGHT
,
353 column
= gtk_tree_view_column_new_with_attributes (_("Members"),
358 gtk_tree_view_column_set_sort_column_id (column
, COL_MEMBERS_INT
);
359 gtk_tree_view_append_column (view
, column
);
363 update_join_button_sensitivity (EmpathyNewChatroomDialog
*dialog
)
366 gboolean sensitive
= FALSE
;
369 room
= gtk_entry_get_text (GTK_ENTRY (dialog
->entry_room
));
370 if (EMP_STR_EMPTY (room
))
373 if (dialog
->account
== NULL
)
376 if (tp_account_get_connection_status (dialog
->account
, NULL
) !=
377 TP_CONNECTION_STATUS_CONNECTED
)
383 gtk_widget_set_sensitive (dialog
->button_join
, sensitive
);
387 new_chatroom_dialog_update_widgets (EmpathyNewChatroomDialog
*dialog
)
389 EmpathyAccountChooser
*account_chooser
;
390 const gchar
*protocol
;
392 account_chooser
= EMPATHY_ACCOUNT_CHOOSER (dialog
->account_chooser
);
394 if (dialog
->account
== NULL
)
397 protocol
= tp_account_get_protocol (dialog
->account
);
399 gtk_entry_set_text (GTK_ENTRY (dialog
->entry_server
), "");
401 /* hardcode here known protocols */
402 if (strcmp (protocol
, "jabber") == 0) {
403 gtk_widget_set_sensitive (dialog
->entry_server
, TRUE
);
405 else if (strcmp (protocol
, "local-xmpp") == 0) {
406 gtk_widget_set_sensitive (dialog
->entry_server
, FALSE
);
408 else if (strcmp (protocol
, "irc") == 0) {
409 gtk_widget_set_sensitive (dialog
->entry_server
, FALSE
);
412 gtk_widget_set_sensitive (dialog
->entry_server
, TRUE
);
415 update_join_button_sensitivity (dialog
);
417 /* Final set up of the dialog */
418 gtk_widget_grab_focus (dialog
->entry_room
);
422 account_status_changed_cb (TpAccount
*account
,
426 gchar
*dbus_error_name
,
428 EmpathyNewChatroomDialog
*self
)
430 update_join_button_sensitivity (self
);
434 new_chatroom_dialog_account_changed_cb (GtkComboBox
*combobox
,
435 EmpathyNewChatroomDialog
*dialog
)
437 EmpathyAccountChooser
*account_chooser
;
438 gboolean listing
= FALSE
;
439 gboolean expanded
= FALSE
;
440 TpConnection
*connection
;
441 TpCapabilities
*caps
;
443 if (dialog
->room_list
) {
444 g_object_unref (dialog
->room_list
);
445 dialog
->room_list
= NULL
;
448 gtk_spinner_stop (GTK_SPINNER (dialog
->throbber
));
449 gtk_widget_hide (dialog
->throbber
);
450 new_chatroom_dialog_model_clear (dialog
);
452 if (dialog
->account
!= NULL
) {
453 g_signal_handler_disconnect (dialog
->account
, dialog
->status_changed_id
);
454 g_object_unref (dialog
->account
);
457 account_chooser
= EMPATHY_ACCOUNT_CHOOSER (dialog
->account_chooser
);
458 dialog
->account
= empathy_account_chooser_dup_account (account_chooser
);
459 connection
= empathy_account_chooser_get_connection (account_chooser
);
460 if (dialog
->account
== NULL
)
463 dialog
->status_changed_id
= g_signal_connect (dialog
->account
,
464 "status-changed", G_CALLBACK (account_status_changed_cb
), dialog
);
466 /* empathy_account_chooser_filter_supports_chatrooms ensures that the
467 * account has a connection and CAPABILITIES has been prepared. */
468 g_assert (connection
!= NULL
);
469 g_assert (tp_proxy_is_prepared (connection
,
470 TP_CONNECTION_FEATURE_CAPABILITIES
));
471 caps
= tp_connection_get_capabilities (connection
);
473 if (tp_capabilities_supports_room_list (caps
, NULL
)) {
474 /* Roomlist channels are supported */
475 dialog
->room_list
= empathy_tp_roomlist_new (dialog
->account
);
478 dialog
->room_list
= NULL
;
481 if (dialog
->room_list
) {
482 g_signal_connect (dialog
->room_list
, "destroy",
483 G_CALLBACK (new_chatroom_dialog_roomlist_destroy_cb
),
485 g_signal_connect (dialog
->room_list
, "new-room",
486 G_CALLBACK (new_chatroom_dialog_new_room_cb
),
488 g_signal_connect (dialog
->room_list
, "notify::is-listing",
489 G_CALLBACK (new_chatroom_dialog_listing_cb
),
491 g_signal_connect (dialog
->room_list
, "error::start",
492 G_CALLBACK (start_listing_error_cb
),
494 g_signal_connect (dialog
->room_list
, "error::stop",
495 G_CALLBACK (stop_listing_error_cb
),
498 expanded
= gtk_expander_get_expanded (GTK_EXPANDER (dialog
->expander_browse
));
500 gtk_widget_hide (dialog
->viewport_error
);
501 gtk_widget_set_sensitive (dialog
->treeview
, TRUE
);
502 new_chatroom_dialog_browse_start (dialog
);
505 listing
= empathy_tp_roomlist_is_listing (dialog
->room_list
);
507 gtk_spinner_start (GTK_SPINNER (dialog
->throbber
));
508 gtk_widget_show (dialog
->throbber
);
512 gtk_widget_set_sensitive (dialog
->expander_browse
, dialog
->room_list
!= NULL
);
515 new_chatroom_dialog_update_widgets (dialog
);
519 new_chatroom_dialog_button_close_error_clicked_cb (GtkButton
*button
,
520 EmpathyNewChatroomDialog
*dialog
)
522 gtk_widget_hide (dialog
->viewport_error
);
526 new_chatroom_dialog_roomlist_destroy_cb (EmpathyTpRoomlist
*room_list
,
527 EmpathyNewChatroomDialog
*dialog
)
529 g_object_unref (dialog
->room_list
);
530 dialog
->room_list
= NULL
;
534 new_chatroom_dialog_new_room_cb (EmpathyTpRoomlist
*room_list
,
535 EmpathyChatroom
*chatroom
,
536 EmpathyNewChatroomDialog
*dialog
)
539 GtkTreeSelection
*selection
;
544 const gchar
*need_password
;
545 const gchar
*invite_only
;
548 DEBUG ("New chatroom listed: %s (%s)",
549 empathy_chatroom_get_name (chatroom
),
550 empathy_chatroom_get_room (chatroom
));
553 view
= GTK_TREE_VIEW (dialog
->treeview
);
554 selection
= gtk_tree_view_get_selection (view
);
555 store
= GTK_LIST_STORE (dialog
->model
);
556 members
= g_strdup_printf ("%d", empathy_chatroom_get_members_count (chatroom
));
557 tmp
= g_strdup_printf ("<b>%s</b>", empathy_chatroom_get_name (chatroom
));
558 /* Translators: Room/Join's roomlist tooltip. Parameters are a channel name,
559 yes/no, yes/no and a number. */
560 tooltip
= g_strdup_printf (_("%s\nInvite required: %s\nPassword required: %s\nMembers: %s"),
562 empathy_chatroom_get_invite_only (chatroom
) ? _("Yes") : _("No"),
563 empathy_chatroom_get_need_password (chatroom
) ? _("Yes") : _("No"),
566 invite_only
= (empathy_chatroom_get_invite_only (chatroom
) ?
567 GTK_STOCK_INDEX
: NULL
);
568 need_password
= (empathy_chatroom_get_need_password (chatroom
) ?
569 GTK_STOCK_DIALOG_AUTHENTICATION
: NULL
);
571 gtk_list_store_append (store
, &iter
);
572 gtk_list_store_set (store
, &iter
,
573 COL_NEED_PASSWORD
, need_password
,
574 COL_INVITE_ONLY
, invite_only
,
575 COL_NAME
, empathy_chatroom_get_name (chatroom
),
576 COL_ROOM
, empathy_chatroom_get_room (chatroom
),
577 COL_MEMBERS
, members
,
578 COL_MEMBERS_INT
, empathy_chatroom_get_members_count (chatroom
),
579 COL_TOOLTIP
, tooltip
,
587 start_listing_error_cb (EmpathyTpRoomlist
*room_list
,
589 EmpathyNewChatroomDialog
*dialog
)
591 gtk_label_set_text (GTK_LABEL (dialog
->label_error_message
), _("Could not start room listing"));
592 gtk_widget_show_all (dialog
->viewport_error
);
593 gtk_widget_set_sensitive (dialog
->treeview
, FALSE
);
597 stop_listing_error_cb (EmpathyTpRoomlist
*room_list
,
599 EmpathyNewChatroomDialog
*dialog
)
601 gtk_label_set_text (GTK_LABEL (dialog
->label_error_message
), _("Could not stop room listing"));
602 gtk_widget_show_all (dialog
->viewport_error
);
603 gtk_widget_set_sensitive (dialog
->treeview
, FALSE
);
607 new_chatroom_dialog_listing_cb (EmpathyTpRoomlist
*room_list
,
609 EmpathyNewChatroomDialog
*dialog
)
613 listing
= empathy_tp_roomlist_is_listing (room_list
);
615 /* Update the throbber */
617 gtk_spinner_start (GTK_SPINNER (dialog
->throbber
));
618 gtk_widget_show (dialog
->throbber
);
620 gtk_spinner_stop (GTK_SPINNER (dialog
->throbber
));
621 gtk_widget_hide (dialog
->throbber
);
626 new_chatroom_dialog_model_clear (EmpathyNewChatroomDialog
*dialog
)
630 store
= GTK_LIST_STORE (dialog
->model
);
631 gtk_list_store_clear (store
);
635 new_chatroom_dialog_model_row_activated_cb (GtkTreeView
*tree_view
,
637 GtkTreeViewColumn
*column
,
638 EmpathyNewChatroomDialog
*dialog
)
640 gtk_widget_activate (dialog
->button_join
);
644 new_chatroom_dialog_model_selection_changed (GtkTreeSelection
*selection
,
645 EmpathyNewChatroomDialog
*dialog
)
650 gchar
*server
= NULL
;
652 if (!gtk_tree_selection_get_selected (selection
, &model
, &iter
)) {
656 gtk_tree_model_get (model
, &iter
, COL_ROOM
, &room
, -1);
657 server
= strstr (room
, "@");
663 gtk_entry_set_text (GTK_ENTRY (dialog
->entry_server
), server
? server
: "");
664 gtk_entry_set_text (GTK_ENTRY (dialog
->entry_room
), room
? room
: "");
670 new_chatroom_dialog_join (EmpathyNewChatroomDialog
*dialog
)
672 EmpathyAccountChooser
*account_chooser
;
675 const gchar
*server
= NULL
;
676 gchar
*room_name
= NULL
;
678 room
= gtk_entry_get_text (GTK_ENTRY (dialog
->entry_room
));
679 server
= gtk_entry_get_text (GTK_ENTRY (dialog
->entry_server
));
681 account_chooser
= EMPATHY_ACCOUNT_CHOOSER (dialog
->account_chooser
);
682 account
= empathy_account_chooser_get_account (account_chooser
);
684 if (!EMP_STR_EMPTY (server
)) {
685 room_name
= g_strconcat (room
, "@", server
, NULL
);
687 room_name
= g_strdup (room
);
690 g_strstrip (room_name
);
692 DEBUG ("Requesting channel for '%s'", room_name
);
693 empathy_join_muc (account
, room_name
,
694 gtk_get_current_event_time ());
700 new_chatroom_dialog_entry_changed_cb (GtkWidget
*entry
,
701 EmpathyNewChatroomDialog
*dialog
)
703 if (entry
== dialog
->entry_room
) {
704 update_join_button_sensitivity (dialog
);
706 /* FIXME: Select the room in the list */
711 new_chatroom_dialog_browse_start (EmpathyNewChatroomDialog
*dialog
)
713 new_chatroom_dialog_model_clear (dialog
);
714 if (dialog
->room_list
) {
715 empathy_tp_roomlist_start (dialog
->room_list
);
720 new_chatroom_dialog_browse_stop (EmpathyNewChatroomDialog
*dialog
)
722 if (dialog
->room_list
) {
723 empathy_tp_roomlist_stop (dialog
->room_list
);
728 new_chatroom_dialog_entry_server_activate_cb (GtkWidget
*widget
,
729 EmpathyNewChatroomDialog
*dialog
)
731 new_chatroom_dialog_browse_start (dialog
);
735 new_chatroom_dialog_expander_browse_activate_cb (GtkWidget
*widget
,
736 EmpathyNewChatroomDialog
*dialog
)
740 expanded
= gtk_expander_get_expanded (GTK_EXPANDER (widget
));
742 new_chatroom_dialog_browse_stop (dialog
);
743 gtk_window_set_resizable (GTK_WINDOW (dialog
->window
), FALSE
);
745 gtk_widget_hide (dialog
->viewport_error
);
746 gtk_widget_set_sensitive (dialog
->treeview
, TRUE
);
747 new_chatroom_dialog_browse_start (dialog
);
748 gtk_window_set_resizable (GTK_WINDOW (dialog
->window
), TRUE
);
753 new_chatroom_dialog_entry_server_focus_out_cb (GtkWidget
*widget
,
754 GdkEventFocus
*event
,
755 EmpathyNewChatroomDialog
*dialog
)
759 expanded
= gtk_expander_get_expanded (GTK_EXPANDER (dialog
->expander_browse
));
761 new_chatroom_dialog_browse_start (dialog
);