Module: Yast::BootloaderRoutinesGlobalWidgetsInclude
- Defined in:
- src/include/bootloader/routines/global_widgets.rb
Instance Method Summary (collapse)
-
- (Object) CommonGlobalWidgets
Get general widgets for global bootloader options.
-
- (Object) getAdvancedButtonWidget
Get map of widget.
-
- (Object) GlobalOptionInit(widget)
Init function of widget.
-
- (Object) GlobalOptionStore(widget, _event)
Store function of a widget.
- - (Object) initialize_bootloader_routines_global_widgets(include_target)
-
- (Symbol) InstDetailsButtonHandle(_widget, _event)
Handle function of a widget.
-
- (Symbol) LoaderOptionsButtonHandle(_widget, _event)
Handle function of a widget.
-
- (Symbol) LoaderTypeComboHandle(key, event)
Handle function of a widget.
-
- (Object) LoaderTypeComboInit(widget)
Init function of widget.
-
- (Yast::Term) LoaderTypeComboWidget
Get the widget for boot laoder selection combo.
-
- (Symbol) resetButtonHandle(_widget, event)
Handle function of a widget.
-
- (Object) resetButtonInit(_widget)
Init function of widget.
Instance Method Details
- (Object) CommonGlobalWidgets
Get general widgets for global bootloader options
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 351 352 353 354 355 |
# File 'src/include/bootloader/routines/global_widgets.rb', line 305 def CommonGlobalWidgets return deep_copy(@_common_global_widgets) if @_common_global_widgets @_common_global_widgets = { "adv_button" => getAdvancedButtonWidget, "loader_type" => { "widget" => :func, "widget_func" => fun_ref( method(:LoaderTypeComboWidget), "term ()" ), "init" => fun_ref( method(:LoaderTypeComboInit), "void (string)" ), "handle" => fun_ref( method(:LoaderTypeComboHandle), "symbol (string, map)" ), "help" => LoaderTypeHelp() }, "loader_options" => { "widget" => :push_button, # push button "label" => _("Boot &Loader Options"), "handle_events" => ["loader_options"], "handle" => fun_ref( method(:LoaderOptionsButtonHandle), "symbol (string, map)" ), "help" => LoaderOptionsHelp() }, # FIXME: after deleting all using of metadata delete widget from # from CommonGlobalWidgets the button is only for GRUB... "inst_details" => { "widget" => :push_button, # push button "label" => _( "Boot Loader Installation &Details" ), "handle_events" => ["inst_details"], "handle" => fun_ref( method(:InstDetailsButtonHandle), "symbol (string, map)" ), "help" => InstDetailsHelp() } } deep_copy(@_common_global_widgets) end |
- (Object) getAdvancedButtonWidget
Get map of widget
290 291 292 293 294 295 296 297 298 299 300 301 |
# File 'src/include/bootloader/routines/global_widgets.rb', line 290 def getAdvancedButtonWidget { "widget" => :custom, "custom_widget" => ReplacePoint(Id(:adv_rp), VBox()), "handle" => fun_ref( method(:resetButtonHandle), "symbol (string, map)" ), "init" => fun_ref(method(:resetButtonInit), "void (string)"), "help" => getAdvancedButtonHelp } end |
- (Object) GlobalOptionInit(widget)
Init function of widget
49 50 51 52 53 54 55 56 57 58 |
# File 'src/include/bootloader/routines/global_widgets.rb', line 49 def GlobalOptionInit() return if == "adv_button" UI.ChangeWidget( Id(), :Value, Ops.get(BootCommon.globals, , "") ) nil end |
- (Object) GlobalOptionStore(widget, _event)
Store function of a widget
63 64 65 66 67 68 69 70 71 72 |
# File 'src/include/bootloader/routines/global_widgets.rb', line 63 def GlobalOptionStore(, _event) return if == "adv_button" Ops.set( BootCommon.globals, , Convert.to_string(UI.QueryWidget(Id(), :Value)) ) nil end |
- (Object) initialize_bootloader_routines_global_widgets(include_target)
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'src/include/bootloader/routines/global_widgets.rb', line 19 def (include_target) textdomain "bootloader" Yast.import "CWM" Yast.import "CWMTab" Yast.import "CWMTable" Yast.import "Label" Yast.import "Mode" Yast.import "Storage" Yast.import "StorageDevices" Yast.import "Bootloader" Yast.import "Progress" Yast.import "PackageSystem" Yast.import "Package" Yast.import "Message" Yast.include include_target, "bootloader/routines/helps.rb" # Map of default (fallback) handlers for widget events on global widgets @global_handlers = { "init" => fun_ref(method(:GlobalOptionInit), "void (string)"), "store" => fun_ref(method(:GlobalOptionStore), "void (string, map)") } # Cache for CommonGlobalWidgets function @_common_global_widgets = nil end |
- (Symbol) InstDetailsButtonHandle(_widget, _event)
Handle function of a widget
78 79 80 81 82 83 84 85 |
# File 'src/include/bootloader/routines/global_widgets.rb', line 78 def InstDetailsButtonHandle(, _event) lt = Bootloader.getLoaderType if lt == "none" || lt == "default" NoLoaderAvailable() return nil end :inst_details end |
- (Symbol) LoaderOptionsButtonHandle(_widget, _event)
Handle function of a widget
91 92 93 94 95 96 97 98 |
# File 'src/include/bootloader/routines/global_widgets.rb', line 91 def LoaderOptionsButtonHandle(, _event) lt = Bootloader.getLoaderType if lt == "none" || lt == "default" NoLoaderAvailable() return nil end :loader_details end |
- (Symbol) LoaderTypeComboHandle(key, event)
Handle function of a widget
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 160 161 162 |
# File 'src/include/bootloader/routines/global_widgets.rb', line 128 def LoaderTypeComboHandle(key, event) event = deep_copy(event) return if event["ID"] != key # FIXME: can it happen at all? old_bl = Bootloader.getLoaderType new_bl = UI.QueryWidget(Id(key), :Value).to_s return nil if old_bl == new_bl if new_bl == "none" # popup - Continue/Cancel popup_msg = _( "\n" \ "If you do not install any boot loader, the system\n" \ "might not start.\n" \ "\n" \ "Proceed?\n" ) if Popup.ContinueCancel(popup_msg) BootCommon.setLoaderType("none") BootCommon.location_changed = true end return :redraw end if ["grub2", "grub2-efi"].include?(new_bl) BootCommon.setLoaderType(new_bl) Bootloader.Propose BootCommon.location_changed = true BootCommon.changed = true return :redraw end raise "Unexpected value of loader type '#{new_bl}'" end |
- (Object) LoaderTypeComboInit(widget)
Init function of widget
118 119 120 121 122 |
# File 'src/include/bootloader/routines/global_widgets.rb', line 118 def LoaderTypeComboInit() UI.ChangeWidget(Id(), :Value, Bootloader.getLoaderType) nil end |
- (Yast::Term) LoaderTypeComboWidget
Get the widget for boot laoder selection combo
104 105 106 107 108 109 110 111 112 113 114 |
# File 'src/include/bootloader/routines/global_widgets.rb', line 104 def LoaderTypeComboWidget ComboBox( Id("loader_type"), Opt(:notify), # combo box _("&Boot Loader"), Builtins.maplist(BootCommon.getBootloaders) do |l| Item(Id(l), BootCommon.getLoaderName(l, :combo)) end ) end |
- (Symbol) resetButtonHandle(_widget, event)
Handle function of a widget
243 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 |
# File 'src/include/bootloader/routines/global_widgets.rb', line 243 def resetButtonHandle(, event) event = deep_copy(event) op = Ops.get(event, "ID") return :manual if op == :manual if op == :restore_mbr doit = restoreMBRPopup(BootCommon.mbrDisk) Builtins.y2milestone("Rewrite MBR with saved one: %1", doit) if doit ret = BootCommon.restoreMBR(BootCommon.mbrDisk) if ret # message popup Popup.Message(_("MBR restored successfully.")) else # message popup Popup.Message(_("Failed to restore MBR.")) end end return nil end if !(Ops.is_symbol?(op) && Builtins.contains( [:scratch, :reread, :propose_deep, :propose], Convert.to_symbol(op) )) return nil end Bootloader.Reset if op == :scratch Builtins.y2debug("Not reading anything for starting from scratch") elsif op == :reread Bootloader.Read elsif op == :init # Bootloader::blSave (false, false, false); ret = BootCommon.InitializeBootloader ret = false if ret.nil? Popup.Warning(_("Writing bootloader settings failed.")) if !ret elsif op == :propose Bootloader.Propose end :redraw end |
- (Object) resetButtonInit(_widget)
Init function of widget
168 169 170 171 172 173 174 175 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 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
# File 'src/include/bootloader/routines/global_widgets.rb', line 168 def resetButtonInit() items = [] items = Builtins.add( items, Item( Id(:manual), # menu button entry _("E&dit Configuration Files") ) ) if BootCommon.getBooleanAttrib("propose") items = Builtins.add( items, # menubutton item, keep as short as possible Item(Id(:propose), _("&Propose New Configuration")) ) end if BootCommon.getBooleanAttrib("scratch") items = Builtins.add( items, # menubutton item, keep as short as possible Item(Id(:scratch), _("&Start from Scratch")) ) end if (Mode.normal || Mode.config || Mode.repair) && BootCommon.getBooleanAttrib("read") items = Builtins.add( items, # menubutton item, keep as short as possible Item(Id(:reread), _("&Reread Configuration from Disk")) ) end additional_entries = Convert.to_list( BootCommon.getAnyTypeAttrib("additional_entries", []) ) items = Builtins.merge(items, additional_entries) if (Mode.normal || Mode.repair) && BootCommon.getBooleanAttrib("restore_mbr") && Ops.greater_than( SCR.Read(path(".target.size"), "/boot/backup_mbr"), 0 ) items = Builtins.add( items, # menubutton item, keep as short as possible Item(Id(:restore_mbr), _("Restore MBR of Hard Disk")) ) end if Mode.normal || Mode.repair items = Builtins.add( items, # menubutton item, keep as short as possible Item(Id(:init), _("Write bootloader boot code to disk")) ) end if Ops.greater_than(Builtins.size(items), 0) UI.ReplaceWidget( Id(:adv_rp), # menu button MenuButton(Id(:reset), _("Other"), items) ) else UI.ReplaceWidget(Id(:adv_rp), VSpacing(0)) end nil end |