* Xavier Claessens <xclaesse@gmail.com>
*/
-#include <config.h>
-
-#include <string.h>
+#include "config.h"
+#include "empathy-new-chatroom-dialog.h"
-#include <gtk/gtk.h>
-#include <glib.h>
#include <glib/gi18n.h>
-#include <glib/gprintf.h>
-
-#include <telepathy-glib/telepathy-glib.h>
+#include <tp-account-widgets/tpaw-builder.h>
+#include <tp-account-widgets/tpaw-utils.h>
-#include <libempathy/empathy-chatroom.h>
-#include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-request-util.h>
-#include <libempathy/empathy-gsettings.h>
-
-#include <libempathy-gtk/empathy-account-chooser.h>
-#include <libempathy-gtk/empathy-ui-utils.h>
-
-#include "empathy-new-chatroom-dialog.h"
+#include "empathy-account-chooser.h"
+#include "empathy-gsettings.h"
+#include "empathy-request-util.h"
+#include "empathy-ui-utils.h"
+#include "empathy-utils.h"
#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
-#include <libempathy/empathy-debug.h>
+#include "empathy-debug.h"
G_DEFINE_TYPE (EmpathyNewChatroomDialog, empathy_new_chatroom_dialog,
GTK_TYPE_DIALOG)
account_chooser = EMPATHY_ACCOUNT_CHOOSER (self->priv->account_chooser);
account = empathy_account_chooser_get_account (account_chooser);
- if (!EMP_STR_EMPTY (server))
+ if (!TPAW_STR_EMPTY (server))
room_name = g_strconcat (room, "@", server, NULL);
else
room_name = g_strdup (room);
/* Store/Model */
store = gtk_list_store_new (COL_COUNT,
- G_TYPE_STRING, /* Invite */
- G_TYPE_STRING, /* Password */
+ G_TYPE_STRING, /* Need password */
+ G_TYPE_STRING, /* Invite only */
G_TYPE_STRING, /* Name */
G_TYPE_STRING, /* Room */
G_TYPE_STRING, /* Member count */
gboolean sensitive = FALSE;
room = gtk_entry_get_text (GTK_ENTRY (self->priv->entry_room));
- protocol = tp_account_get_protocol (self->priv->account);
- if (EMP_STR_EMPTY (room))
+ protocol = tp_account_get_protocol_name (self->priv->account);
+ if (TPAW_STR_EMPTY (room))
goto out;
if (!tp_strdiff (protocol, "irc") &&
if (self->priv->account == NULL)
return;
- protocol = tp_account_get_protocol (self->priv->account);
+ protocol = tp_account_get_protocol_name (self->priv->account);
gtk_entry_set_text (GTK_ENTRY (self->priv->entry_server), "");
const gchar *invite_only;
gchar *tmp;
+ if (tp_str_empty (tp_room_info_get_handle_name (room)))
+ {
+ DEBUG ("Room handle name is empty - Broken CM");
+ return;
+ }
+
DEBUG ("New room listed: %s (%s)", tp_room_info_get_name (room),
tp_room_info_get_handle_name (room));
gpointer user_data)
{
EmpathyNewChatroomDialog *self = user_data;
+ TpRoomList *room_list;
GError *error = NULL;
- self->priv->room_list = tp_room_list_new_finish (result, &error);
- if (self->priv->room_list == NULL)
+ room_list = tp_room_list_new_finish (result, &error);
+ if (room_list == NULL)
{
DEBUG ("Failed to create TpRoomList: %s\n", error->message);
g_error_free (error);
return;
}
- g_signal_connect (self->priv->room_list, "got-room",
- G_CALLBACK (new_chatroom_dialog_got_room_cb), self);
- g_signal_connect (self->priv->room_list, "failed",
- G_CALLBACK (listing_failed_cb), self);
- g_signal_connect (self->priv->room_list, "notify::listing",
- G_CALLBACK (new_chatroom_dialog_listing_cb), self);
+ if (tp_room_list_get_account (room_list) != self->priv->account)
+ {
+ /* Account changed while we were creating this TpRoomList */
+ g_object_unref (room_list);
+ return;
+ }
+
+ self->priv->room_list = room_list;
+
+ tp_g_signal_connect_object (self->priv->room_list, "got-room",
+ G_CALLBACK (new_chatroom_dialog_got_room_cb), self, 0);
+ tp_g_signal_connect_object (self->priv->room_list, "failed",
+ G_CALLBACK (listing_failed_cb), self, 0);
+ tp_g_signal_connect_object (self->priv->room_list, "notify::listing",
+ G_CALLBACK (new_chatroom_dialog_listing_cb), self, 0);
if (gtk_expander_get_expanded (GTK_EXPANDER (self->priv->expander_browse)))
{
gtk_widget_set_sensitive (self->priv->expander_browse, TRUE);
new_chatroom_dialog_update_widgets (self);
-
}
static void
EMPATHY_TYPE_NEW_CHATROOM_DIALOG, EmpathyNewChatroomDialogPriv);
filename = empathy_file_lookup ("empathy-new-chatroom-dialog.ui", "src");
- gui = empathy_builder_get_file (filename,
+ gui = tpaw_builder_get_file (filename,
"vbox_new_chatroom", &vbox,
"table_grid", &self->priv->table_grid,
"label_account", &self->priv->label_account,
NULL);
g_free (filename);
- empathy_builder_connect (gui, self,
+ tpaw_builder_connect (gui, self,
"entry_server", "changed", new_chatroom_dialog_entry_changed_cb,
"entry_server", "activate", new_chatroom_dialog_entry_server_activate_cb,
"entry_server", "focus-out-event",
self->priv->button_join = gtk_dialog_add_button (GTK_DIALOG (self),
_("Join"), GTK_RESPONSE_OK);
+ gtk_dialog_set_default_response (GTK_DIALOG (self), GTK_RESPONSE_OK);
+
gtk_window_set_title (GTK_WINDOW (self), _("Join Room"));
gtk_window_set_role (GTK_WINDOW (self), "join_new_chatroom");