Method: CmdPanelCaptionWidget#reload_mounts

Defined in:
lib/unixcmd/panel.rb

#reload_mountsObject



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/unixcmd/panel.rb', line 57

def reload_mounts
    cur_mounts = Array.new
    new_mounts = Array.new 

    Sys::Filesystem.mounts do |mount|
        # TODO: make correct mounts filter
        next if mount.mount_type != 'vfat' && mount.mount_type != 'ntfs' && mount.mount_type != 'ext3' && mount.mount_type != 'ext2' && mount.mount_type != 'ext4'
        new_mounts << Pathname.new(mount.mount_point).to_s
    end

    @mounts.model.each do |model, path, iter|
        cur_mounts << model.get_value(iter, 0)
    end

    if new_mounts != cur_mounts
        @mounts.signal_handler_block @mounts_handler
        @mounts.model.clear
        @mounts.active = -1
        new_mounts.each { |point| @mounts.append_text point }
        @mounts.signal_handler_unblock @mounts_handler
    end
end