Sha256: 9622bb1e3a8b7e817261fff2efdc74c9d7dde9e56c62d1d5d8f8e576cfc313c4

Contents?: true

Size: 999 Bytes

Versions: 1

Compression:

Stored size: 999 Bytes

Contents

require 'jldrill/contexts/FileProgressContext'
require 'jldrill/views/gtk/widgets/ProgressBar'
require 'gtk2'

module JLDrill::Gtk

	class FileProgress < JLDrill::FileProgressContext::FileProgress
	
        attr_reader :progressWindow
        	
		def initialize(context)
			super(context)
			@progressBar = ProgressBar.new(self)
            @progressBar.expandWidgetWidth
			@block = nil
			@id = nil
		end
		
		def getWidget
			@progressBar
		end
	
		def filename
			return File.basename(@context.getFilename)
		end

		def update(fraction)
		    @progressBar.update(fraction)
		end
		
		def run
		    if @block.call
                stop
		    end
            return true
		end

        def stop
            if !@id.nil?
                Gtk.idle_remove(@id)
                @id = nil
                @block = nil
            end
        end
		
		def idle_add(&block)
		    if @block.nil? && @id.nil?
		        @block = block
		        @id = Gtk.idle_add do run end
		    end
		end
    end
    
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jldrill-0.5.1.7 lib/jldrill/views/gtk/FileProgress.rb