gossip r2767 - in trunk: . libgossip src



Author: mr
Date: Wed Mar 12 17:59:36 2008
New Revision: 2767
URL: http://svn.gnome.org/viewvc/gossip?rev=2767&view=rev

Log:
Update menus correctly when disconnected and rejoin chatrooms when reconnected.


Modified:
   trunk/ChangeLog
   trunk/libgossip/gossip-chatroom-provider.c
   trunk/libgossip/gossip-chatroom-provider.h
   trunk/libgossip/gossip-chatroom.c
   trunk/libgossip/gossip-chatroom.h
   trunk/libgossip/gossip-jabber-chatrooms.c
   trunk/src/gossip-chat-view.c
   trunk/src/gossip-chat-window.c
   trunk/src/gossip-chatrooms-window.c
   trunk/src/gossip-group-chat.c
   trunk/src/gossip-new-chatroom-dialog.c

Modified: trunk/libgossip/gossip-chatroom-provider.c
==============================================================================
--- trunk/libgossip/gossip-chatroom-provider.c	(original)
+++ trunk/libgossip/gossip-chatroom-provider.c	Wed Mar 12 17:59:36 2008
@@ -375,60 +375,3 @@
 	}
 }
 
-const gchar *
-gossip_chatroom_provider_error_to_string (GossipChatroomError error)
-{
-	const gchar *str = NULL;
-
-	switch (error) {
-	case GOSSIP_CHATROOM_ERROR_PASSWORD_INVALID_OR_MISSING:
-		str = _("The chat room you tried to join requires a password. "
-			"You either failed to supply a password or the password you tried was incorrect.");
-		break;
-
-	case GOSSIP_CHATROOM_ERROR_USER_BANNED:
-		str = _("You have been banned from this chatroom.");
-		break;
-
-	case GOSSIP_CHATROOM_ERROR_ROOM_NOT_FOUND:
-		str = _("The conference room you tried to join could not be found.");
-		break;
-
-	case GOSSIP_CHATROOM_ERROR_ROOM_CREATION_RESTRICTED:
-		str = _("Chatroom creation is restricted on this server.");
-		break;
-
-	case GOSSIP_CHATROOM_ERROR_USE_RESERVED_ROOM_NICK:
-		str = _("Chatroom reserved nick names must be used on this server.");
-		break;
-
-	case GOSSIP_CHATROOM_ERROR_NOT_ON_MEMBERS_LIST:
-		str = _("You are not on the chatroom's members list.");
-		break;
-
-	case GOSSIP_CHATROOM_ERROR_NICK_IN_USE:
-		str = _("The nickname you have chosen is already in use.");
-		break;
-
-	case GOSSIP_CHATROOM_ERROR_MAXIMUM_USERS_REACHED:
-		str = _("The maximum number of users for this chatroom has been reached.");
-		break;
-
-	case GOSSIP_CHATROOM_ERROR_TIMED_OUT:
-		str = _("The remote conference server did not respond in a sensible time.");
-		break;
-
-	case GOSSIP_CHATROOM_ERROR_UNKNOWN:
-		str = _("An unknown error occurred, check your details are correct.");
-		break;
-
-	case GOSSIP_CHATROOM_ERROR_CANCELED:
-		str = _("Joining the chatroom was canceled.");
-		break;
-
-	default:
-		break;
-	}
-
-	return str;
-}

Modified: trunk/libgossip/gossip-chatroom-provider.h
==============================================================================
--- trunk/libgossip/gossip-chatroom-provider.h	(original)
+++ trunk/libgossip/gossip-chatroom-provider.h	Wed Mar 12 17:59:36 2008
@@ -37,26 +37,6 @@
 typedef struct _GossipChatroomProvider      GossipChatroomProvider;
 typedef struct _GossipChatroomProviderIface GossipChatroomProviderIface;
 
-typedef enum {
-	GOSSIP_CHATROOM_ERROR_NONE,
-
-	/* MUC errors */
-	GOSSIP_CHATROOM_ERROR_PASSWORD_INVALID_OR_MISSING,
-	GOSSIP_CHATROOM_ERROR_USER_BANNED,
-	GOSSIP_CHATROOM_ERROR_ROOM_NOT_FOUND,
-	GOSSIP_CHATROOM_ERROR_ROOM_CREATION_RESTRICTED,
-	GOSSIP_CHATROOM_ERROR_USE_RESERVED_ROOM_NICK,
-	GOSSIP_CHATROOM_ERROR_NOT_ON_MEMBERS_LIST,
-	GOSSIP_CHATROOM_ERROR_NICK_IN_USE,
-	GOSSIP_CHATROOM_ERROR_MAXIMUM_USERS_REACHED,
-
-	/* Internal errors */
-	GOSSIP_CHATROOM_ERROR_ALREADY_OPEN,
-	GOSSIP_CHATROOM_ERROR_TIMED_OUT,
-	GOSSIP_CHATROOM_ERROR_CANCELED,
-	GOSSIP_CHATROOM_ERROR_UNKNOWN
-} GossipChatroomError;
-
 typedef void (*GossipChatroomJoinCb)   (GossipChatroomProvider   *provider,
 					GossipChatroomId          id,
 					GossipChatroomError       error,
@@ -166,8 +146,6 @@
 							  GossipChatroomBrowseCb  callback,
 							  gpointer                user_data);
 
-const gchar *gossip_chatroom_provider_error_to_string    (GossipChatroomError     error);
-
 G_END_DECLS
 
 #endif /* __GOSSIP_CHATROOM_PROVIDER_H__ */

Modified: trunk/libgossip/gossip-chatroom.c
==============================================================================
--- trunk/libgossip/gossip-chatroom.c	(original)
+++ trunk/libgossip/gossip-chatroom.c	Wed Mar 12 17:59:36 2008
@@ -54,7 +54,7 @@
 
 	guint                  occupants;
 
-	gchar                 *last_error;
+	GossipChatroomError    last_error;
 
 	GHashTable            *contacts;
 };
@@ -100,6 +100,63 @@
 
 static guint signals[LAST_SIGNAL] = {0};
 
+GType
+gossip_chatroom_error_get_type (void)
+{
+	static GType etype = 0;
+
+	if (etype == 0) {
+		static const GEnumValue values[] = {
+			/* MUC errors */
+			{ GOSSIP_CHATROOM_ERROR_NONE, 
+			  "GOSSIP_CHATROOM_ERROR_NONE", 
+			  "none" },
+			{ GOSSIP_CHATROOM_ERROR_PASSWORD_INVALID_OR_MISSING, 
+			  "GOSSIP_CHATROOM_ERROR_PASSWORD_INVALID_OR_MISSING", 
+			  "password invalid or missing" },
+			{ GOSSIP_CHATROOM_ERROR_USER_BANNED, 
+			  "GOSSIP_CHATROOM_ERROR_USER_BANNED", 
+			  "user banned" },
+			{ GOSSIP_CHATROOM_ERROR_ROOM_NOT_FOUND, 
+			  "GOSSIP_CHATROOM_ERROR_ROOM_NOT_FOUND", 
+			  "room not found" },
+			{ GOSSIP_CHATROOM_ERROR_ROOM_CREATION_RESTRICTED, 
+			  "GOSSIP_CHATROOM_ERROR_ROOM_CREATION_RESTRICTED", 
+			  "room creation restricted" },
+			{ GOSSIP_CHATROOM_ERROR_USE_RESERVED_ROOM_NICK, 
+			  "GOSSIP_CHATROOM_ERROR_USE_RESERVED_ROOM_NICK", 
+			  "use reserved room nick" },
+			{ GOSSIP_CHATROOM_ERROR_NOT_ON_MEMBERS_LIST, 
+			  "GOSSIP_CHATROOM_ERROR_NOT_ON_MEMBERS_LIST", 
+			  "not on members list" },
+			{ GOSSIP_CHATROOM_ERROR_NICK_IN_USE, 
+			  "GOSSIP_CHATROOM_ERROR_NICK_IN_USE", 
+			  "nick in use" },
+			{ GOSSIP_CHATROOM_ERROR_MAXIMUM_USERS_REACHED, 
+			  "GOSSIP_CHATROOM_ERROR_MAXIMUM_USERS_REACHED", 
+			  "maximum users reached" },
+			/* Internal errors */
+			{ GOSSIP_CHATROOM_ERROR_ALREADY_OPEN, 
+			  "GOSSIP_CHATROOM_ERROR_ALREADY_OPEN", 
+			  "already open" },
+			{ GOSSIP_CHATROOM_ERROR_TIMED_OUT, 
+			  "GOSSIP_CHATROOM_ERROR_TIMED_OUT", 
+			  "timed out" },
+			{ GOSSIP_CHATROOM_ERROR_CANCELED, 
+			  "GOSSIP_CHATROOM_ERROR_CANCELED", 
+			  "canceled" },
+			{ GOSSIP_CHATROOM_ERROR_UNKNOWN, 
+			  "GOSSIP_CHATROOM_ERROR_UNKNOWN", 
+			  "unknown" },
+			{ 0, NULL, NULL }
+		};
+
+		etype = g_enum_register_static ("GossipChatroomError", values);
+	}
+
+	return etype;
+}
+
 G_DEFINE_TYPE (GossipChatroom, gossip_chatroom, G_TYPE_OBJECT);
 
 static void
@@ -125,7 +182,7 @@
 
 	g_object_class_install_property (object_class,
 					 PROP_ID_STR,
-					 g_param_spec_string ("id_str",
+					 g_param_spec_string ("id-str",
 							      "Chatroom String ID",
 							      "Chatroom represented as 'room server'",
 							      NULL,
@@ -189,7 +246,7 @@
 
 	g_object_class_install_property (object_class,
 					 PROP_AUTO_CONNECT,
-					 g_param_spec_boolean ("auto_connect",
+					 g_param_spec_boolean ("auto-connect",
 							       "Chatroom Auto Connect",
 							       "Connect on startup",
 							       FALSE,
@@ -235,11 +292,12 @@
 
 	g_object_class_install_property (object_class,
 					 PROP_LAST_ERROR,
-					 g_param_spec_string ("last_error",
-							      "Last Error",
-							      "The last error that was given when trying to connect",
-							      NULL,
-							      G_PARAM_READWRITE));
+					 g_param_spec_enum ("last-error",
+							    "Last Error",
+							    "The last error that was given when trying to connect",
+							    gossip_chatroom_error_get_type (),
+							    GOSSIP_CHATROOM_ERROR_NONE,
+							    G_PARAM_READWRITE));
 
 	g_object_class_install_property (object_class,
 					 PROP_ACCOUNT,
@@ -316,8 +374,6 @@
 	g_free (priv->room);
 	g_free (priv->password);
 
-	g_free (priv->last_error);
-
 	if (priv->account) {
 		g_object_unref (priv->account);
 	}
@@ -384,7 +440,7 @@
 		g_value_set_uint (value, priv->occupants);
 		break;
 	case PROP_LAST_ERROR:
-		g_value_set_string (value, priv->last_error);
+		g_value_set_enum (value, priv->last_error);
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -457,7 +513,7 @@
 		break;
 	case PROP_LAST_ERROR:
 		gossip_chatroom_set_last_error (GOSSIP_CHATROOM (object),
-						g_value_get_string (value));
+						g_value_get_enum (value));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -645,14 +701,15 @@
 	return priv->occupants;
 }
 
-const gchar *
+GossipChatroomError
 gossip_chatroom_get_last_error (GossipChatroom *chatroom)
 {
 	GossipChatroomPriv *priv;
 
-	g_return_val_if_fail (GOSSIP_IS_CHATROOM (chatroom), NULL);
+	g_return_val_if_fail (GOSSIP_IS_CHATROOM (chatroom), GOSSIP_CHATROOM_ERROR_NONE);
 
 	priv = GET_PRIV (chatroom);
+
 	return priv->last_error;
 }
 
@@ -829,7 +886,7 @@
 	priv = GET_PRIV (chatroom);
 	priv->auto_connect = auto_connect;
 
-	g_object_notify (G_OBJECT (chatroom), "auto_connect");
+	g_object_notify (G_OBJECT (chatroom), "auto-connect");
 }
 
 void
@@ -906,8 +963,8 @@
 }
 
 void
-gossip_chatroom_set_last_error (GossipChatroom *chatroom,
-				const gchar    *last_error)
+gossip_chatroom_set_last_error (GossipChatroom      *chatroom,
+				GossipChatroomError  last_error)
 {
 	GossipChatroomPriv *priv;
 
@@ -915,14 +972,9 @@
 
 	priv = GET_PRIV (chatroom);
 
-	g_free (priv->last_error);
-	if (last_error) {
-		priv->last_error = g_strdup (last_error);
-	} else {
-		priv->last_error = NULL;
-	}
+	priv->last_error = last_error;
 
-	g_object_notify (G_OBJECT (chatroom), "last_error");
+	g_object_notify (G_OBJECT (chatroom), "last-error");
 }
 
 void
@@ -1054,6 +1106,40 @@
 }
 
 const gchar *
+gossip_chatroom_error_to_string (GossipChatroomError error)
+{
+	switch (error) {
+	case GOSSIP_CHATROOM_ERROR_PASSWORD_INVALID_OR_MISSING:
+		return _("The chat room you tried to join requires a password. "
+			 "You either failed to supply a password or the password you tried was incorrect.");
+	case GOSSIP_CHATROOM_ERROR_USER_BANNED:
+		return _("You have been banned from this chatroom.");
+	case GOSSIP_CHATROOM_ERROR_ROOM_NOT_FOUND:
+		return _("The conference room you tried to join could not be found.");
+	case GOSSIP_CHATROOM_ERROR_ROOM_CREATION_RESTRICTED:
+		return _("Chatroom creation is restricted on this server.");
+	case GOSSIP_CHATROOM_ERROR_USE_RESERVED_ROOM_NICK:
+		return _("Chatroom reserved nick names must be used on this server.");
+	case GOSSIP_CHATROOM_ERROR_NOT_ON_MEMBERS_LIST:
+		return _("You are not on the chatroom's members list.");
+	case GOSSIP_CHATROOM_ERROR_NICK_IN_USE:
+		return _("The nickname you have chosen is already in use.");
+	case GOSSIP_CHATROOM_ERROR_MAXIMUM_USERS_REACHED:
+		return _("The maximum number of users for this chatroom has been reached.");
+	case GOSSIP_CHATROOM_ERROR_TIMED_OUT:
+		return _("The remote conference server did not respond in a sensible time.");
+	case GOSSIP_CHATROOM_ERROR_UNKNOWN:
+		return _("An unknown error occurred, check your details are correct.");
+	case GOSSIP_CHATROOM_ERROR_CANCELED:
+		return _("Joining the chatroom was canceled.");
+	default:
+		break;
+	}
+
+	return "";
+}
+
+const gchar *
 gossip_chatroom_role_to_string (GossipChatroomRole role,
 				gint               nr)
 {

Modified: trunk/libgossip/gossip-chatroom.h
==============================================================================
--- trunk/libgossip/gossip-chatroom.h	(original)
+++ trunk/libgossip/gossip-chatroom.h	Wed Mar 12 17:59:36 2008
@@ -28,6 +28,74 @@
 
 G_BEGIN_DECLS
 
+typedef enum {
+	GOSSIP_CHATROOM_AFFILIATION_OWNER,
+	GOSSIP_CHATROOM_AFFILIATION_ADMIN,
+	GOSSIP_CHATROOM_AFFILIATION_MEMBER,
+	GOSSIP_CHATROOM_AFFILIATION_OUTCAST,
+	GOSSIP_CHATROOM_AFFILIATION_NONE
+} GossipChatroomAffiliation;
+
+typedef enum {
+	GOSSIP_CHATROOM_ROLE_MODERATOR,
+	GOSSIP_CHATROOM_ROLE_PARTICIPANT,
+	GOSSIP_CHATROOM_ROLE_VISITOR,
+	GOSSIP_CHATROOM_ROLE_NONE
+} GossipChatroomRole;
+
+typedef enum {
+	GOSSIP_CHATROOM_STATUS_INACTIVE,
+	GOSSIP_CHATROOM_STATUS_JOINING,
+	GOSSIP_CHATROOM_STATUS_ACTIVE,
+	GOSSIP_CHATROOM_STATUS_ERROR,
+	GOSSIP_CHATROOM_STATUS_UNKNOWN,
+} GossipChatroomStatus;
+
+typedef enum {
+	GOSSIP_CHATROOM_FEATURE_HIDDEN               = 1 << 0,
+	GOSSIP_CHATROOM_FEATURE_MEMBERS_ONLY         = 1 << 1,
+	GOSSIP_CHATROOM_FEATURE_MODERATED            = 1 << 2,
+	GOSSIP_CHATROOM_FEATURE_NONANONYMOUS         = 1 << 3,
+	GOSSIP_CHATROOM_FEATURE_OPEN                 = 1 << 4,
+	GOSSIP_CHATROOM_FEATURE_PASSWORD_PROTECTED   = 1 << 5,
+	GOSSIP_CHATROOM_FEATURE_PERSISTENT           = 1 << 6,
+	GOSSIP_CHATROOM_FEATURE_PUBLIC               = 1 << 7,
+	GOSSIP_CHATROOM_FEATURE_SEMIANONYMOUS        = 1 << 8,
+	GOSSIP_CHATROOM_FEATURE_TEMPORARY            = 1 << 9,
+	GOSSIP_CHATROOM_FEATURE_UNMODERATED          = 1 << 10,
+	GOSSIP_CHATROOM_FEATURE_UNSECURED            = 1 << 11
+} GossipChatroomFeature;
+
+/*
+ * GossipChatroomError
+ */ 
+#define GOSSIP_TYPE_CHATROOM_ERROR (gossip_chatroom_error_get_type ())
+
+typedef enum {
+	GOSSIP_CHATROOM_ERROR_NONE,
+
+	/* MUC errors */
+	GOSSIP_CHATROOM_ERROR_PASSWORD_INVALID_OR_MISSING,
+	GOSSIP_CHATROOM_ERROR_USER_BANNED,
+	GOSSIP_CHATROOM_ERROR_ROOM_NOT_FOUND,
+	GOSSIP_CHATROOM_ERROR_ROOM_CREATION_RESTRICTED,
+	GOSSIP_CHATROOM_ERROR_USE_RESERVED_ROOM_NICK,
+	GOSSIP_CHATROOM_ERROR_NOT_ON_MEMBERS_LIST,
+	GOSSIP_CHATROOM_ERROR_NICK_IN_USE,
+	GOSSIP_CHATROOM_ERROR_MAXIMUM_USERS_REACHED,
+
+	/* Internal errors */
+	GOSSIP_CHATROOM_ERROR_ALREADY_OPEN,
+	GOSSIP_CHATROOM_ERROR_TIMED_OUT,
+	GOSSIP_CHATROOM_ERROR_CANCELED,
+	GOSSIP_CHATROOM_ERROR_UNKNOWN
+} GossipChatroomError;
+
+GType gossip_chatroom_error_get_type (void) G_GNUC_CONST;
+
+/*
+ * GossipChatroom
+ */
 #define GOSSIP_TYPE_CHATROOM             (gossip_chatroom_get_type ())
 #define GOSSIP_CHATROOM(o)               (G_TYPE_CHECK_INSTANCE_CAST ((o), GOSSIP_TYPE_CHATROOM, GossipChatroom))
 #define GOSSIP_CHATROOM_CLASS(k)         (G_TYPE_CHECK_CLASS_CAST ((k), GOSSIP_TYPE_CHATROOM, GossipChatroomClass))
@@ -68,44 +136,6 @@
 	GObjectClass parent_class;
 };
 
-typedef enum {
-	GOSSIP_CHATROOM_AFFILIATION_OWNER,
-	GOSSIP_CHATROOM_AFFILIATION_ADMIN,
-	GOSSIP_CHATROOM_AFFILIATION_MEMBER,
-	GOSSIP_CHATROOM_AFFILIATION_OUTCAST,
-	GOSSIP_CHATROOM_AFFILIATION_NONE
-} GossipChatroomAffiliation;
-
-typedef enum {
-	GOSSIP_CHATROOM_ROLE_MODERATOR,
-	GOSSIP_CHATROOM_ROLE_PARTICIPANT,
-	GOSSIP_CHATROOM_ROLE_VISITOR,
-	GOSSIP_CHATROOM_ROLE_NONE
-} GossipChatroomRole;
-
-typedef enum {
-	GOSSIP_CHATROOM_STATUS_INACTIVE,
-	GOSSIP_CHATROOM_STATUS_JOINING,
-	GOSSIP_CHATROOM_STATUS_ACTIVE,
-	GOSSIP_CHATROOM_STATUS_ERROR,
-	GOSSIP_CHATROOM_STATUS_UNKNOWN,
-} GossipChatroomStatus;
-
-typedef enum {
-	GOSSIP_CHATROOM_FEATURE_HIDDEN               = 1 << 0,
-	GOSSIP_CHATROOM_FEATURE_MEMBERS_ONLY         = 1 << 1,
-	GOSSIP_CHATROOM_FEATURE_MODERATED            = 1 << 2,
-	GOSSIP_CHATROOM_FEATURE_NONANONYMOUS         = 1 << 3,
-	GOSSIP_CHATROOM_FEATURE_OPEN                 = 1 << 4,
-	GOSSIP_CHATROOM_FEATURE_PASSWORD_PROTECTED   = 1 << 5,
-	GOSSIP_CHATROOM_FEATURE_PERSISTENT           = 1 << 6,
-	GOSSIP_CHATROOM_FEATURE_PUBLIC               = 1 << 7,
-	GOSSIP_CHATROOM_FEATURE_SEMIANONYMOUS        = 1 << 8,
-	GOSSIP_CHATROOM_FEATURE_TEMPORARY            = 1 << 9,
-	GOSSIP_CHATROOM_FEATURE_UNMODERATED          = 1 << 10,
-	GOSSIP_CHATROOM_FEATURE_UNSECURED            = 1 << 11
-} GossipChatroomFeature;
-
 struct _GossipChatroomContactInfo {
 	GossipChatroomRole        role;
 	GossipChatroomAffiliation affiliation;
@@ -131,7 +161,8 @@
 GossipChatroomStatus
                   gossip_chatroom_get_status           (GossipChatroom  *chatroom);
 guint             gossip_chatroom_get_occupants        (GossipChatroom  *chatroom);
-const gchar *     gossip_chatroom_get_last_error       (GossipChatroom  *chatroom);
+GossipChatroomError
+                  gossip_chatroom_get_last_error       (GossipChatroom  *chatroom);
 GossipChatroomContactInfo *
                   gossip_chatroom_get_contact_info     (GossipChatroom  *chatroom,
 							GossipContact   *contact);
@@ -163,7 +194,7 @@
 void              gossip_chatroom_set_occupants        (GossipChatroom  *chatroom,
 							guint            occupants);
 void              gossip_chatroom_set_last_error       (GossipChatroom  *chatroom,
-							const gchar     *last_error);
+							GossipChatroomError last_error);
 void              gossip_chatroom_set_contact_info     (GossipChatroom  *chatroom,
 							GossipContact   *contact,
 							GossipChatroomContactInfo *info);
@@ -175,6 +206,7 @@
 gboolean          gossip_chatroom_equal_full            (gconstpointer   v1,
 							 gconstpointer   v2);
 const gchar *     gossip_chatroom_status_to_string      (GossipChatroomStatus status);
+const gchar *     gossip_chatroom_error_to_string       (GossipChatroomError error);
 const gchar *     gossip_chatroom_role_to_string        (GossipChatroomRole role,
 							 gint               nr);
 const gchar *

Modified: trunk/libgossip/gossip-jabber-chatrooms.c
==============================================================================
--- trunk/libgossip/gossip-jabber-chatrooms.c	(original)
+++ trunk/libgossip/gossip-jabber-chatrooms.c	Wed Mar 12 17:59:36 2008
@@ -629,7 +629,7 @@
 			
 			error = jabber_chatrooms_error_from_code (code);
 			gossip_debug (DEBUG_DOMAIN, "ID[%d] %s", 
-				      id, gossip_chatroom_provider_error_to_string (error));
+				      id, gossip_chatroom_error_to_string (error));
 			
 			g_signal_emit_by_name (chatrooms->jabber,
 					       "chatroom-error",
@@ -651,8 +651,8 @@
 jabber_chatrooms_join_timeout_cb (JabberChatroom *room)
 {
 	GossipChatroomId       id;
+	GossipChatroomError    error;
 	GossipJabberChatrooms *chatrooms;
-	const gchar           *last_error;
 
 	room->timeout_id = 0;
 
@@ -665,10 +665,10 @@
 	gossip_debug (DEBUG_DOMAIN, "ID[%d] Join timed out (internally)", id);
 
 	/* Set chatroom status and error */
-	gossip_chatroom_set_status (room->chatroom, GOSSIP_CHATROOM_STATUS_ERROR);
+	error = GOSSIP_CHATROOM_ERROR_TIMED_OUT;
 
-	last_error = gossip_chatroom_provider_error_to_string (GOSSIP_CHATROOM_ERROR_TIMED_OUT);
-	gossip_chatroom_set_last_error (room->chatroom, last_error);
+	gossip_chatroom_set_last_error (room->chatroom, error);
+	gossip_chatroom_set_status (room->chatroom, GOSSIP_CHATROOM_STATUS_ERROR);
 
 	/* Call callback */
 	chatrooms = room->chatrooms;
@@ -677,7 +677,7 @@
 		gossip_debug (DEBUG_DOMAIN, "ID[%d] Calling back... (timed out)", id);
 		(room->callback) (GOSSIP_CHATROOM_PROVIDER (chatrooms->jabber),
 				  id,
-				  GOSSIP_CHATROOM_ERROR_TIMED_OUT,
+				  error,
 				  room->user_data);
 	}
 
@@ -907,7 +907,7 @@
 
 		error = jabber_chatrooms_error_from_code (code);
 		gossip_debug (DEBUG_DOMAIN, "ID[%d] %s", 
-			      id, gossip_chatroom_provider_error_to_string (error));
+			      id, gossip_chatroom_error_to_string (error));
 
 		/* Set room state */
 		status = GOSSIP_CHATROOM_STATUS_ERROR;
@@ -916,9 +916,8 @@
 		status = GOSSIP_CHATROOM_STATUS_ACTIVE;
 	}
 
+	gossip_chatroom_set_last_error (room->chatroom, error);
 	gossip_chatroom_set_status (room->chatroom, status);
-	gossip_chatroom_set_last_error (room->chatroom,
-					gossip_chatroom_provider_error_to_string (error));
 
 	if (room->callback != NULL) {
 		gossip_debug (DEBUG_DOMAIN, "ID[%d] Calling back...", id);
@@ -965,8 +964,8 @@
 		return;
 	}
 
+	gossip_chatroom_set_last_error (room->chatroom, GOSSIP_CHATROOM_ERROR_NONE);
 	gossip_chatroom_set_status (room->chatroom, GOSSIP_CHATROOM_STATUS_INACTIVE);
-	gossip_chatroom_set_last_error (room->chatroom, NULL);
 
 	g_hash_table_remove (chatrooms->room_id_hash,
 			     GINT_TO_POINTER (id));
@@ -1038,8 +1037,8 @@
 	room->callback = callback;
 	room->user_data = user_data;
 
+	gossip_chatroom_set_last_error (room->chatroom, GOSSIP_CHATROOM_ERROR_NONE);
 	gossip_chatroom_set_status (chatroom, GOSSIP_CHATROOM_STATUS_JOINING);
-	gossip_chatroom_set_last_error (room->chatroom, NULL);
 
 	/* Compose message. */
 	m = lm_message_new_with_sub_type (gossip_jid_get_full (room->jid),
@@ -1120,8 +1119,8 @@
 		room->join_handler = NULL;
 	}
 
+	gossip_chatroom_set_last_error (room->chatroom, GOSSIP_CHATROOM_ERROR_NONE);
 	gossip_chatroom_set_status (room->chatroom, GOSSIP_CHATROOM_STATUS_INACTIVE);
-	gossip_chatroom_set_last_error (room->chatroom, NULL);
 
 	if (room->callback != NULL) {
 		gossip_debug (DEBUG_DOMAIN, "ID[%d] Calling back...", id);

Modified: trunk/src/gossip-chat-view.c
==============================================================================
--- trunk/src/gossip-chat-view.c	(original)
+++ trunk/src/gossip-chat-view.c	Wed Mar 12 17:59:36 2008
@@ -1047,9 +1047,12 @@
 
 	bottom = chat_view_is_scrolled_down (view);
 
-	gossip_theme_append_timestamp (priv->theme, priv->theme_context,
-				       view, NULL,
-				       TRUE, TRUE);
+	/* FIXME: We don't call this because it breaks, GossipMessage
+	 * can not be NULL.
+	 */
+	/* gossip_theme_append_timestamp (priv->theme, priv->theme_context, */
+	/* 			       view, NULL, */
+	/* 			       TRUE, TRUE); */
 
 	if (message) {
 		gossip_theme_append_text (priv->theme, priv->theme_context,

Modified: trunk/src/gossip-chat-window.c
==============================================================================
--- trunk/src/gossip-chat-window.c	(original)
+++ trunk/src/gossip-chat-window.c	Wed Mar 12 17:59:36 2008
@@ -200,8 +200,6 @@
 								GossipMessage         *message,
 								gboolean               is_backlog,
 								GossipChatWindow      *window);
-static void         chat_window_disconnected_cb                (GossipApp             *app,
-								GossipChatWindow      *window);
 static GtkNotebook* chat_window_detach_hook                    (GtkNotebook           *source,
 								GtkWidget             *page,
 								gint                   x,
@@ -397,13 +395,8 @@
 	/* Set up signals we can't do with glade since we may need to
 	 * block/unblock them at some later stage.
 	 */
-	g_signal_connect (gossip_app_get_session (),
-			  "disconnected",
-			  G_CALLBACK (chat_window_disconnected_cb),
-			  window);
-
 	g_signal_connect (priv->dialog,
-			  "delete_event",
+			  "delete-event",
 			  G_CALLBACK (chat_window_delete_event_cb),
 			  window);
 
@@ -422,23 +415,23 @@
 				  priv->notebook);
 
 	g_signal_connect (priv->dialog,
-			  "focus_in_event",
+			  "focus-in-event",
 			  G_CALLBACK (chat_window_focus_in_event_cb),
 			  window);
 	g_signal_connect_after (priv->notebook,
-				"switch_page",
+				"switch-page",
 				G_CALLBACK (chat_window_page_switched_cb),
 				window);
 	g_signal_connect (priv->notebook,
-			  "page_reordered",
+			  "page-reordered",
 			  G_CALLBACK (chat_window_page_reordered_cb),
 			  window);
 	g_signal_connect (priv->notebook,
-			  "page_added",
+			  "page-added",
 			  G_CALLBACK (chat_window_page_added_cb),
 			  window);
 	g_signal_connect (priv->notebook,
-			  "page_removed",
+			  "page-removed",
 			  G_CALLBACK (chat_window_page_removed_cb),
 			  window);
 
@@ -517,10 +510,6 @@
 	window = GOSSIP_CHAT_WINDOW (object);
 	priv = GET_PRIV (window);
 
-	g_signal_handlers_disconnect_by_func (gossip_app_get_session (),
-					      chat_window_disconnected_cb,
-					      window);
-
 	if (priv->save_geometry_id != 0) {
 		g_source_remove (priv->save_geometry_id);
 	}
@@ -1544,28 +1533,6 @@
 	}
 }
 
-static void
-chat_window_disconnected_cb (GossipApp        *app,
-			     GossipChatWindow *window)
-{
-	GossipChatWindowPriv *priv;
-	GList		     *l;
-
-	g_return_if_fail (GOSSIP_IS_CHAT_WINDOW (window));
-
-	priv = GET_PRIV (window);
-
-	/* FIXME: This works for now, but should operate on a PER
-	 * protocol basis not ALL connections since some tabs will
-	 * belong to contacts on accounts which might still be online.
-	 */
-	for (l = priv->chats; l != NULL; l = g_list_next (l)) {
-		chat_window_update_status (window, l->data);
-	}
-
-	chat_window_update_menu (window);
-}
-
 static GtkNotebook *
 chat_window_detach_hook (GtkNotebook *source,
 			 GtkWidget   *page,
@@ -1667,16 +1634,16 @@
 	gossip_chat_set_window (chat, window);
 
 	/* Connect chat signals for this window */
-	g_signal_connect (chat, "status_changed",
+	g_signal_connect (chat, "status-changed",
 			  G_CALLBACK (chat_window_status_changed_cb),
 			  window);
-	g_signal_connect (chat, "name_changed",
+	g_signal_connect (chat, "name-changed",
 			  G_CALLBACK (chat_window_name_changed_cb),
 			  window);
 	g_signal_connect (chat, "composing",
 			  G_CALLBACK (chat_window_composing_cb),
 			  window);
-	g_signal_connect (chat, "new_message",
+	g_signal_connect (chat, "new-message",
 			  G_CALLBACK (chat_window_new_message_cb),
 			  window);
 

Modified: trunk/src/gossip-chatrooms-window.c
==============================================================================
--- trunk/src/gossip-chatrooms-window.c	(original)
+++ trunk/src/gossip-chatrooms-window.c	Wed Mar 12 17:59:36 2008
@@ -212,8 +212,8 @@
 {
 	GossipChatroom       *chatroom;
 	GossipChatroomStatus  status;
+	GossipChatroomError   last_error;
 	GdkPixbuf            *pixbuf = NULL;
-	const gchar          *last_error;
 
 	gtk_tree_model_get (model, iter,
 			    COL_IMAGE, &pixbuf,
@@ -235,7 +235,8 @@
 	status = gossip_chatroom_get_status (chatroom);
 	last_error = gossip_chatroom_get_last_error (chatroom);
 
-	if (status == GOSSIP_CHATROOM_STATUS_ERROR && !last_error) {
+	if (status == GOSSIP_CHATROOM_STATUS_ERROR && 
+	    last_error == GOSSIP_CHATROOM_ERROR_NONE) {
 		status = GOSSIP_CHATROOM_STATUS_INACTIVE;
 	}
 

Modified: trunk/src/gossip-group-chat.c
==============================================================================
--- trunk/src/gossip-group-chat.c	(original)
+++ trunk/src/gossip-group-chat.c	Wed Mar 12 17:59:36 2008
@@ -61,6 +61,7 @@
 
 	GossipChatroomProvider *chatroom_provider;
 	GossipChatroom         *chatroom;
+	GossipChatroomStatus    last_status;
 
 	GtkWidget              *widget;
 	GtkWidget              *hpaned;
@@ -120,11 +121,6 @@
 							       GossipAccount                *account,
 							       GossipJabber                 *jabber,
 							       GossipGroupChat              *chat);
-static void            group_chat_protocol_disconnected_cb    (GossipSession                *session,
-							       GossipAccount                *account,
-							       GossipJabber                 *jabber,
-							       gint                          reason,
-							       GossipGroupChat              *chat);
 static gboolean        group_chat_key_press_event_cb          (GtkWidget                    *widget,
 							       GdkEventKey                  *event,
 							       GossipGroupChat              *chat);
@@ -148,6 +144,9 @@
 static void            group_chat_chatroom_name_cb            (GossipChatroom               *chatroom,
 							       GParamSpec                   *spec,
 							       GossipGroupChat              *chat);
+static void            group_chat_chatroom_status_cb          (GossipChatroom               *chatroom,
+							       GParamSpec                   *spec,
+							       GossipGroupChat              *chat);
 static void            group_chat_kicked_cb                   (GossipChatroomProvider       *provider,
 							       gint                          id,
 							       GossipGroupChat              *chat);
@@ -326,11 +325,6 @@
 				 G_CALLBACK (group_chat_protocol_connected_cb),
 				 chat, 0);
 
-	g_signal_connect_object (gossip_app_get_session (),
-				 "protocol-disconnected",
-				 G_CALLBACK (group_chat_protocol_disconnected_cb),
-				 chat, 0);
-
 	chatview = GOSSIP_CHAT_VIEW (GOSSIP_CHAT (chat)->view);
 	gossip_chat_view_set_is_group_chat (chatview, TRUE);
 
@@ -364,23 +358,11 @@
 	id = gossip_chatroom_get_id (priv->chatroom);
 	g_hash_table_steal (group_chats, GINT_TO_POINTER (id));
 
-	if (priv->chatroom) {
-		GossipChatroomStatus status;
-
-		status = gossip_chatroom_get_status (priv->chatroom);
-		if (status == GOSSIP_CHATROOM_STATUS_ACTIVE) {
-			gossip_chatroom_provider_leave (priv->chatroom_provider,
-							gossip_chatroom_get_id (priv->chatroom));
-		} else if (status == GOSSIP_CHATROOM_STATUS_JOINING) {
-			gossip_chatroom_provider_cancel (priv->chatroom_provider,
-							 gossip_chatroom_get_id (priv->chatroom));
-		}
-
-		g_object_unref (priv->chatroom);
-	}
-
 	g_signal_handlers_disconnect_by_func (priv->chatroom, 
-					      G_CALLBACK (group_chat_chatroom_name_cb),
+					      group_chat_chatroom_name_cb,
+					      chat);
+	g_signal_handlers_disconnect_by_func (priv->chatroom, 
+					      group_chat_chatroom_status_cb,
 					      chat);
 	g_signal_handlers_disconnect_by_func (priv->chatroom_provider,
 					      group_chat_kicked_cb, 
@@ -406,6 +388,25 @@
 	g_signal_handlers_disconnect_by_func (priv->chatroom,
 					      group_chat_contact_info_changed_cb,
 					      chat);
+
+	/* Make sure we do this AFTER removing signal handlers
+	 * because when we update the status, we get called back and
+	 * the widget is destroyed. 
+	 */
+	if (priv->chatroom) {
+		GossipChatroomStatus status;
+
+		status = gossip_chatroom_get_status (priv->chatroom);
+		if (status == GOSSIP_CHATROOM_STATUS_ACTIVE) {
+			gossip_chatroom_provider_leave (priv->chatroom_provider,
+							gossip_chatroom_get_id (priv->chatroom));
+		} else if (status == GOSSIP_CHATROOM_STATUS_JOINING) {
+			gossip_chatroom_provider_cancel (priv->chatroom_provider,
+							 gossip_chatroom_get_id (priv->chatroom));
+		}
+
+		g_object_unref (priv->chatroom);
+	}
 	
 	g_object_unref (priv->chatroom_provider);
 
@@ -464,83 +465,68 @@
 }
 
 static void
-group_chat_join (GossipGroupChat *chat)
+group_chat_chatroom_status_update (GossipGroupChat     *chat,
+				   GossipChatroomError  error)
 {
-	GossipGroupChatPriv *priv;
+	GossipGroupChatPriv  *priv;
+	GossipChatroomStatus  status;
+	const gchar          *event_str;
 
 	priv = GET_PRIV (chat);
 
-	gossip_chatroom_provider_join (priv->chatroom_provider,
-				       priv->chatroom,
-				       (GossipChatroomJoinCb) group_chat_join_cb,
-				       NULL);
-
-	group_chat_set_scrolling_for_events (chat, TRUE);
-	gossip_chat_view_append_event (GOSSIP_CHAT (chat)->view, 
-				       _("Connecting..."));
-	group_chat_set_scrolling_for_events (chat, FALSE);
-
-	g_signal_emit_by_name (chat, "status-changed");
-}
-
-static void     
-group_chat_join_cb (GossipChatroomProvider *provider,
-		    GossipChatroomId        id,
-		    GossipChatroomError     error,
-		    gpointer                user_data)
-{
-	GossipGroupChatPriv *priv;
-	GossipChat          *chat;
-	GossipChatView      *chatview;
-	GtkTreeView         *view;
-	GtkTreeModel        *model;
-	GtkTreeStore        *store;
-	GtkWidget           *button;
-	const gchar         *error_str;
+	status = gossip_chatroom_get_status (priv->chatroom);
 
-	chat = g_hash_table_lookup (group_chats, GINT_TO_POINTER (id));
-	if (!chat) {
+	/* If the state is different, then do something */
+	if (status == priv->last_status) {
 		return;
 	}
 
-	priv = GET_PRIV (chat);
-
-	error_str = gossip_chatroom_provider_error_to_string (error);
-
-	gossip_debug (DEBUG_DOMAIN, 
-		      "Join callback for id:%d, error:%d->'%s'", 
-		      id, error, error_str);
-
-	chatview = chat->view;
-	g_signal_emit_by_name (chat, "status-changed");
+	priv->last_status = status;
 
-	/* Set the time we joined this chatroom so we know for new
-	 * messages if they are backlog or not.
+	/* Make widgets available based on state */
+	gtk_widget_set_sensitive (priv->hbox_topic, 
+				  status == GOSSIP_CHATROOM_STATUS_ACTIVE);
+	gtk_widget_set_sensitive (priv->scrolled_window_contacts, 
+				  status == GOSSIP_CHATROOM_STATUS_ACTIVE);
+	gtk_widget_set_sensitive (priv->scrolled_window_input, 
+				  status == GOSSIP_CHATROOM_STATUS_ACTIVE);
+
+	/* Clear previous roster if re-connecting */
+	if (status == GOSSIP_CHATROOM_STATUS_ACTIVE && 
+	    error != GOSSIP_CHATROOM_ERROR_ALREADY_OPEN) {
+		GtkTreeView  *view;
+		GtkTreeModel *model;
+		GtkTreeStore *store;
+		
+		view = GTK_TREE_VIEW (priv->treeview);
+		model = gtk_tree_view_get_model (view);
+		store = GTK_TREE_STORE (model);
+		gtk_tree_store_clear (store);
+	}
+	
+	/* Either print state or error */
+	if (error == GOSSIP_CHATROOM_ERROR_NONE ||
+	    error == GOSSIP_CHATROOM_ERROR_ALREADY_OPEN) {
+		event_str = gossip_chatroom_status_to_string (status);
+	} else {
+		event_str = gossip_chatroom_error_to_string (error);
+	}
+	
+	/* Add status event message */
+	group_chat_set_scrolling_for_events (chat, TRUE);
+	gossip_chat_view_append_event (GOSSIP_CHAT (chat)->view, event_str);
+	group_chat_set_scrolling_for_events (chat, FALSE);
+	
+	/* If we have a situation where we can retry, add a button to
+	 * do so. 
 	 */
-	priv->time_joined = gossip_time_get_current ();
+	if (error == GOSSIP_CHATROOM_ERROR_NICK_IN_USE ||
+	    error == GOSSIP_CHATROOM_ERROR_MAXIMUM_USERS_REACHED ||
+	    error == GOSSIP_CHATROOM_ERROR_TIMED_OUT ||
+	    error == GOSSIP_CHATROOM_ERROR_UNKNOWN ||
+	    error == GOSSIP_CHATROOM_ERROR_CANCELED) {
+		GtkWidget *button;
 
-	/* Check the error */
-	switch (error) {
-	case GOSSIP_CHATROOM_ERROR_NONE:
-	case GOSSIP_CHATROOM_ERROR_ALREADY_OPEN:
-		break;
-
-	case GOSSIP_CHATROOM_ERROR_PASSWORD_INVALID_OR_MISSING:
-	case GOSSIP_CHATROOM_ERROR_USER_BANNED:
-	case GOSSIP_CHATROOM_ERROR_ROOM_NOT_FOUND:
-	case GOSSIP_CHATROOM_ERROR_ROOM_CREATION_RESTRICTED:
-	case GOSSIP_CHATROOM_ERROR_USE_RESERVED_ROOM_NICK:
-	case GOSSIP_CHATROOM_ERROR_NOT_ON_MEMBERS_LIST:
-		group_chat_set_scrolling_for_events (GOSSIP_GROUP_CHAT (chat), TRUE);
-		gossip_chat_view_append_event (chatview, error_str);
-		group_chat_set_scrolling_for_events (GOSSIP_GROUP_CHAT (chat), FALSE);
-		return;
-
-	case GOSSIP_CHATROOM_ERROR_NICK_IN_USE:
-	case GOSSIP_CHATROOM_ERROR_MAXIMUM_USERS_REACHED:
-	case GOSSIP_CHATROOM_ERROR_TIMED_OUT:
-	case GOSSIP_CHATROOM_ERROR_UNKNOWN:
-	case GOSSIP_CHATROOM_ERROR_CANCELED:
 		/* FIXME: Need special case for nickname to put an
 		 * entry in the chat view and to request a new nick.
 		 */
@@ -549,69 +535,72 @@
 				  G_CALLBACK (group_chat_retry_connection_clicked_cb),
 				  chat);
 
-		group_chat_set_scrolling_for_events (GOSSIP_GROUP_CHAT (chat), TRUE);
-		gossip_chat_view_append_event (chatview, error_str);
-		gossip_chat_view_append_button (chatview,
+		group_chat_set_scrolling_for_events (chat, TRUE);
+		gossip_chat_view_append_button (GOSSIP_CHAT (chat)->view,
 						NULL,
 						button,
 						NULL);
-		group_chat_set_scrolling_for_events (GOSSIP_GROUP_CHAT (chat), FALSE);
-
-		return;
+		group_chat_set_scrolling_for_events (chat, FALSE);
 	}
 
-	/* Clear previous roster */
-	view = GTK_TREE_VIEW (priv->treeview);
-	model = gtk_tree_view_get_model (view);
-	store = GTK_TREE_STORE (model);
-	gtk_tree_store_clear (store);
-	
-	/* Make widgets available */
-	gtk_widget_set_sensitive (priv->hbox_topic, TRUE);
-	gtk_widget_set_sensitive (priv->scrolled_window_contacts, TRUE);
-	gtk_widget_set_sensitive (priv->scrolled_window_input, TRUE);
-
-	group_chat_set_scrolling_for_events (GOSSIP_GROUP_CHAT (chat), TRUE);
-	gossip_chat_view_append_event (chatview, _("Connected"));
-	group_chat_set_scrolling_for_events (GOSSIP_GROUP_CHAT (chat), FALSE);
+	/* Signal to the chat object to update */
+	g_signal_emit_by_name (chat, "status-changed");
 
 	gtk_widget_grab_focus (GOSSIP_CHAT (chat)->input_text_view);
 }
 
 static void
-group_chat_protocol_connected_cb (GossipSession   *session,
-				  GossipAccount   *account,
-				  GossipJabber    *jabber,
-				  GossipGroupChat *chat)
+group_chat_join (GossipGroupChat *chat)
 {
 	GossipGroupChatPriv *priv;
-	GossipAccount       *this_account;
 
 	priv = GET_PRIV (chat);
 
-	this_account = gossip_contact_get_account (priv->own_contact);
-	if (!gossip_account_equal (this_account, account)) {
+	gossip_chatroom_provider_join (priv->chatroom_provider,
+				       priv->chatroom,
+				       (GossipChatroomJoinCb) group_chat_join_cb,
+				       NULL);
+}
+
+static void     
+group_chat_join_cb (GossipChatroomProvider *provider,
+		    GossipChatroomId        id,
+		    GossipChatroomError     error,
+		    gpointer                user_data)
+{
+	GossipGroupChatPriv *priv;
+	GossipChat          *chat;
+
+	chat = g_hash_table_lookup (group_chats, GINT_TO_POINTER (id));
+
+	if (!chat) {
 		return;
 	}
 
-	g_signal_emit_by_name (chat, "status-changed");
+	priv = GET_PRIV (chat);
 
-/* 	gtk_widget_set_sensitive (GOSSIP_CHAT (chat)->input_text_view, TRUE); */
+	/* Set the time we joined this chatroom so we know for new
+	 * messages if they are backlog or not.
+	 */
+	priv->time_joined = gossip_time_get_current ();
 
-/*	gossip_chat_view_append_event (GOSSIP_CHAT (chat)->view, _("Connected")); */
+	gossip_debug (DEBUG_DOMAIN, 
+		      "Join callback for id:%d, error:%d->'%s'", 
+		      id, 
+		      error, 
+		      gossip_chatroom_error_to_string (error));
 
-	/* FIXME: We should really attempt to re-join group chat here */
+	group_chat_chatroom_status_update (GOSSIP_GROUP_CHAT (chat), error);
 }
 
 static void
-group_chat_protocol_disconnected_cb (GossipSession   *session,
-				     GossipAccount   *account,
-				     GossipJabber    *jabber,
-				     gint             reason,
-				     GossipGroupChat *chat)
+group_chat_protocol_connected_cb (GossipSession   *session,
+				  GossipAccount   *account,
+				  GossipJabber    *jabber,
+				  GossipGroupChat *chat)
 {
-	GossipGroupChatPriv *priv;
-	GossipAccount       *this_account;
+	GossipGroupChatPriv  *priv;
+	GossipAccount        *this_account;
 
 	priv = GET_PRIV (chat);
 
@@ -620,16 +609,12 @@
 		return;
 	}
 
-	gtk_widget_set_sensitive (priv->hbox_topic, FALSE);
-	gtk_widget_set_sensitive (priv->scrolled_window_contacts, FALSE);
-	gtk_widget_set_sensitive (priv->scrolled_window_input, FALSE);
-
-	/* i18n: Disconnected as in "was disconnected". */
-	group_chat_set_scrolling_for_events (chat, TRUE);
-	gossip_chat_view_append_event (GOSSIP_CHAT (chat)->view, _("Disconnected"));
-	group_chat_set_scrolling_for_events (chat, FALSE);
+	/* Here we attempt to reconnect if we are not already connected */
+	if (gossip_chatroom_get_status (priv->chatroom) == GOSSIP_CHATROOM_STATUS_ACTIVE) {
+		return;
+	}
 
-	g_signal_emit_by_name (chat, "status-changed");
+	group_chat_join (chat);
 }
 
 static gboolean
@@ -1076,7 +1061,21 @@
 			     GParamSpec      *spec,
 			     GossipGroupChat *chat)
 {
-	g_signal_emit_by_name (chat, "name_changed", gossip_chatroom_get_name (chatroom));
+	g_signal_emit_by_name (chat, "name-changed", gossip_chatroom_get_name (chatroom));
+}
+
+static void
+group_chat_chatroom_status_cb (GossipChatroom  *chatroom,
+			       GParamSpec      *spec,
+			       GossipGroupChat *chat)
+{
+	GossipGroupChatPriv *priv;
+	GossipChatroomError  last_error;
+
+	priv = GET_PRIV (chat);
+
+	last_error = gossip_chatroom_get_last_error (priv->chatroom);
+	group_chat_chatroom_status_update (chat, last_error);
 }
 
 static void
@@ -1259,7 +1258,7 @@
 		return;
 	}
 
-	error_str = gossip_chatroom_provider_error_to_string (error);
+	error_str = gossip_chatroom_error_to_string (error);
 
 	gossip_debug (DEBUG_DOMAIN, "[%d] Error:%d->'%s'", 
 		      id, error, error_str);
@@ -2524,6 +2523,7 @@
 
 	priv->chatroom = g_object_ref (chatroom);
 	priv->chatroom_provider = g_object_ref (provider);
+	priv->last_status = gossip_chatroom_get_status (chatroom);
 
 	priv->private_chats = NULL;
 
@@ -2532,6 +2532,9 @@
 	g_signal_connect (chatroom, "notify::name",
 			  G_CALLBACK (group_chat_chatroom_name_cb),
 			  chat);
+	g_signal_connect (chatroom, "notify::status",
+			  G_CALLBACK (group_chat_chatroom_status_cb),
+			  chat);
 	g_signal_connect (provider, "chatroom-kicked",
 			  G_CALLBACK (group_chat_kicked_cb),
 			  chat);

Modified: trunk/src/gossip-new-chatroom-dialog.c
==============================================================================
--- trunk/src/gossip-new-chatroom-dialog.c	(original)
+++ trunk/src/gossip-new-chatroom-dialog.c	Wed Mar 12 17:59:36 2008
@@ -428,8 +428,8 @@
 {
 	GossipChatroom       *chatroom;
 	GossipChatroomStatus  status;
+	GossipChatroomError   last_error;
 	GdkPixbuf            *pixbuf = NULL;
-	const gchar          *last_error;
 
 	gtk_tree_model_get (model, iter,
 			    COL_IMAGE, &pixbuf,
@@ -455,7 +455,8 @@
 	status = gossip_chatroom_get_status (chatroom);
 	last_error = gossip_chatroom_get_last_error (chatroom);
 
-	if (status == GOSSIP_CHATROOM_STATUS_ERROR && !last_error) {
+	if (status == GOSSIP_CHATROOM_STATUS_ERROR && 
+	    last_error == GOSSIP_CHATROOM_ERROR_NONE) {
 		status = GOSSIP_CHATROOM_STATUS_INACTIVE;
 	}
 



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