empathy r641 - trunk/libempathy-gtk
- From: xclaesse svn gnome org
- To: svn-commits-list gnome org
- Subject: empathy r641 - trunk/libempathy-gtk
- Date: Sat, 16 Feb 2008 09:22:53 +0000 (GMT)
Author: xclaesse
Date: Sat Feb 16 09:22:52 2008
New Revision: 641
URL: http://svn.gnome.org/viewvc/empathy?rev=641&view=rev
Log:
Block events messages when the chat is connecting to a new Text channel. Fixes bug #507515 and #516198.
Modified:
trunk/libempathy-gtk/empathy-chat.c
trunk/libempathy-gtk/empathy-chat.h
trunk/libempathy-gtk/empathy-group-chat.c
trunk/libempathy-gtk/empathy-private-chat.c
Modified: trunk/libempathy-gtk/empathy-chat.c
==============================================================================
--- trunk/libempathy-gtk/empathy-chat.c (original)
+++ trunk/libempathy-gtk/empathy-chat.c Sat Feb 16 09:22:52 2008
@@ -80,6 +80,7 @@
gboolean first_tp_chat;
time_t last_log_timestamp;
gboolean is_first_char;
+ guint block_events_timeout_id;
/* Used to automatically shrink a window that has temporarily
* grown due to long input.
*/
@@ -414,6 +415,10 @@
g_source_remove (priv->scroll_idle_id);
}
+ if (priv->block_events_timeout_id) {
+ g_source_remove (priv->block_events_timeout_id);
+ }
+
g_free (priv->id);
G_OBJECT_CLASS (empathy_chat_parent_class)->finalize (object);
@@ -1439,6 +1444,18 @@
empathy_geometry_load (empathy_chat_get_id (chat), x, y, w, h);
}
+static gboolean
+chat_block_events_timeout_cb (gpointer data)
+{
+ EmpathyChat *chat = EMPATHY_CHAT (data);
+ EmpathyChatPriv *priv = GET_PRIV (chat);
+
+ chat->block_events = FALSE;
+ priv->block_events_timeout_id = 0;
+
+ return FALSE;
+}
+
void
empathy_chat_set_tp_chat (EmpathyChat *chat,
EmpathyTpChat *tp_chat)
@@ -1455,6 +1472,15 @@
return;
}
+ /* Block events for some time to avoid having "has come online" or
+ * "joined" messages. */
+ chat->block_events = TRUE;
+ if (priv->block_events_timeout_id != 0) {
+ g_source_remove (priv->block_events_timeout_id);
+ }
+ priv->block_events_timeout_id =
+ g_timeout_add_seconds (1, chat_block_events_timeout_cb, chat);
+
if (priv->tp_chat) {
g_signal_handlers_disconnect_by_func (priv->tp_chat,
chat_message_received_cb,
Modified: trunk/libempathy-gtk/empathy-chat.h
==============================================================================
--- trunk/libempathy-gtk/empathy-chat.h (original)
+++ trunk/libempathy-gtk/empathy-chat.h Sat Feb 16 09:22:52 2008
@@ -58,6 +58,7 @@
/* Protected */
EmpathyChatView *view;
GtkWidget *input_text_view;
+ gboolean block_events;
};
struct _EmpathyChatClass {
Modified: trunk/libempathy-gtk/empathy-group-chat.c
==============================================================================
--- trunk/libempathy-gtk/empathy-group-chat.c (original)
+++ trunk/libempathy-gtk/empathy-group-chat.c Sat Feb 16 09:22:52 2008
@@ -355,20 +355,18 @@
gboolean is_member,
EmpathyGroupChat *chat)
{
- EmpathyGroupChatPriv *priv;
- gchar *str;
-
- priv = GET_PRIV (chat);
-
- if (is_member) {
- str = g_strdup_printf (_("%s has joined the room"),
- empathy_contact_get_name (contact));
- } else {
- str = g_strdup_printf (_("%s has left the room"),
- empathy_contact_get_name (contact));
+ if (!EMPATHY_CHAT (chat)->block_events) {
+ gchar *str;
+ if (is_member) {
+ str = g_strdup_printf (_("%s has joined the room"),
+ empathy_contact_get_name (contact));
+ } else {
+ str = g_strdup_printf (_("%s has left the room"),
+ empathy_contact_get_name (contact));
+ }
+ empathy_chat_view_append_event (EMPATHY_CHAT (chat)->view, str);
+ g_free (str);
}
- empathy_chat_view_append_event (EMPATHY_CHAT (chat)->view, str);
- g_free (str);
}
static void
@@ -571,13 +569,15 @@
priv->topic = str;
gtk_label_set_text (GTK_LABEL (priv->label_topic), priv->topic);
- if (!G_STR_EMPTY (priv->topic)) {
- str = g_strdup_printf (_("Topic set to: %s"), priv->topic);
- } else {
- str = g_strdup (_("No topic defined"));
+ if (!EMPATHY_CHAT (chat)->block_events) {
+ if (!G_STR_EMPTY (priv->topic)) {
+ str = g_strdup_printf (_("Topic set to: %s"), priv->topic);
+ } else {
+ str = g_strdup (_("No topic defined"));
+ }
+ empathy_chat_view_append_event (EMPATHY_CHAT (chat)->view, str);
+ g_free (str);
}
- empathy_chat_view_append_event (EMPATHY_CHAT (chat)->view, str);
- g_free (str);
}
static void
Modified: trunk/libempathy-gtk/empathy-private-chat.c
==============================================================================
--- trunk/libempathy-gtk/empathy-private-chat.c (original)
+++ trunk/libempathy-gtk/empathy-private-chat.c Sat Feb 16 09:22:52 2008
@@ -223,7 +223,7 @@
empathy_contact_get_id (contact));
if (!empathy_contact_is_online (contact)) {
- if (priv->is_online) {
+ if (priv->is_online && !EMPATHY_CHAT (chat)->block_events) {
gchar *msg;
msg = g_strdup_printf (_("%s went offline"),
@@ -237,7 +237,7 @@
g_signal_emit_by_name (chat, "composing", FALSE);
} else {
- if (!priv->is_online) {
+ if (!priv->is_online && !EMPATHY_CHAT (chat)->block_events) {
gchar *msg;
msg = g_strdup_printf (_("%s has come online"),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]