diff src/gtkconv.c @ 10971:57e3e958ff49

[gaim-migrate @ 12796] This commit includes the changes I made to oldstatus to make urgent notification/taskbar flashing more sensible (auto- tab switching), the changes to notify.c so that tab switching doesn't reset the counters, and the changes and translations for gaim.desktop committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 06 Jun 2005 01:40:46 +0000
parents aae07c7e23a3
children 56cfc50d2a81
line wrap: on
line diff
--- a/src/gtkconv.c	Sun Jun 05 02:57:14 2005 +0000
+++ b/src/gtkconv.c	Mon Jun 06 01:40:46 2005 +0000
@@ -135,6 +135,22 @@
 	return TRUE;
 }
 
+/*
+ * When a conversation window is focused, we know the user
+ * has looked at it so we know there are no longer unseen
+ * messages.
+ */
+static gint
+focus_win_cb(GtkWidget *w, GdkEventFocus *e, gpointer d)
+{
+	GaimConvWindow *win = (GaimConvWindow *)d;
+	GaimConversation *conv = gaim_conv_window_get_active_conversation(win);
+
+	gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE);
+
+	return FALSE;
+}
+
 static gint
 close_conv_cb(GtkWidget *w, GaimGtkConversation *gtkconv)
 {
@@ -2863,7 +2879,11 @@
 
 	gtkwin  = GAIM_GTK_WINDOW(win);
 
-	gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE);
+	/*
+	 * Only set "unseen" to "none" if the window has focus
+	 */
+	if (gaim_conv_window_has_focus(win))
+		gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE);
 
 	/* Update the menubar */
 	gray_stuff_out(gtkconv);
@@ -4191,6 +4211,9 @@
 	g_signal_connect(G_OBJECT(gtkwin->window), "delete_event",
 					 G_CALLBACK(close_win_cb), win);
 
+	g_signal_connect(G_OBJECT(gtkwin->window), "focus_in_event",
+					 G_CALLBACK(focus_win_cb), win);
+
 	/* Create the notebook. */
 	gtkwin->notebook = gtk_notebook_new();