 
         preview_button = @element.find("a[href=#png-preview]")
         preview_button.click () =>
+            preview_button.icon_spin(true)
             @show_page('png-preview')
-            @preview.update()
+            @preview.update
+                cb: () =>
+                    preview_button.icon_spin(false)
             return false
 
         @element.find("a[href=#pdf-preview]").click () =>

                                    console.log("sha1sum: error parsing line=#{line}")
                        cb()
                        
            # get the png's whose sha1s changed
            (cb) =>
                console.log("sha1_changed = ", sha1_changed)
                update = (obj, cb) =>

                               "-dLastPage=#{opts.last_page}",
                               "-dDownScaleFactor=#{opts.downscale}",
                               @filename_pdf]
                else if @image_type == "jpg"
                    args = ['-dBATCH', '-dNOPAUSE',
                                '-sDEVICE=jpeg',
                               "-sOutputFile=#{tmp}/%d.jpg",
                               "-r#{opts.resolution}",
                               "-dFirstPage=#{opts.first_page}",
                               "-dLastPage=#{opts.last_page}",
                               "-dJPEGQ=#{opts.jpeg_quality}",
                               @filename_pdf] 
                else
                    cb("unknown image type #{@image_type}")
                    return
                console.log(args)
                @_exec
                    command : 'gs'
