Permalink
Browse files

Switch to using the ui library rather than CocoaDialog.

git-svn-id: http://svn.textmate.org/trunk/Bundles/Darcs.tmbundle@9700 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
  • Loading branch information...
1 parent 2c61440 commit 574477ccf4aada49b44a15c6141ab13a344c63e8 @infininight infininight committed May 25, 2008
Showing with 33 additions and 20 deletions.
  1. +16 −10 Commands/Record All.plist
  2. +17 −10 Commands/Record.plist
View
@@ -1,24 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>saveModifiedFiles</string>
<key>command</key>
<string>cd "${TM_PROJECT_DIRECTORY:=$TM_DIRECTORY}";
-"${TM_RUBY:=ruby}" &lt;&lt;'EOF'
-output = `CocoaDialog inputbox --title Input --informative-text 'Record Message' --button1 Record --button2 'Abort'`
-output = output.split("\n")
+"${TM_RUBY:=ruby}" &lt;&lt;'RUBY'
-# check the button pressed, exit if it wasn't Record
-if(output[0] !~ /^1$/)
- exit
-end
+require "#{ENV['TM_SUPPORT_PATH']}/lib/exit_codes.rb"
+require "#{ENV['TM_SUPPORT_PATH']}/lib/ui.rb"
-output = `darcs record -a -m '#{output[1].strip.gsub(/(')/, '\\\\1')}'`
+output = TextMate::UI.request_string(
+ :title =&gt; 'Input',
+ :prompt =&gt; 'Record Message',
+ :button1 =&gt; 'Record'
+)
-puts(output)</string>
+TextMate.exit_discard if output.nil?
+
+output = `darcs record -a -m '#{output.strip.gsub(/(')/, '\\\\1')}'`
+
+puts(output)
+
+RUBY</string>
<key>input</key>
<string>none</string>
<key>keyEquivalent</key>
View
@@ -1,24 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>saveActiveFile</string>
<key>command</key>
<string>cd "$TM_DIRECTORY";
-"${TM_RUBY:=ruby}" &lt;&lt;'EOF'
-output = `CocoaDialog inputbox --title Input --informative-text 'Record Message' --button1 Record --button2 'Abort'`
-output = output.split("\n")
+"${TM_RUBY:=ruby}" &lt;&lt;'RUBY'
-# check the button pressed, exit if it wasn't Record
-if(output[0] !~ /^1$/)
- exit
-end
+require "#{ENV['TM_SUPPORT_PATH']}/lib/exit_codes.rb"
+require "#{ENV['TM_SUPPORT_PATH']}/lib/ui.rb"
-output = `darcs record -a -m '#{output[1].strip.gsub(/'/, '\\\\1')}' '#{File.basename(ENV['TM_FILEPATH']).gsub(/(')/, '\\\\1')}'`
+output = TextMate::UI.request_string(
+ :title =&gt; 'Input',
+ :prompt =&gt; 'Record Message',
+ :button1 =&gt; 'Record'
+)
-puts(output)</string>
+TextMate.exit_discard if output.nil?
+
+output = `darcs record -a -m '#{output.strip.gsub(/'/, '\\\\1')}' '#{File.basename(ENV['TM_FILEPATH']).gsub(/(')/, '\\\\1')}'`
+
+puts(output)
+
+RUBY
+</string>
<key>input</key>
<string>none</string>
<key>keyEquivalent</key>

0 comments on commit 574477c

Please sign in to comment.