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

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Tue Oct 4 20:14:28 MSD 2011


Author: sergei
Date: 2011-10-04 20:14:28 +0400 (Tue, 04 Oct 2011)
New Revision: 1981

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/ifacetk/systray.tcl
   trunk/tkabber/presence.tcl
Log:
	* ifacetk/systray.tcl, presence.tcl: Introduced new hook
	  systray_menu_hook for popup menu in system tray (thanks to Kirill
	  Korneev).


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2011-09-26 12:31:10 UTC (rev 1980)
+++ trunk/tkabber/ChangeLog	2011-10-04 16:14:28 UTC (rev 1981)
@@ -1,3 +1,9 @@
+2011-10-04  Sergei Golovan  <sgolovan at nes.ru>
+
+	* ifacetk/systray.tcl, presence.tcl: Introduced new hook
+	  systray_menu_hook for popup menu in system tray (thanks to Kirill
+	  Korneev).
+
 2011-09-26  Sergei Golovan  <sgolovan at nes.ru>
 
 	* muc.tcl: Normalized group JID before activating its chat window

Modified: trunk/tkabber/ifacetk/systray.tcl
===================================================================
--- trunk/tkabber/ifacetk/systray.tcl	2011-09-26 12:31:10 UTC (rev 1980)
+++ trunk/tkabber/ifacetk/systray.tcl	2011-10-04 16:14:28 UTC (rev 1981)
@@ -106,38 +106,8 @@
 	-command [list [namespace parent]::about_window]
     $m add separator
     
-    menu $m.presence -title [::msgcat::mc "Presence"] -tearoff $tearoff
+    hook::run systray_menu_hook $m
 
-    $m.presence add command -label [::msgcat::mc "Available"] \
-		-command {set userstatus available}
-    $m.presence add command -label [::msgcat::mc "Free to chat"] \
-		-command {set userstatus chat}
-    $m.presence add command -label [::msgcat::mc "Away"] \
-		-command {set userstatus away}
-    $m.presence add command -label [::msgcat::mc "Extended away"] \
-		-command {set userstatus xa}
-    $m.presence add command -label [::msgcat::mc "Do not disturb"] \
-		-command {set userstatus dnd}
-    $m.presence add separator
-    $m.presence add command -label [::msgcat::mc "Change priority..."] \
-		-command change_priority_dialog
-
-    $m add cascade -label [::msgcat::mc "Presence"] -menu $m.presence
-
-    $m add command -label [::msgcat::mc "Log in..."] \
-	   -command ::ifacetk::login_dialog
-    $m add command -label [::msgcat::mc "Log out"] \
-	   -command ::ifacetk::logout_dialog
-    $m add command -label [::msgcat::mc "Log out with reason..."] \
-	   -command show_logout_dialog
-    $m add separator
-    $m add command -label [::msgcat::mc "Show main window"] \
-		   -command [namespace code restore]
-    $m add command -label [::msgcat::mc "Hide main window"] \
-		   -command [namespace code withdraw]
-    $m add separator
-    $m add command -label [::msgcat::mc "Quit"] -command quit
-
     return $m
 }
 
@@ -388,4 +358,25 @@
 
 ##########################################################################
 
+proc systray::create_menu {m} {
+    $m add command -label [::msgcat::mc "Log in..."] \
+		   -command ::ifacetk::login_dialog
+    $m add command -label [::msgcat::mc "Log out"] \
+		   -command ::ifacetk::logout_dialog
+    $m add command -label [::msgcat::mc "Log out with reason..."] \
+		   -command show_logout_dialog
+    $m add separator
+    $m add command -label [::msgcat::mc "Show main window"] \
+		   -command [namespace code restore]
+    $m add command -label [::msgcat::mc "Hide main window"] \
+		   -command [namespace code withdraw]
+    $m add separator
+    $m add command -label [::msgcat::mc "Quit"] -command quit
+}
+
+hook::add systray_menu_hook \
+		   [namespace current]::systray::create_menu
+
+##########################################################################
+		   
 # vim:ts=8:sw=4:sts=4:noet

Modified: trunk/tkabber/presence.tcl
===================================================================
--- trunk/tkabber/presence.tcl	2011-09-26 12:31:10 UTC (rev 1980)
+++ trunk/tkabber/presence.tcl	2011-10-04 16:14:28 UTC (rev 1981)
@@ -662,4 +662,28 @@
 
 ###############################################################################
 
+proc systray_presence_menu_item {m} {
+    set mp [menu $m.presence -title [::msgcat::mc "Presence"] \
+			     -tearoff $ifacetk::options(show_tearoffs)]
+
+    $mp add command -label [::msgcat::mc "Available"] \
+		    -command {set userstatus available}
+    $mp add command -label [::msgcat::mc "Free to chat"] \
+		    -command {set userstatus chat}
+    $mp add command -label [::msgcat::mc "Away"] \
+		    -command {set userstatus away}
+    $mp add command -label [::msgcat::mc "Extended away"] \
+		    -command {set userstatus xa}
+    $mp add command -label [::msgcat::mc "Do not disturb"] \
+		    -command {set userstatus dnd}
+    $mp add separator
+    $mp add command -label [::msgcat::mc "Change priority..."] \
+		    -command change_priority_dialog
+
+    $m add cascade -label [::msgcat::mc "Presence"] -menu $mp
+
+}
+
+hook::add systray_menu_hook systray_presence_menu_item 40
+
 # vim:ts=8:sw=4:sts=4:noet



More information about the Tkabber-dev mailing list