31
31
class Introspectable
33
typedef std::list<Introspectable*> IntrospectableList;
34
typedef std::list<Introspectable*> IntrospectableList;
37
37
virtual ~Introspectable();
38
38
GVariant* Introspect();
39
39
virtual std::string GetName() const = 0;
40
40
void AddChild(Introspectable* child);
41
41
void RemoveChild(Introspectable* child);
42
IntrospectableList const& GetIntrospectableChildren() { return _children; };
43
42
virtual void AddProperties(GVariantBuilder* builder) = 0;
43
virtual IntrospectableList const& GetIntrospectableChildren();
44
guint64 GetIntrospectionId() const;
47
/// Please don't override this unless you really need to. The only valid reason
48
/// is if you have a property that simply *must* be called 'Children'.
46
49
virtual std::string GetChildsName() const;
50
52
* AddProperties should be implemented as such ...
51
53
* void ClassFoo::AddProperties (GVariantBuilder *builder)
53
* g_variant_builder_add (builder, "{sv}", "label", g_variant_new_string ("_File") );
54
* g_variant_builder_add (builder, "{sv}", "image", g_variant_new_string ("") );
55
* g_variant_builder_add (builder, "{sv}", "visible", g_variant_new_boolean (TRUE) );
56
* g_variant_builder_add (builder, "{sv}", "sensitive", g_variant_new_boolean (TRUE) );
57
* g_variant_builder_add (builder, "{sv}", "active", g_variant_new_boolean (FALSE) );
58
* g_variant_builder_add (builder, "{sv}", "label", g_variant_new_int32 (34) );
59
* g_variant_builder_add (builder, "{sv}", "label", g_variant_new_int32 (24) );
55
* unity::variant::BuilderWrapper wrapper(builder);
56
* wrapper.add("label", some_value);
61
58
* That's all. Just add a bunch of key-value properties to the builder.