34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
# File '../../src/include/partitioning/ep-unused.rb', line 34
def CreateUnusedPanel(user_data)
user_data = deep_copy(user_data)
_Predicate = lambda do |disk, partition|
disk = deep_copy(disk)
partition = deep_copy(partition)
disk_type = Ops.get_symbol(disk, "type", :CT_UNKNOWN)
if partition == nil
if Builtins.isempty(Ops.get_list(disk, "partitions", [])) &&
!Storage.IsUsedBy(disk)
return :show
end
return :follow
else
if Ops.get_symbol(partition, "type", :primary) != :extended &&
Builtins.isempty(Ops.get_string(partition, "mount", "")) &&
!Storage.IsUsedBy(partition)
return :show
end
return :ignore
end
end
fields = StorageSettings.FilterTable(
[
:device,
:udev_path,
:udev_id,
:size,
:format,
:encrypted,
:type,
:fs_type,
:label
]
)
target_map = Storage.GetTargetMap
= StorageFields.TableHeader(fields)
table_contents = StorageFields.TableContents(
fields,
target_map,
fun_ref(_Predicate, "symbol (map, map)")
)
UI.ReplaceWidget(
:tree_panel,
Greasemonkey.Transform(
VBox(
term(:IconAndHeading, _("Unused Devices"), StorageIcons.unused_icon),
Table(
Id(:table),
Opt(:keepSorting, :notify, :notifyContextMenu),
,
table_contents
),
HBox(
PushButton(Id(:rescan), Opt(:key_F6), _("Rescan")),
HStretch()
)
)
)
)
helptext = _(
"<p>This view shows devices that have no mount\n" +
"point assigned to them, disks that are unpartitioned and volume groups that\n" +
"have no logical volumes.</p>"
)
Wizard.RestoreHelp(Ops.add(helptext, StorageFields.TableHelptext(fields)))
nil
end
|