changeset 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 a126bdfd7688
children d5ce9d01f540
files ChangeLog gaim.desktop plugins/ChangeLog.API plugins/notify.c src/conversation.c src/gtkconv.c
diffstat 6 files changed, 105 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Jun 05 02:57:14 2005 +0000
+++ b/ChangeLog	Mon Jun 06 01:40:46 2005 +0000
@@ -1,6 +1,6 @@
 Gaim: The Pimpin' Penguin IM Client that's good for the soul!
 
-version 2.0.0
+version 2.0.0:
 	New Features:
 	* Insane rewrite of all code dealing with buddy and account status, away
 	  messages, away states, online/offline, etc.  Huge thanks to Christian,
--- a/gaim.desktop	Sun Jun 05 02:57:14 2005 +0000
+++ b/gaim.desktop	Mon Jun 06 01:40:46 2005 +0000
@@ -1,5 +1,38 @@
 [Desktop Entry]
 Encoding=UTF-8
+Categories=Application;Network;
+Comment=Send instant messages over multiple protocols
+Comment[da]=Send beskeder over flere protokoller
+Comment[de]=Multi-Protokoll Instant Messenger Client
+Comment[es]=Cliente de mensajería instantánea multiprotocolo
+Comment[fr]=Client de messagerie instantanée multiprotocole
+Comment[hu]=Többprotokollos üzenőkliens
+Comment[it]=Client multiprotocollo per messaggi immediati
+Comment[ko]=다중 프로토콜 메신저
+Comment[nb]=Send lynmeldinger over flere protokoller
+Comment[nl]=Multi-protocol programma voor expresberichten
+Comment[pl]=Komunikator internetowy obsługujący kilka protokołów
+Comment[pt_BR]=Cliente multi-protocolo de mensagens
+Comment[pt]=Envie mensagens instantâneas sobre vários protocolos
+Comment[sl]=Večprotokolni odjemalec za neposredno sporočanje
+Comment[sq]=Dërgoni mesazhe të atypëratyshëm protokollesh të ndryshëm
+Comment[sv]=Sänder snabbmeddelande över många protokoll
+Comment[zh_CN]=通过多种协议发送即时消息
+GenericName=Internet Messenger
+GenericName[da]=Internet beskeder
+GenericName[fr]=Messagerie instantanée
+GenericName[hu]=IM
+GenericName[it]=Internet Messenger
+GenericName[ko]=메신저
+GenericName[nb]=Lynmeldingsklient
+GenericName[nl]=Expresberichten
+GenericName[pl]=Komunikator Internetowy
+GenericName[pt_BR]=Mensageiro da Internet Gaim
+GenericName[pt]=Mensageiro Internet
+GenericName[sl]=Spletni sel
+GenericName[sq]=Lajmësjellës Internet
+GenericName[sv]=Meddelandeklient
+GenericName[zh_CN]=互联网通讯程序
 Name=Gaim Internet Messenger
 Name[da]=Gaim - internet beskeder
 Name[de]=Gaim Internet Messenger
@@ -7,39 +40,16 @@
 Name[hu]=Gaim IM
 Name[it]=Gaim Internet Messenger
 Name[ko]=게임 메신저
+Name[nb]=Gaim lynmeldingsklient
 Name[nl]=Gaim - Expresberichten
 Name[pl]=Komunikator Internetowy Gaim
-Name[pt]=Mensageiro Instantâneo Gaim
+Name[pt]=Mensageiro Internet Gaim
 Name[sl]=Gaim - spletni sel
+Name[sq]=Lajmësjellësi Internet Gaim
 Name[sv]=Gaim Internet Messenger
-GenericName=Internet Messenger
-GenericName[da]=Internet beskeder
-GenericName[fr]=Messagerie instantanée
-GenericName[hu]=IM
-GenericName[it]=Internet Messenger
-GenericName[ko]=메신저
-GenericName[nl]=Expresberichten
-GenericName[pl]=Komunikator Internetowy
-GenericName[pt]=Mensageiro Instantâneo
-GenericName[pt_BR]=Mensageiro da Internet Gaim
-GenericName[sl]=Spletni sel
-Comment=Send instant messages over multiple protocols
-Comment[da]=Multiprotokolsklient til at sende og modtage beskeder
-Comment[de]=Multi-Protokoll Instant Messenger Client
-Comment[es]=Cliente de mensajería instantánea multiprotocolo
-Comment[fr]=Client de messagerie instantanée multiprotocole
-Comment[hu]=Többprotokollos üzenőkliens
-Comment[it]=Client multiprotocollo per messaggi immediati
-Comment[ko]=다중 프로토콜 메신저
-Comment[nl]=Multi-protocol programma voor expresberichten
-Comment[pl]=Komunikator internetowy obsługujący kilka protokołów
-Comment[pt]=Cliente de mensagens instantâneas multi-protocolo
-Comment[pt_BR]=Cliente multi-protocolo de mensagens
-Comment[sl]=Večprotokolni odjemalec za neposredno sporočanje
-Comment[sv]=Meddelandenklient för många protokoll
+Name[zh_CN]=Gaim 互联网通讯程序
 Exec=gaim
 Icon=gaim.png
+StartupNotify=true
 Terminal=false
 Type=Application
-Categories=Application;Network;
-StartupNotify=true
--- a/plugins/ChangeLog.API	Sun Jun 05 02:57:14 2005 +0000
+++ b/plugins/ChangeLog.API	Mon Jun 06 01:40:46 2005 +0000
@@ -1,6 +1,6 @@
 Gaim: The Pimpin' Penguin IM Client that's good for the soul!
 
-version 2.0.0cvs:
+version 2.0.0:
 	* Changed: All the status stuff. Yay!
 	* Changed: gaim_prefs_connect_callback(), added handle parameter
 	* Added:   gaim_prefs_disconnect_by_handle()
--- a/plugins/notify.c	Sun Jun 05 02:57:14 2005 +0000
+++ b/plugins/notify.c	Mon Jun 06 01:40:46 2005 +0000
@@ -179,8 +179,8 @@
 	             "has-toplevel-focus", &has_focus, NULL);
 
 	if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_focused") ||
-	    (has_focus && gaim_conv_window_get_active_conversation(gaimwin) != conv) ||
-	    !has_focus) {
+	    !has_focus ||
+	    gaim_conv_window_get_active_conversation(gaimwin) != conv) {
 		if (increment) {
 			count = GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count"));
 			count++;
@@ -196,6 +196,9 @@
 static void
 notify_win(GaimConvWindow *gaimwin)
 {
+	if (count_messages(gaimwin) <= 0)
+		return;
+
 	if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_count"))
 		handle_count(gaimwin);
 	if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string"))
@@ -382,12 +385,20 @@
 	attach_signals(conv);
 }
 
-#if 0
 static void
 conv_switched(GaimConversation *old_conv, GaimConversation *new_conv)
 {
+#if 0
 	GaimConvWindow *gaimwin = gaim_conversation_get_window(new_conv);
+#endif
 
+	/*
+	 * If the conversation was switched, then make sure we re-notify
+	 * because Gaim will have overwritten our custom window title.
+	 */
+	notify(new_conv, FALSE);
+
+#if 0
 	printf("conv_switched - %p - %p\n", old_conv, new_conv);
 	printf("count - %d\n", count_messages(gaimwin));
 	if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch"))
@@ -398,8 +409,8 @@
 		if (count_messages(gaimwin))
 			notify_win(gaimwin);
 	}
+#endif
 }
-#endif
 
 static void
 deleting_conv(GaimConversation *conv)
@@ -779,9 +790,9 @@
 	                    GAIM_CALLBACK(conv_created), NULL);
 	gaim_signal_connect(conv_handle, "deleting-conversation", plugin,
 	                    GAIM_CALLBACK(deleting_conv), NULL);
-#if 0
 	gaim_signal_connect(conv_handle, "conversation-switched", plugin,
 	                    GAIM_CALLBACK(conv_switched), NULL);
+#if 0
 	gaim_signal_connect(gtk_conv_handle, "conversation-drag-ended", plugin,
 	                    GAIM_CALLBACK(conversation_drag_ended), NULL);
 #endif
--- a/src/conversation.c	Sun Jun 05 02:57:14 2005 +0000
+++ b/src/conversation.c	Mon Jun 06 01:40:46 2005 +0000
@@ -533,8 +533,6 @@
 	if (ops != NULL && ops->switch_conversation != NULL)
 		ops->switch_conversation(win, conv);
 
-	gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE);
-
 	gaim_signal_emit(gaim_conversations_get_handle(),
 					 "conversation-switched", old_conv, conv);
 }
@@ -1362,7 +1360,13 @@
 			gaim_conv_im_set_typing_state(GAIM_CONV_IM(conv), GAIM_NOT_TYPING);
 	}
 
-	if (gaim_conv_window_get_active_conversation(win) != conv) {
+	if (gaim_conv_window_has_focus(win) &&
+		gaim_conv_window_get_active_conversation(win) == conv)
+	{
+		unseen = GAIM_UNSEEN_NONE;
+	}
+	else
+	{
 		if ((flags & GAIM_MESSAGE_NICK) == GAIM_MESSAGE_NICK ||
 				gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK)
 			unseen = GAIM_UNSEEN_NICK;
@@ -1373,10 +1377,25 @@
 		else
 			unseen = GAIM_UNSEEN_TEXT;
 	}
-	else
-		unseen = GAIM_UNSEEN_NONE;
 
 	gaim_conversation_set_unseen(conv, unseen);
+
+	/*
+	 * If we received an IM, and the GaimConvWindow is not active,
+	 * then make this conversation the active tab in this GaimConvWindow.
+	 *
+	 * We do this so that, when the user comes back to the conversation
+	 * window, the first thing they'll see is the new message.  This is
+	 * especially important when the IM window is flashing in their
+	 * taskbar--we want the title of the window to be set to the name
+	 * of the person that IMed them most recently.
+	 */
+	if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) &&
+		(flags & (GAIM_MESSAGE_RECV | GAIM_MESSAGE_ERROR)) &&
+		(!gaim_conv_window_has_focus(win)))
+	{
+		gaim_conv_window_switch_conversation(win, conv);
+	}
 }
 
 void
@@ -1620,6 +1639,7 @@
 	/*
 	 * Change the active conversation to this conversation unless the
 	 * user is already using this window.
+	 * TODO: There's a good chance this is no longer necessary
 	 */
 	if (!gaim_conv_window_has_focus(window))
 		gaim_conv_window_switch_conversation(window, conv);
--- 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();