Re: Glib::Property and read / write settings

2020-04-10 Thread Daniel Boles via gtkmm-list
I would first make your property member a Glib::Property_ReadOnly so that
errors are caught at compile time by C++. I don't know whether maybe it
ignores the Glib::PARAM flags or overrides them.

Yes, GLib emits ::notify with the property name as the detail, e.g.
notify::my-new-prop. However, I don't think glibmm wraps this, or at least
I can't see how. So you might need to add a bit of C to glue it to your
general handler for property changes.
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Glib::Property and read / write settings

2020-04-10 Thread Mohith Manoj via gtkmm-list
Here is how my code basically looks. The properties are declared as public
members of *CMyClass*. Hence anyone instantiating it could access it.
However the property itself is initialized as a read-only property. I was
expecting *CAnotherClass::SomeFunction()* to fail because it is attempting
to modify a read-only property of another class and *CMyClass::Reset()* to
succeed since the *m_propA* is a member of the same class. However both
functions are executing without throwing any Glib error into the console.

class CMyClass: public Glib::Object
{
public:
CMyClass();
~CMyClass();

Glib::Property m_propA;

void Reset();
private:
void PropertyChanged(const Glib::ustring & sPropertyName);
}

CMyClass::CMyClass():
Glib::ObjectBase(typeid(CMyClass)),
m_propA(*this,
"p0904",
"",
"http://www.skanray.com>*(including
 its group of companies) shall not be 
liable for any omission or error 
in the message, improper or incomplete 
transmission of the information 
contained in this communication or for any 
delay in its receipt or 
damage to your system. * *SKANRAY* 
*(or
 its group of companies) does not guarantee 
that the integrity of this 
communication has been maintained or that this 
communication is free of 
viruses, interceptions or interference.*
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Glib::Property and read / write settings

2020-04-09 Thread Daniel Boles via gtkmm-list
Re others writing your property: (a) how is it declared and (b) how are
they accessing it. Just showing its constructor call is not enough.

Re notification, use .signal_changed(). iirc you might need to make a
PropertyProxy from the property and then call it on that.
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list