sculpt: make graph features configurable

This patch makes the component graph better reusable for the phone
version of Sculpt. In the phone version, the '+' menu does not exist.
So we need to omit the corresponding button. Furthermore, the storage
dialog is presented in a dedicate section of the GUI instead of
presenting it inside the 'storage' graph node. The phone version
also does not offer the inspect view. So we need to omit the
corresponding buttons.
This commit is contained in:
Norman Feske 2022-11-10 14:58:25 +01:00 committed by Christian Helmuth
parent 7cb0986c1f
commit bbcca835a5
3 changed files with 49 additions and 8 deletions

View File

@ -0,0 +1,34 @@
/*
* \brief Compile-time feature selection
* \author Norman Feske
* \date 2022-11-10
*/
/*
* Copyright (C) 2022 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _FEATURE_H_
#define _FEATURE_H_
#include <types.h>
namespace Sculpt { struct Feature; };
struct Sculpt::Feature
{
/* show the '+' botton at the graph for opening the deploy popup dialog */
static constexpr bool PRESENT_PLUS_MENU = true;
/* manage storage from within the respective graph nodes */
static constexpr bool STORAGE_DIALOG_HOSTED_IN_GRAPH = true;
/* allow the browsing of file systems via the inspect view */
static constexpr bool INSPECT_VIEW = false;
};
#endif /* _FEATURE_H_ */

View File

@ -12,6 +12,7 @@
*/
#include <graph.h>
#include <feature.h>
#include <view/dialog.h>
using namespace Sculpt;
@ -157,7 +158,7 @@ void Graph::generate(Xml_generator &xml) const
{
xml.node("depgraph", [&] () {
if (_sculpt_partition.valid()) {
if (Feature::PRESENT_PLUS_MENU && _sculpt_partition.valid()) {
gen_named_node(xml, "button", "global+", [&] () {
_add_button_item.gen_button_attr(xml, "global+");
@ -168,7 +169,10 @@ void Graph::generate(Xml_generator &xml) const
xml.attribute("text", "+"); }); });
}
_gen_storage_node(xml);
if (Feature::STORAGE_DIALOG_HOSTED_IN_GRAPH)
_gen_storage_node(xml);
else
_gen_parent_node(xml, "storage", "Storage");
if (_storage_devices.usb_present)
_gen_usb_node(xml);

View File

@ -14,6 +14,7 @@
#ifndef _VIEW__FS_DIALOG_H_
#define _VIEW__FS_DIALOG_H_
#include <feature.h>
#include <view/dialog.h>
#include <model/storage_target.h>
@ -48,14 +49,16 @@ struct Sculpt::Fs_dialog : Noncopyable, Dialog
void generate(Xml_generator &xml, File_system const &file_system) const
{
xml.node("button", [&] () {
_inspect_item.gen_button_attr(xml, "browse");
if (Feature::INSPECT_VIEW) {
xml.node("button", [&] () {
_inspect_item.gen_button_attr(xml, "browse");
if (file_system.inspected)
xml.attribute("selected", "yes");
if (file_system.inspected)
xml.attribute("selected", "yes");
xml.node("label", [&] () { xml.attribute("text", "Inspect"); });
});
xml.node("label", [&] () { xml.attribute("text", "Inspect"); });
});
}
if (!_used_target.valid() || _used_target == _target) {
xml.node("button", [&] () {