Module: Yast::PartitioningEpBtrfsInclude

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) CreateBtrfsDevicesTab(user_data)



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
# File '../../src/include/partitioning/ep-btrfs.rb', line 244

def CreateBtrfsDevicesTab(user_data)
  user_data = deep_copy(user_data)
  part_device = Convert.to_string(user_data)
  pos = Builtins.search(part_device, "=")
  if pos != nil
    part_device = Builtins.substring(part_device, Ops.add(pos, 1))
  end
  Builtins.y2milestone(
    "CreateBtrfsDevicesTab user_data:%1 part_device:%2",
    user_data,
    part_device
  )

  _Predicate = lambda do |disk, partition|
    disk = deep_copy(disk)
    partition = deep_copy(partition)
    StorageFields.PredicateUsedByDevice(disk, partition, [part_device])
  end

  fields = StorageSettings.FilterTable(
    [:device, :udev_path, :udev_id, :size, :format, :encrypted, :type]
  )

  target_map = Storage.GetTargetMap

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

  UI.ReplaceWidget(
    :tab_panel,
    VBox(
      Table(
        Id(:table),
        Opt(:keepSorting, :notify),
        table_header,
        table_contents
      )
    )
  )

  # helptext
  helptext = _(
    "<p>This view shows all devices used by the\nselected Btrfs volume.</p>\n"
  )

  Wizard.RestoreHelp(Ops.add(helptext, StorageFields.TableHelptext(fields)))

  nil
end

- (Object) CreateBtrfsMainPanel(user_data)



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File '../../src/include/partitioning/ep-btrfs.rb', line 101

def CreateBtrfsMainPanel(user_data)
  user_data = deep_copy(user_data)
  fields = StorageSettings.FilterTable(
    [
      :device,
      :size,
      :format,
      :encrypted,
      :type,
      :fs_type,
      :label,
      :mount_point,
      :mount_by
    ]
  )

  target_map = Storage.GetTargetMap
  table_header = StorageFields.TableHeader(fields)
  table_contents = StorageFields.TableContents(
    fields,
    target_map,
    fun_ref(StorageFields.method(:PredicateBtrfs), "symbol (map, map)")
  )
  UI.ReplaceWidget(
    :tree_panel,
    Greasemonkey.Transform(
      VBox(
        HStretch(),
        # heading
        term(:IconAndHeading, _("Btrfs Volumes"), StorageIcons.dm_icon),
        Table(
          Id(:table),
          Opt(:keepSorting, :notify, :notifyContextMenu),
          table_header,
          table_contents
        ),
        ArrangeButtons(
          [
            # TRANSLATORS: push button text
            PushButton(Id(:edit), Opt(:key_F4), _("Edit...")),
            # TRANSLATORS: push button text
            # disabled, see bnc #832196
            # PushButton(Id(:resize), Opt(:key_F8), _("Resize...")),
            # TRANSLATORS: push button text
            PushButton(Id(:delete), Opt(:key_F5), _("Delete...")),
            HStretch()
          ]
        )
      )
    )
  )

  # helptext
  helptext = _("<p>This view shows all Btrfs volumes.</p>")

  Wizard.RestoreHelp(Ops.add(helptext, StorageFields.TableHelptext(fields)))

  nil
end

- (Object) CreateBtrfsOverviewTab(user_data)



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File '../../src/include/partitioning/ep-btrfs.rb', line 176

def CreateBtrfsOverviewTab(user_data)
  user_data = deep_copy(user_data)
  device = Convert.to_string(user_data)
  Builtins.y2milestone("CreateBtrfsOverviewTab user_data:%1", user_data)

  target_map = Storage.GetTargetMap

  fields = StorageSettings.FilterOverview(
    [
      :heading_device,
      :device,
      :size,
      :used_by,
      :heading_filesystem,
      :fs_type,
      :mount_point,
      :mount_by,
      :uuid,
      :label
    ]
  )

  UI.ReplaceWidget(
    :tab_panel,
    Greasemonkey.Transform(
      VBox(
        StorageFields.Overview(fields, target_map, device),
        HBox(
          # push button text
          PushButton(Id(:edit), _("Edit...")),
          HStretch()
        )
      )
    )
  )

  # helptext
  helptext = _(
    "<p>This view shows detailed information about the\nselected Btrfs volume.</p>\n"
  )

  Wizard.RestoreHelp(
    Ops.add(helptext, StorageFields.OverviewHelptext(fields))
  )

  nil
end

- (Object) CreateBtrfsPanel(user_data)



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# File '../../src/include/partitioning/ep-btrfs.rb', line 299

def CreateBtrfsPanel(user_data)
  user_data = deep_copy(user_data)
  device = Convert.to_string(user_data)
  Builtins.y2milestone(
    "CreateBtrfsPanel user_data:%1 device:%2",
    user_data,
    device
  )

  data = {
    :overview => {
      :create    => fun_ref(method(:CreateBtrfsOverviewTab), "void (any)"),
      :handle    => fun_ref(
        method(:HandleBtrfsOverviewTab),
        "void (any, map)"
      ),
      :user_data => user_data
    },
    :devices  => {
      :create    => fun_ref(method(:CreateBtrfsDevicesTab), "void (any)"),
      :user_data => user_data
    }
  }

  UI.ReplaceWidget(
    :tree_panel,
    Greasemonkey.Transform(
      VBox(
        # heading
        term(
          :IconAndHeading,
          Builtins.sformat(_("Btrfs Device: %1"), device),
          StorageIcons.lvm_lv_icon
        ),
        DumbTab(
          Id(:tab),
          [
            # push button text
            Item(Id(:overview), _("&Overview")),
            # push button text
            Item(Id(:devices), _("&Used Devices"))
          ],
          ReplacePoint(Id(:tab_panel), TabPanel.empty_panel)
        )
      )
    )
  )

  TabPanel.Init(data, :overview)

  nil
end

- (Object) EpContextMenuBtrfs(device)



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File '../../src/include/partitioning/ep-btrfs.rb', line 36

def EpContextMenuBtrfs(device)
  widget = ContextMenu.Simple(
    [
      # TRANSLATORS: context menu entry
      Item(Id(:edit), _("Edit")),
      # TRANSLATORS: context menu entry
      # disabled, see bnc #832196
      # Item(Id(:resize), _("Resize")),
      # TRANSLATORS: context menu entry
      Item(Id(:delete), _("Delete"))
    ]
  )

  case widget
    when :edit
      EpEditBtrfsDevice(device)
    when :resize
      EpResizeBtrfsDevice(device)
    when :delete
      EpDeleteBtrfsDevice(device)
  end

  nil
end

- (Object) HandleBtrfsButtons(user_data, device, event)



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
# File '../../src/include/partitioning/ep-btrfs.rb', line 62

def HandleBtrfsButtons(user_data, device, event)
  user_data = deep_copy(user_data)
  event = deep_copy(event)
  Builtins.y2milestone(
    "HandleBtrfsButtons device:%1 user_data:%2 event:%3",
    device,
    event,
    user_data
  )
  disk_device = ""

  if user_data == nil
    disk = nil
    part = nil

    target_map = Storage.GetTargetMap
    disk_ref = arg_ref(disk)
    part_ref = arg_ref(part)
    SplitDevice(target_map, device, disk_ref, part_ref)
    disk = disk_ref.value
    part = part_ref.value
    disk_device = Ops.get_string(disk, "device", "")
  else
    disk_device = Convert.to_string(user_data)
  end

  case Event.IsWidgetActivated(event)
    when :edit
      EpEditBtrfsDevice(device)
    when :resize
      EpResizeBtrfsDevice(device)
    when :delete
      EpDeleteBtrfsDevice(device)
  end

  nil
end

- (Object) HandleBtrfsMainPanel(user_data, event)



161
162
163
164
165
166
167
168
169
170
171
172
173
# File '../../src/include/partitioning/ep-btrfs.rb', line 161

def HandleBtrfsMainPanel(user_data, event)
  user_data = deep_copy(user_data)
  event = deep_copy(event)
  device = Convert.to_string(UI.QueryWidget(Id(:table), :CurrentItem))
  HandleBtrfsButtons(user_data, device, event)
  case Event.IsWidgetContextMenuActivated(event)
    when :table
      EpContextMenuDevice(device)
  end
  UI.SetFocus(Id(:table))

  nil
end

- (Object) HandleBtrfsOverviewTab(user_data, event)



225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File '../../src/include/partitioning/ep-btrfs.rb', line 225

def HandleBtrfsOverviewTab(user_data, event)
  user_data = deep_copy(user_data)
  event = deep_copy(event)
  device = Convert.to_string(user_data)
  Builtins.y2milestone("HandleBtrfsOverviewTab user_data:%1", user_data)

  case Event.IsWidgetActivated(event)
    when :edit
      EpEditBtrfsDevice(device)
    when :delete
      EpDeleteBtrfsDevice(device)
    when :resize
      EpResizeBtrfsDevice(device)
  end

  nil
end

- (Object) HandleBtrfsPanel(user_data, event)



353
354
355
356
357
358
359
# File '../../src/include/partitioning/ep-btrfs.rb', line 353

def HandleBtrfsPanel(user_data, event)
  user_data = deep_copy(user_data)
  event = deep_copy(event)
  TabPanel.Handle(event)

  nil
end

- (Object) initialize_partitioning_ep_btrfs(include_target)



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

def initialize_partitioning_ep_btrfs(include_target)
  textdomain "storage"

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