mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 18:56:29 +00:00
menu_view: optional 'version' widget attribute
The new 'version' attribute can be used to explicitly distinguish widgets that have the same name. E.g., if one widget is removed and another with the same name is created somewhere else at the same time, the menu view would normally interpret this change as a movement. By attaching a distinct 'version' the new instance, menu view won't attempt perform a smooth transition between the old and new widgets.
This commit is contained in:
parent
7d55adf01c
commit
05b0010281
@ -52,7 +52,8 @@ class Menu_view::Widget : public List_model<Widget>::Element
|
|||||||
enum { NAME_MAX_LEN = 32 };
|
enum { NAME_MAX_LEN = 32 };
|
||||||
typedef String<NAME_MAX_LEN> Name;
|
typedef String<NAME_MAX_LEN> Name;
|
||||||
|
|
||||||
typedef Name Type_name;
|
typedef Name Type_name;
|
||||||
|
typedef String<10> Version;
|
||||||
|
|
||||||
struct Unique_id
|
struct Unique_id
|
||||||
{
|
{
|
||||||
@ -92,6 +93,7 @@ class Menu_view::Widget : public List_model<Widget>::Element
|
|||||||
|
|
||||||
Type_name const _type_name;
|
Type_name const _type_name;
|
||||||
Name const _name;
|
Name const _name;
|
||||||
|
Version const _version;
|
||||||
|
|
||||||
Unique_id const _unique_id;
|
Unique_id const _unique_id;
|
||||||
|
|
||||||
@ -122,7 +124,8 @@ class Menu_view::Widget : public List_model<Widget>::Element
|
|||||||
static bool element_matches_xml_node(Widget const &w, Xml_node node)
|
static bool element_matches_xml_node(Widget const &w, Xml_node node)
|
||||||
{
|
{
|
||||||
return node.has_type(w._type_name.string())
|
return node.has_type(w._type_name.string())
|
||||||
&& Widget::node_name(node) == w._name;
|
&& Widget::node_name(node) == w._name
|
||||||
|
&& node.attribute_value("version", Version()) == w._version;
|
||||||
}
|
}
|
||||||
|
|
||||||
} _model_update_policy { _factory };
|
} _model_update_policy { _factory };
|
||||||
|
Loading…
Reference in New Issue
Block a user