Re: Documentation on g_object_class_install_property()



If you want to add your own properties, you should use the template class Glib::Property<>, e.g. Glib::Property<bool>. (I assume you want a boolean property, since you ask about g_param_spec_boolean().)

For example programs that use Glib::Property, see
https://git.gnome.org/browse/gtkmm-documentation/tree/examples/others/cellrenderercustom/cellrenderertoggle.cc
https://git.gnome.org/browse/glibmm/tree/tests/glibmm_interface_implementation/main.cc

Glib::Property has some restrictions (see its documenation). Hopefully they will be somewhat relaxed in the future. See bug https://bugzilla.gnome.org/show_bug.cgi?id=731484

I don't know if there is a way to connect a property and a setting in such a way that a change in one is automatically transferred to the other. If it can't be done automatically, you can connect callback routines which are called when something is changed.

myproperty.get_proxy()->signal_changed().connect(......);
mysetting->signal_changed().connect(........);

Do you really need a property that stores the same value as a Gio::Settings? Why not use only the setting? (You don't have to reply here.)

Kjell

Den 2014-07-23 00:05, Christoph Brill skrev:
Hi Juan,

I'm currently porting meld from pygtk to gtkmm, basically to learn C++11 and gtkmm (see https://github.com/egore/meld). Properties are a very essential part of pygtk (or at least in the way meld uses them) and for now I try not to diverge to much from what is done in the original code.

I'm currently at the point where filediff.py (the view showing two or three files next to each other) uses a property to enable source code highlighting (https://git.gnome.org/browse/meld/tree/meld/filediff.py#n149). This is bound to a gsetting (https://git.gnome.org/browse/meld/tree/meld/settings.py#n114). If I understand everything correct this causes changes to the settings to update the property (and the other way around).

Best wishes,
 Christoph


2014-07-22 22:30 GMT+02:00 Juan Rafael García Blanco <juanrgar gmail com>:

Hi,

May I ask you why do you need these? I think (Kjell could tell you better) there is a more friendly way of defining gobject properties in your gtkmm classes.

Regards,
Juan.

On Jul 22, 2014 9:17 PM, "Christoph Brill" <egore911 gmail com> wrote:
Hi list,

does anyone know about some documentation regarding how to use the gtkmm equivalents of g_object_class_install_property() and g_param_spec_boolean()? My Google-foo didn't come up with any useful result.

Thanks in advance,
 Christoph

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list




_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]