diff options
Diffstat (limited to 'gtk2_ardour/gui_object.h')
-rw-r--r-- | gtk2_ardour/gui_object.h | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/gtk2_ardour/gui_object.h b/gtk2_ardour/gui_object.h index 3cbd85c171..694a5e9212 100644 --- a/gtk2_ardour/gui_object.h +++ b/gtk2_ardour/gui_object.h @@ -46,23 +46,20 @@ public: std::string get_string (const std::string& id, const std::string& prop_name, bool* empty = 0); template<typename T> void set (const std::string& id, const std::string& prop_name, const T& val) { - XMLNode* child = find_node (id); - if (!child) { - child = new XMLNode (X_("Object")); - child->add_property (X_("id"), id); - _state.add_child_nocopy (*child); - } - + XMLNode* child = get_or_add_node (id); std::stringstream s; s << val; child->add_property (prop_name.c_str(), s.str()); } std::list<std::string> all_ids () const; + + static XMLNode* get_node (const XMLNode *, const std::string &); + XMLNode* get_or_add_node (const std::string &); + static XMLNode* get_or_add_node (XMLNode *, const std::string &); private: - XMLNode* find_node (const std::string &) const; - + XMLNode _state; }; |