summaryrefslogtreecommitdiff
path: root/ext/tk/sample/tkbiff.rb
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-29 08:05:30 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-29 08:05:30 +0000
commit7544bfc130b6d75fd77defff3f47fd06e2ebf9bd (patch)
treeafab7bccab385e1c51a7ef3133a831fca0d97561 /ext/tk/sample/tkbiff.rb
parent37b2487c7097aa72775f0f3f17f058cfc820dabd (diff)
* bug fix ( tested with Ruby/Tk widget demo )
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/sample/tkbiff.rb')
-rw-r--r--ext/tk/sample/tkbiff.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/ext/tk/sample/tkbiff.rb b/ext/tk/sample/tkbiff.rb
index ac27184437..5fe367fd97 100644
--- a/ext/tk/sample/tkbiff.rb
+++ b/ext/tk/sample/tkbiff.rb
@@ -12,7 +12,7 @@ if ARGV.length == 0
if ENV['MAIL']
$spool = ENV['MAIL']
else
- $spool = '/usr/spool/mail/' + ENV['USER']
+ $spool = '/var/spool/mail/' + ENV['USER']
end
else
$spool = ARGV[0]
@@ -70,7 +70,13 @@ end
require "tkscrollbox"
+my_appname = Tk.appname('tkbiff')
$top = TkRoot.new
+if ((TkWinfo.interps($top) - [my_appname]).find{|ip| ip =~ /^tkbiff/})
+ STDERR.print("Probably other 'tkbiff's are running. Bye.\n")
+ exit
+end
+
$top.withdraw
$list = TkScrollbox.new($top) {
relief 'raised'
@@ -136,12 +142,12 @@ def pop_up
$list.see 'end'
end
$top.deiconify
- Tk.after 2000, proc{$top.withdraw}
+ Tk.after 2000, proc{$top.iconify}
end
$list.insert 'end', "You have no mail."
check
-Tk.after 2000, proc{$top.withdraw}
+Tk.after 2000, proc{$top.iconify}
begin
Tk.mainloop
rescue