From 7babad2d6593c16ff46b339c882cfcfc0a6a837d Mon Sep 17 00:00:00 2001 From: John Bintz Date: Thu, 3 May 2012 06:21:48 -0400 Subject: [PATCH] sync now --- bin/unison-watch | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/unison-watch b/bin/unison-watch index d78480b..19e4bcf 100755 --- a/bin/unison-watch +++ b/bin/unison-watch @@ -14,6 +14,7 @@ SYNC_CHECK_COUNT = 600 SYNC_CHECK_TIME = 0.1 @queue = Atomic.new([]) +@sync_now = false def <<(dirs) @queue.update { |q| q += dirs ; q } @@ -26,7 +27,7 @@ def check Thread.new do while true do begin - if @queue.value.length > 0 || remote_sync_check == 0 + if @queue.value.length > 0 || remote_sync_check == 0 || @sync_now dir = nil @queue.update { |q| ; dir = q.shift ; q } @@ -48,6 +49,7 @@ def check animation[:done] = true remote_sync_check = SYNC_CHECK_COUNT + @sync_now = false end rescue => e puts e.message @@ -134,6 +136,9 @@ menu = Qt::Menu.new @status = Qt::Action.new("Unison watch idle.", menu) @status.enabled = false +sync_now = Qt::Action.new("Sync now", menu) +sync_now.connect(SIGNAL :triggered) { @sync_now = true } + log = Qt::Action.new("View transfer log", menu) log.connect(SIGNAL :triggered) { system %{open #{TRANSFER_LOG}} } @@ -143,6 +148,7 @@ quit = Qt::Action.new("Quit", menu) quit.connect(SIGNAL :triggered) { exiting = true } menu.addAction @status +menu.addAction sync_now menu.addSeparator menu.addAction log menu.addAction quit