diff --git a/Rakefile b/Rakefile
index 1788316..e69de29 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,5 +0,0 @@
-desc 'Build app'
-task :build_app do
- cp_r 'skel/UnisonWatch.app', '.'
-end
-
diff --git a/assets/unison.icns b/assets/unison.icns
new file mode 100644
index 0000000..4ece3c2
Binary files /dev/null and b/assets/unison.icns differ
diff --git a/bin/setfileicon b/bin/setfileicon
new file mode 100755
index 0000000..6dee14a
Binary files /dev/null and b/bin/setfileicon differ
diff --git a/lib/unison/bridge.rb b/lib/unison/bridge.rb
index 0f58cdc..0338a94 100644
--- a/lib/unison/bridge.rb
+++ b/lib/unison/bridge.rb
@@ -4,16 +4,19 @@ module Unison
new(*args).run(&block)
end
- def initialize(profiles, log)
- @profiles, @log = profiles, log
+ def initialize(config, log)
+ @config, @log = config, log
end
def run(&block)
Thread.new do
begin
- @profiles.each do |profile|
- #system %{bash -c 'unison -log -logfile #{@log} -batch #{profile} 2>>#{@log}.stderr >>#{@log}.stdout'}
- system %{bash -c 'unison -log -logfile #{@log} -batch #{profile}'}
+ @config.profiles.each do |profile|
+ system %{bash -c '#{@config.unison_binary} -ui text -log -logfile #{@log} -batch #{profile}'}
+
+ if $?.exitstatus != 0
+ system %{bash -c '#{@config.unison_binary} -ui graphic #{profile}'}
+ end
end
block.call
diff --git a/lib/unison/cli.rb b/lib/unison/cli.rb
index bab9ad0..218d950 100644
--- a/lib/unison/cli.rb
+++ b/lib/unison/cli.rb
@@ -30,6 +30,8 @@ module Unison
end
File.chmod(0755, "UnisonWatch.app/Contents/MacOS/UnisonWatch")
+
+ system %{bin/setfileicon assets/unison.icns UnisonWatch.app}
end
no_tasks do
diff --git a/lib/unison/config.rb b/lib/unison/config.rb
index a5192ed..9105a60 100644
--- a/lib/unison/config.rb
+++ b/lib/unison/config.rb
@@ -14,7 +14,11 @@ module Unison
end
def self.skel_data
- { 'profiles' => [], 'time_between_checks' => DEFAULT_TIME_BETWEEN_CHECKS }
+ {
+ 'profiles' => [],
+ 'time_between_checks' => DEFAULT_TIME_BETWEEN_CHECKS,
+ 'unison_binary' => '/usr/bin/unison'
+ }
end
def set_profile(profile, is_set)
@@ -63,6 +67,15 @@ module Unison
save
end
+ def unison_binary
+ data['unison_binary']
+ end
+
+ def unison_binary=(binary)
+ data['unison_binary'] = binary
+ save
+ end
+
def data
@data.update { |d| d || YAML.load_file(@file) }
@data.value
diff --git a/lib/unison/ui/about.rb b/lib/unison/ui/about.rb
new file mode 100644
index 0000000..e69de29
diff --git a/lib/unison/ui/fileview.rb b/lib/unison/ui/fileview.rb
index 37e34ef..3216a4a 100644
--- a/lib/unison/ui/fileview.rb
+++ b/lib/unison/ui/fileview.rb
@@ -15,6 +15,11 @@ module Unison
self.connect(SIGNAL(:textChanged), &method(:on_text_change))
end
+ def show
+ super
+ self.raise
+ end
+
def on_text_change
self.moveCursor Qt::TextCursor::End
end
diff --git a/lib/unison/ui/preferences.rb b/lib/unison/ui/preferences.rb
index 597fe40..95991cd 100644
--- a/lib/unison/ui/preferences.rb
+++ b/lib/unison/ui/preferences.rb
@@ -9,6 +9,11 @@ module Unison
generate
end
+ def show
+ super
+ self.raise
+ end
+
def generate
layout = Qt::GridLayout.new
@@ -35,8 +40,14 @@ module Unison
count_field = Qt::LineEdit.new(@config.time_between_checks.to_s)
count_field.connect(SIGNAL "textChanged(QString)") { |string| @config.time_between_checks = string.to_i }
+ binary_label = Qt::Label.new("Unison binary:")
+ binary_field = Qt::LineEdit.new(@config.unison_binary)
+ binary_field.connect(SIGNAL "textChanged(QString)") { |string| @config.unison_binary = string }
+
fields_layout.addWidget(count_label, 0, 0)
fields_layout.addWidget(count_field, 0, 1)
+ fields_layout.addWidget(binary_label, 1, 0)
+ fields_layout.addWidget(binary_field, 1, 1)
performance_group_layout.addWidget(fields)
layout.addWidget(profile_group, 0, 0)
diff --git a/lib/unison/watcher.rb b/lib/unison/watcher.rb
index 6ff2d63..241c636 100644
--- a/lib/unison/watcher.rb
+++ b/lib/unison/watcher.rb
@@ -3,11 +3,10 @@ require 'forwardable'
module Unison
class Watcher < Qt::Application
TRANSFER_LOG = '~/unison.log'
- SYNC_CHECK_TIME = 0.1
+ SYNC_CHECK_TIME = 0.05
extend Forwardable
- def_delegators :@config, :profiles
def initialize(profiles, *args)
super(*args)
@@ -22,7 +21,7 @@ module Unison
end
def time_between_checks
- @config.time_between_checks * 10
+ @config.time_between_checks * 20
end
def <<(dirs)
@@ -30,7 +29,7 @@ module Unison
end
def processed_profiles
- @processed_profiles ||= Unison::Profile.process(profiles)
+ @processed_profiles ||= Unison::Profile.process(@config.profiles)
end
def watch
@@ -68,7 +67,7 @@ module Unison
end
def ui
- @icon = Unison::UI::Icon.new(menu, self, profiles, File.join(Unison.root, 'assets'))
+ @icon = Unison::UI::Icon.new(menu, self, @config.profiles, File.join(Unison.root, 'assets'))
@config.on_update { @icon.profiles = @config.profiles }
@current_icon = 'idle'
@@ -129,7 +128,7 @@ module Unison
@done = false
- Unison::Bridge.run(profiles, TRANSFER_LOG) { @done = true }
+ Unison::Bridge.run(@config, TRANSFER_LOG) { @done = true }
show_working
diff --git a/skel/UnisonWatch.app/Contents/Info.plist b/skel/UnisonWatch.app/Contents/Info.plist
index d7f7127..25fad93 100644
--- a/skel/UnisonWatch.app/Contents/Info.plist
+++ b/skel/UnisonWatch.app/Contents/Info.plist
@@ -7,7 +7,7 @@
CFBundleGetInfoString
Unison Watch
CFBundleIdentifier
- webapps.webrunner
+ unisonwatch
CFBundleInfoDictionaryVersion
6.0
CFBundleName