[Tkabber-dev] r1474 - in trunk/tkabber: . ifacetk

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Fri Jul 11 19:20:14 MSD 2008


Author: sergei
Date: 2008-07-11 19:20:13 +0400 (Fri, 11 Jul 2008)
New Revision: 1474

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/ifacetk/iface.tcl
Log:
	* ifacetk/iface.tcl: Added an option to show only personal messages
	  (chat or highlighted) in windows titles (thanks to Antoni Grzymala).


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2008-07-11 10:35:49 UTC (rev 1473)
+++ trunk/tkabber/ChangeLog	2008-07-11 15:20:13 UTC (rev 1474)
@@ -3,6 +3,9 @@
 	* chats.tcl: Use left-justified text in chat window/tab JID
 	  menubutton.
 
+	* ifacetk/iface.tcl: Added an option to show only personal messages
+	  (chat or highlighted) in windows titles (thanks to Antoni Grzymala).
+
 2008-07-08  Sergei Golovan  <sgolovan at nes.ru>
 
 	* jabberlib/wrapper.tcl, tclxml/sgmlparser.tcl: Bugfix in XMLNS prefix

Modified: trunk/tkabber/ifacetk/iface.tcl
===================================================================
--- trunk/tkabber/ifacetk/iface.tcl	2008-07-11 10:35:49 UTC (rev 1473)
+++ trunk/tkabber/ifacetk/iface.tcl	2008-07-11 15:20:13 UTC (rev 1474)
@@ -66,8 +66,14 @@
 	[::msgcat::mc "Show number of unread messages in tab titles."] \
 	-group IFace -type boolean
 
+    custom::defvar options(only_personal_messages_in_window_title) 0 \
+	[::msgcat::mc "Show only the number of personal unread messages\
+		       in window title."] \
+	-group IFace -type boolean
+
     custom::defvar options(update_title_delay) 600 \
-	[::msgcat::mc "Delay between getting focus and updating window or tab title in milliseconds."] \
+	[::msgcat::mc "Delay between getting focus and updating window or\
+		       tab title in milliseconds."] \
 	-group IFace -type integer
 
     custom::defvar options(show_tearoffs) 1 \
@@ -1120,16 +1126,24 @@
 	}
 	.nb itemconfigure [nbpage $cw] -text $tabtitle
     } else {
-	if {$personal_msg($chatid)} {
+	if {$personal_msg($chatid) > 0} {
 	    set star "*"
 	} else {
 	    set star ""
 	}
-	if {$number_msg($chatid) > 0} {
-	    set title "($number_msg($chatid)$star) $chat::chats(titlename,$chatid)"
+
+	if {$options(only_personal_messages_in_window_title)} {
+	    set messages $personal_msg($chatid)
 	} else {
+	    set messages $number_msg($chatid)
+	}
+
+	if {$messages > 0} {
+	    set title "($messages$star) $chat::chats(titlename,$chatid)"
+	} else {
 	    set title $chat::chats(titlename,$chatid)
 	}
+
 	wm title $cw $title
 	wm iconname $cw $title
     }
@@ -1147,6 +1161,7 @@
 
 proc ifacetk::update_main_window_title {} {
     global usetabbar
+    variable options
     variable main_window_title
     variable number_msg
     variable personal_msg
@@ -1155,12 +1170,21 @@
 
     set star ""
     set messages 0
-    foreach chatid [chat::opened] {
-	incr messages $number_msg($chatid)
-	if {$personal_msg($chatid)} {
-	    set star "*"
-	}
+
+    if {$options(only_personal_messages_in_window_title)} {
+        set star "*"
+        foreach chatid [chat::opened] {
+            incr messages $personal_msg($chatid)
+        }
+    } else {
+        foreach chatid [chat::opened] {
+            incr messages $number_msg($chatid)
+            if {$personal_msg($chatid) > 0} {
+                set star "*"
+            }
+        }
     }
+
     if {$messages} {
 	set title "($messages$star) $main_window_title"
     } else {
@@ -1210,7 +1234,7 @@
 
     if {$type == "chat"} {
 	incr number_msg($chatid)
-	set personal_msg($chatid) 1
+	incr personal_msg($chatid)
     } elseif {$type == "groupchat"} {
 	set jid [chat::get_jid $chatid]
 	set myjid [chat::our_jid $chatid]
@@ -1220,7 +1244,7 @@
 	}
 	if {![cequal $jid $from] && ![cequal $myjid $from] && \
 		[check_message $mynick $body]} {
-	    set personal_msg($chatid) 1
+	    incr personal_msg($chatid)
 	}
     }
     update_chat_title $chatid



More information about the Tkabber-dev mailing list