Posted to tcl by saedelaere at Sun Dec 06 21:59:58 GMT 2009view raw

  1. proc timeshift_calcDF {cancel} {
  2. if {"$cancel" == "cancel"} {
  3. puts $::main(debug_msg) "\033\[0;1;33mDebug: timeshift_calcDF \033\[0;1;31m::cancel:: \033\[0m"
  4. catch {after cancel $::timeshif(df_id)}
  5. unset -nocomplain ::timeshif(df_id)
  6. return
  7. }
  8. catch {exec df "$::option(timeshift_path)/"} df_values
  9. foreach line [split $df_values "\n"] {
  10. if {[string is digit [lindex $line 3]]} {
  11. set remaining_space [expr int([lindex $line 3].0 / 1024)]
  12. if {$remaining_space <= $::option(timeshift_df)} {
  13. log_writeOutTv 2 "Remaining space <= $::option(timeshift_df)\MB will stop timeshift."
  14. timeshift .top_buttons.button_timeshift
  15. return
  16. }
  17. }
  18. }
  19. after 1000 [list timeshift_calcDF 0]
  20. }
  21.