[Tkabber-dev] r1738 - trunk/tkabber

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Tue Mar 17 10:11:25 MSK 2009


Author: sergei
Date: 2009-03-17 10:11:25 +0300 (Tue, 17 Mar 2009)
New Revision: 1738

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/messages.tcl
Log:
	* messages.tcl: Don't create subject menu on every incoming message.
	  This helps to create correct menu if it's an offline message and came
	  befor the roster.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2009-03-15 17:32:49 UTC (rev 1737)
+++ trunk/tkabber/ChangeLog	2009-03-17 07:11:25 UTC (rev 1738)
@@ -1,3 +1,9 @@
+2009-03-17  Sergei Golovan  <sgolovan at nes.ru>
+
+	* messages.tcl: Don't create subject menu on every incoming message.
+	  This helps to create correct menu if it's an offline message and came
+	  befor the roster.
+
 2009-03-15  Sergei Golovan  <sgolovan at nes.ru>
 
 	* msgs/de.msg: Updated German translation (thanks to Roger Sondermann).

Modified: trunk/tkabber/messages.tcl
===================================================================
--- trunk/tkabber/messages.tcl	2009-03-15 17:32:49 UTC (rev 1737)
+++ trunk/tkabber/messages.tcl	2009-03-17 07:11:25 UTC (rev 1738)
@@ -101,7 +101,8 @@
 
     label $mw.title.lab -text $title
     menubutton $mw.title.mb -text $from -menu $mw.title.mb.menu
-    subject_menu $mw.title.mb.menu $xlib $from message
+    menu $mw.title.mb.menu -tearoff 0 \
+	 -postcommand [namespace code [list subject_menu $mw.title.mb.menu $xlib $from message]]
     grid $mw.title.lab -row 1 -column 0 -sticky e
     grid $mw.title.mb  -row 1 -column 1 -sticky w
 
@@ -163,7 +164,7 @@
     pack $mw.rsw -side top -fill both -expand yes -in $mw.frame
     pack $mw.rbody -side top -fill both -expand yes -in $mw.rsw
     $mw.rsw setwidget $mw.rbody
- 
+
     if {$replyP} {
         button $mw.cite -text [::msgcat::mc "Quote"] -command [list message::quote $mw $body]
         pack $mw.cite -side top -anchor e -in $mw.frame
@@ -410,7 +411,7 @@
 	    -dropcmd [list message::jiddropcmd] \
 	    -values $message_dest_list
     }
-    
+
     label $mw.f.lsubj -text [::msgcat::mc "Subject: "]
     entry $mw.f.subj
     $mw.f.subj insert 0 $subject
@@ -448,7 +449,7 @@
 
 proc message::send0 {mw args} {
     variable send_dialog_xlib
-    
+
     foreach c [connections] {
 	if {[connection_jid $c] == $send_dialog_xlib($mw)} {
 	    set xlib $c
@@ -470,7 +471,7 @@
     }
 
     set jid [$mw.f.to cget -text]
-    
+
     if {$group} {
 	set jids [roster::get_group_jids $xlib $jid \
 		      -nested $::ifacetk::roster::options(nested) \
@@ -513,7 +514,7 @@
                 debugmsg message "ssj::${tag}:output: $cdata"
                 return [list error ssj]
             }
-            
+
             if {![cequal $cdata ""]} {
                 lappend xs [::xmpp::xml::create x \
                                 -xmlns jabber:x:$tag -cdata $cdata]
@@ -612,7 +613,8 @@
 
     label $mw.subj.lab -text [::msgcat::mc "Subscription request from:"]
     menubutton $mw.subj.mb -text $from -menu $mw.subj.mb.menu
-    subject_menu $mw.subj.mb.menu $xlib $from subscribe
+    menu $mw.subj.mb.menu -tearoff 0 \
+	 -postcommand [namespace code [list subject_menu $mw.subj.mb.menu $xlib $from subscribe]]
     grid $mw.subj.lab -row 1 -column 0 -sticky e
     grid $mw.subj.mb  -row 1 -column 1 -sticky w
 
@@ -725,15 +727,19 @@
 ###############################################################################
 
 proc message::subject_menu {m xlib jid type} {
-    if {[winfo exists $m]} {
-        destroy $m          
-    }                       
-    menu $m -tearoff 0
+    if {![winfo exists $m]} {
+	menu $m -tearoff 0
+    } else {
+	$m delete 0 end
+	foreach mm [winfo children $m] {
+	    destroy $mm
+	}
+    }
 
     hook::run message_dialog_menu_hook $m $xlib $jid
 
     return $m
-}   
+}
 
 ###############################################################################
 
@@ -890,7 +896,7 @@
 
 proc message::send_subscribe {mw xlib args} {
     set jid [$mw.subj.entry get]
-    
+
     ::xmpp::sendPresence $xlib -to $jid -type subscribe \
         -status [$mw.body get 1.0 end]
 



More information about the Tkabber-dev mailing list