[Tkabber-dev] r1859 - in trunk/tkabber-plugins: . floatinglog gmail

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Fri Dec 25 23:59:06 MSK 2009


Author: sergei
Date: 2009-12-25 23:59:06 +0300 (Fri, 25 Dec 2009)
New Revision: 1859

Modified:
   trunk/tkabber-plugins/ChangeLog
   trunk/tkabber-plugins/floatinglog/floatinglog.tcl
   trunk/tkabber-plugins/gmail/gmail.tcl
Log:
	* gmail/gmail.tcl: Got rid of using global NS variable.

	* floatinglog/floatinglog.tcl: Destroy floatinglog window if there's
	  no messages to show. Otherwise some earlier messages were displayed
	  and confuse a user on arriving a new message (thanks to Ruslan
	  Rakhmanin).


Modified: trunk/tkabber-plugins/ChangeLog
===================================================================
--- trunk/tkabber-plugins/ChangeLog	2009-12-21 11:34:29 UTC (rev 1858)
+++ trunk/tkabber-plugins/ChangeLog	2009-12-25 20:59:06 UTC (rev 1859)
@@ -1,3 +1,12 @@
+2009-12-25  Sergei Golovan <sgolovan at nes.ru>
+
+	* gmail/gmail.tcl: Got rid of using global NS variable.
+
+	* floatinglog/floatinglog.tcl: Destroy floatinglog window if there's
+	  no messages to show. Otherwise some earlier messages were displayed
+	  and confuse a user on arriving a new message (thanks to Ruslan
+	  Rakhmanin).
+
 2009-10-27  Sergei Golovan <sgolovan at nes.ru>
 
 	* debug/debug.tcl: Moved menu to debug tools submenu.

Modified: trunk/tkabber-plugins/floatinglog/floatinglog.tcl
===================================================================
--- trunk/tkabber-plugins/floatinglog/floatinglog.tcl	2009-12-21 11:34:29 UTC (rev 1858)
+++ trunk/tkabber-plugins/floatinglog/floatinglog.tcl	2009-12-25 20:59:06 UTC (rev 1859)
@@ -121,10 +121,7 @@
 }
 
 proc floatinglog::load {} {
-    hook::add finload_hook [namespace current]::window_initialization 200
 
-    window_initialization
-
     hook::add set_status_hook [namespace current]::process_status
     hook::add process_message_hook [namespace current]::process_message
 }
@@ -136,7 +133,6 @@
 
     hook::remove set_status_hook [namespace current]::process_status
     hook::remove process_message_hook [namespace current]::process_message
-    hook::remove finload_hook [namespace current]::window_initialization 200
 
     catch {destroy $winname}
     catch {unset id}
@@ -172,10 +168,21 @@
     }
 
     set_window
-    bind $winname <Button-3> [list wm withdraw $winname]
+    bind $winname <Button-3> [namespace current]::right_click
     bind $winname <Double-ButtonPress-1> [namespace current]::left_double_click
-    wm withdraw $winname
 }
+
+proc floatinglog::right_click {} {
+    variable winname
+    foreach id [after info] {
+	if {[string first [namespace current]::del_text [after info $id]] >= 0} {
+	    after cancel $id
+	}
+    }
+    if {[winfo exists $winname]} {
+	destroy $winname
+    }
+}
  
 proc floatinglog::left_double_click {} {
     ::ifacetk::systray::restore
@@ -216,16 +223,15 @@
 
     if {!$options(show_on_dnd_status) && $::curuserstatus == "dnd"} return
 
+    if {![winfo exists $winname]} {
+	window_initialization
+    }
     incr id
     if {$options(simple_show_scheme)} {
 	add_text_scheme_simple $text $from $xlib $type $is_subject $subject
     } else {
 	add_text_scheme_01 $text $from $xlib $type $is_subject $subject
     }
-    
-    wm deiconify $winname
-    raise $winname
-    set_window
 }
 
 proc floatinglog::add_text_scheme_simple {body from xlib type is_subject subject} {
@@ -368,7 +374,9 @@
 	destroy $msg
     }
     if {[winfo children $winname] == ""} {
-	wm withdraw $winname
+	if {[winfo exists $winname]} {
+	    destroy $winname
+	}
     }
 }
 
@@ -419,6 +427,7 @@
     wm minsize $winname $options(width) 10
     wm maxsize $winname $options(width) $options(max_height)
     wm geometry $winname $options(position)
+    raise $winname
 } 
 
 # vim:ts=8:sw=4:sts=4:noet

Modified: trunk/tkabber-plugins/gmail/gmail.tcl
===================================================================
--- trunk/tkabber-plugins/gmail/gmail.tcl	2009-12-21 11:34:29 UTC (rev 1858)
+++ trunk/tkabber-plugins/gmail/gmail.tcl	2009-12-25 20:59:06 UTC (rev 1859)
@@ -15,8 +15,6 @@
 	return
     }
 
-    set ::NS(gnotify) "google:mail:notify"
-
     custom::defgroup Plugins \
 	[::msgcat::mc "Plugins options."] \
 	-group Tkabber
@@ -68,8 +66,6 @@
     }
 
     destroy_win .gmail_messages
-
-    unset $::NS(gnotify)
 }
 
 ############################################################################
@@ -102,7 +98,7 @@
     if {$options(gmail_notifications)} {
 	::xmpp::sendIQ $xlib get \
 	    -query [::xmpp::xml::create query \
-			    -xmlns $::NS(gnotify) \
+			    -xmlns google:mail:notify \
 			    -attrs [list  newer-than-time $time]] \
 	    -command [list [namespace current]::receive_notifications $jid]
     }
@@ -599,7 +595,7 @@
     return [list result ""]
 }
 
-::xmpp::iq::register set * $::NS(gnotify) \
+::xmpp::iq::register set * google:mail:notify \
 		     [namespace current]::gmail::notify_response
 
 #############################################################################



More information about the Tkabber-dev mailing list