Skip to content

Commit

Permalink
Added support for "Hidden" desktop files
Browse files Browse the repository at this point in the history
- These files must not be shown in UI
  • Loading branch information
kobliha committed Jul 21, 2014
1 parent 715af0a commit 00cbe0d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/include/autoinstall/conftree.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ def modules(group_name, selectedModule)
Builtins.y2milestone("group_name: %1", group_name)
itemList = []
Builtins.foreach(Y2ModuleConfig.ModuleMap) do |k, v|
# bnc #887115 comment #9: Desktop file is "hidden" and should not be shown at all
next if v["Hidden"] == "true"

if Ops.get_string(v, "X-SuSE-YaST-Group", "") == group_name
desktop_file = Builtins.substring(
Ops.get_string(v, "X-SuSE-DocTeamID", ""),
Expand Down Expand Up @@ -216,7 +219,7 @@ def layout(preselectedGroup, preselectedModule)

# Set the group selection box to the specified YaST group.
#
# @praram group_name YaST group to select.
# @param group_name YaST group to select.
def setGroup(group_name)
UI.ChangeWidget(Id(:groups), :CurrentItem, group_name)
updateModules
Expand All @@ -238,6 +241,8 @@ def getModule
Convert.to_string(UI.QueryWidget(Id(:modules), :CurrentItem))
end

ALWAYS_CLONABLE_MODULES = ["software", "partitioning", "bootloader"]

# Updates the action button activation status. (Some modules are not
# clonable, some are not writeable).
#
Expand All @@ -247,18 +252,13 @@ def updateButtons(selectedModule)
if Builtins.contains(AutoinstConfig.noWriteNow, selectedModule)
UI.ChangeWidget(Id(:writeNow), :Enabled, false)
end
# enable disable read button
resourceMap = Ops.get(Y2ModuleConfig.ModuleMap, selectedModule, {})
clonable = Ops.get_string(
resourceMap,
"X-SuSE-YaST-AutoInstClonable",
"false"
) == "true"
if !clonable && "software" != selectedModule &&
"partitioning" != selectedModule &&
"bootloader" != selectedModule
UI.ChangeWidget(Id(:read), :Enabled, false)
end

# set read button status
resourceMap = Y2ModuleConfig.ModuleMap.fetch(selectedModule, {})
clonable = resourceMap.fetch("X-SuSE-YaST-AutoInstClonable", "false") == "true"

clone_button_status = clonable || ALWAYS_CLONABLE_MODULES.include?(selectedModule)
UI.ChangeWidget(Id(:read), :Enabled, clone_button_status)

nil
end
Expand Down
1 change: 1 addition & 0 deletions src/modules/Y2ModuleConfig.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def ReadMenuEntries(modes)
"Name",
"GenericName",
"Icon",
"Hidden",
"X-SuSE-YaST-AutoInst",
"X-SuSE-YaST-AutoInstResource",
"X-SuSE-YaST-AutoInstClient",
Expand Down

0 comments on commit 00cbe0d

Please sign in to comment.