Module: Yast::PartitioningEpUnusedInclude

Defined in:
../../src/include/partitioning/ep-unused.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) CreateUnusedPanel(user_data)



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

  table_header = StorageFields.TableHeader(fields)
  table_contents = StorageFields.TableContents(
    fields,
    target_map,
    fun_ref(_Predicate, "symbol (map, map)")
  )

  UI.ReplaceWidget(
    :tree_panel,
    Greasemonkey.Transform(
      VBox(
        # heading
        term(:IconAndHeading, _("Unused Devices"), StorageIcons.unused_icon),
        Table(
          Id(:table),
          Opt(:keepSorting, :notify, :notifyContextMenu),
          table_header,
          table_contents
        ),
        HBox(
          # push button text
          PushButton(Id(:rescan), Opt(:key_F6), _("Rescan")),
          HStretch()
        )
      )
    )
  )

  # helptext
  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

- (Object) HandleUnusedPanel(user_data, event)



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File '../../src/include/partitioning/ep-unused.rb', line 116

def HandleUnusedPanel(user_data, event)
  user_data = deep_copy(user_data)
  event = deep_copy(event)
  device = Convert.to_string(UI.QueryWidget(Id(:table), :CurrentItem))

  case Event.IsWidgetContextMenuActivated(event)
    when :table
      EpContextMenuDevice(device)
  end

  case Event.IsWidgetActivated(event)
    when :rescan
      # popup message
      if Popup.YesNo(
          _(
            "Rescanning unused devices cancels\nall current changes. Really rescan unused devices?"
          )
        )
        RescanDisks()
        Storage.CreateTargetBackup("expert-partitioner")

        UpdateMainStatus()
        UpdateNavigationTree(nil)
        TreePanel.Create
      end
  end

  nil
end

- (Object) initialize_partitioning_ep_unused(include_target)



28
29
30
31
32
# File '../../src/include/partitioning/ep-unused.rb', line 28

def initialize_partitioning_ep_unused(include_target)
  textdomain "storage"

  Yast.include include_target, "partitioning/ep-dialogs.rb"
end