Module: Yast::PartitioningEpTmpfsInclude

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) CreateTmpfsMainPanel(user_data)



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
114
115
116
117
118
119
120
121
122
123
124
125
126
# File '../../src/include/partitioning/ep-tmpfs.rb', line 82

def CreateTmpfsMainPanel(user_data)
  user_data = deep_copy(user_data)
  fields = StorageSettings.FilterTable(
    [:size, :type, :fs_type, :mount_point]
  )

  target_map = Storage.GetTargetMap
  table_header = StorageFields.TableHeader(fields)
  table_contents = StorageFields.TableContents(
    fields,
    target_map,
    fun_ref(StorageFields.method(:PredicateTmpfs), "symbol (map, map)")
  )
  UI.ReplaceWidget(
    :tree_panel,
    Greasemonkey.Transform(
      VBox(
        HStretch(),
        # heading
        term(:IconAndHeading, _("tmpfs Volumes"), StorageIcons.dm_icon),
        Table(
          Id(:table),
          Opt(:keepSorting, :notify, :notifyContextMenu),
          table_header,
          table_contents
        ),
        ArrangeButtons(
          [
            PushButton(Id(:add), Opt(:key_F3), _("Add...")),
            # push button text
            PushButton(Id(:delete), Opt(:key_F5), _("Delete...")),
            HStretch()
          ] # push button text
        )
      )
    )
  )

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

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

  nil
end

- (Object) CreateTmpfsOverviewTab(user_data)



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File '../../src/include/partitioning/ep-tmpfs.rb', line 143

def CreateTmpfsOverviewTab(user_data)
  user_data = deep_copy(user_data)
  device = Convert.to_string(user_data)
  Builtins.y2milestone("CreateTmpfsOverviewTab 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
    ]
  )

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

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

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

  nil
end

- (Object) CreateTmpfsPanel(user_data)



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File '../../src/include/partitioning/ep-tmpfs.rb', line 207

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

  data = {
    :overview => {
      :create    => fun_ref(method(:CreateTmpfsOverviewTab), "void (any)"),
      :handle    => fun_ref(
        method(:HandleTmpfsOverviewTab),
        "void (any, map)"
      ),
      :user_data => user_data
    }
  }

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

  TabPanel.Init(data, :overview)

  nil
end

- (Object) EpContextMenuTmpfs(device)



35
36
37
38
39
40
41
42
43
44
# File '../../src/include/partitioning/ep-tmpfs.rb', line 35

def EpContextMenuTmpfs(device)
  widget = ContextMenu.Simple([Item(Id(:delete), _("Delete"))])

  case widget
    when :delete
      EpDeleteTmpfsDevice(device)
  end

  nil
end

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



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

def HandleTmpfsButtons(user_data, device, event)
  user_data = deep_copy(user_data)
  event = deep_copy(event)
  Builtins.y2milestone(
    "HandleTmpfsButtons 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 :delete
      EpDeleteTmpfsDevice(device)
    when :add
      EpAddTmpfsDevice()
  end

  nil
end

- (Object) HandleTmpfsMainPanel(user_data, event)



128
129
130
131
132
133
134
135
136
137
138
139
140
# File '../../src/include/partitioning/ep-tmpfs.rb', line 128

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

  nil
end

- (Object) HandleTmpfsOverviewTab(user_data, event)



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File '../../src/include/partitioning/ep-tmpfs.rb', line 190

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

  case Event.IsWidgetActivated(event)
    when :add
      EpAddTmpfsDevice()
    when :delete
      EpDeleteTmpfsDevice(device)
  end

  nil
end

- (Object) HandleTmpfsPanel(user_data, event)



255
256
257
258
259
260
261
# File '../../src/include/partitioning/ep-tmpfs.rb', line 255

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

  nil
end

- (Object) initialize_partitioning_ep_tmpfs(include_target)



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

def initialize_partitioning_ep_tmpfs(include_target)
  textdomain "storage"

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