sync now
This commit is contained in:
parent
912bb6fc84
commit
7babad2d65
@ -14,6 +14,7 @@ SYNC_CHECK_COUNT = 600
|
|||||||
SYNC_CHECK_TIME = 0.1
|
SYNC_CHECK_TIME = 0.1
|
||||||
|
|
||||||
@queue = Atomic.new([])
|
@queue = Atomic.new([])
|
||||||
|
@sync_now = false
|
||||||
|
|
||||||
def <<(dirs)
|
def <<(dirs)
|
||||||
@queue.update { |q| q += dirs ; q }
|
@queue.update { |q| q += dirs ; q }
|
||||||
@ -26,7 +27,7 @@ def check
|
|||||||
Thread.new do
|
Thread.new do
|
||||||
while true do
|
while true do
|
||||||
begin
|
begin
|
||||||
if @queue.value.length > 0 || remote_sync_check == 0
|
if @queue.value.length > 0 || remote_sync_check == 0 || @sync_now
|
||||||
dir = nil
|
dir = nil
|
||||||
@queue.update { |q| ; dir = q.shift ; q }
|
@queue.update { |q| ; dir = q.shift ; q }
|
||||||
|
|
||||||
@ -48,6 +49,7 @@ def check
|
|||||||
animation[:done] = true
|
animation[:done] = true
|
||||||
|
|
||||||
remote_sync_check = SYNC_CHECK_COUNT
|
remote_sync_check = SYNC_CHECK_COUNT
|
||||||
|
@sync_now = false
|
||||||
end
|
end
|
||||||
rescue => e
|
rescue => e
|
||||||
puts e.message
|
puts e.message
|
||||||
@ -134,6 +136,9 @@ menu = Qt::Menu.new
|
|||||||
@status = Qt::Action.new("Unison watch idle.", menu)
|
@status = Qt::Action.new("Unison watch idle.", menu)
|
||||||
@status.enabled = false
|
@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 = Qt::Action.new("View transfer log", menu)
|
||||||
log.connect(SIGNAL :triggered) { system %{open #{TRANSFER_LOG}} }
|
log.connect(SIGNAL :triggered) { system %{open #{TRANSFER_LOG}} }
|
||||||
|
|
||||||
@ -143,6 +148,7 @@ quit = Qt::Action.new("Quit", menu)
|
|||||||
quit.connect(SIGNAL :triggered) { exiting = true }
|
quit.connect(SIGNAL :triggered) { exiting = true }
|
||||||
|
|
||||||
menu.addAction @status
|
menu.addAction @status
|
||||||
|
menu.addAction sync_now
|
||||||
menu.addSeparator
|
menu.addSeparator
|
||||||
menu.addAction log
|
menu.addAction log
|
||||||
menu.addAction quit
|
menu.addAction quit
|
||||||
|
Loading…
Reference in New Issue
Block a user