This commit is contained in:
John Bintz 2012-05-03 06:21:48 -04:00
parent 912bb6fc84
commit 7babad2d65
1 changed files with 7 additions and 1 deletions

View File

@ -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