[Glade-users] Userdefined Widgets in catalog file



On Wed, Apr 26, 2017 at 5:51 PM, Elmar Haneke <elmar at haneke.de> wrote:

since you specified parent="GtkEventBox", glade will use that as the
base of DlgUtils_DatumEingabe but you need to specify the param spec of
each property you want to edit in glade (see https://developer.gnome.or
g/gladeui/3.20/properties.html)

That is what I did try. I cannot see an discrepance between my catalog
file and that description.

Not exactly... but the documentation does not make it that clear. Also
it looks like the documentation has fallen behind a bit, as it lacks
documentation for the newer 'parameter-spec' which replaces the old
'spec'.


I recommend trying to load your library
<glade-catalog name="foo" library="foo" depends="gtk+">

The Widget is implemented as an GTK#-Object, I did not find an solution
to put this into an library for Glade.

Right, in this case loading the library wont work, I think we only
have support for automatically loading python widgets and nothing else
non-C.

So, to explain a bit better, in order to augment a widget's properties
with completely made up properties, it's mostly important to just
specify the type of property it is, take for example the "size"
property of the GtkBox (which does not get saved to the Glade file,
but that does not have to be the case).

See: https://git.gnome.org/browse/glade/tree/plugins/gtk+/gtk+.xml.in#n655

Using the <parameter-spec> you should be able to use any existing
GParamSpec, especially for the glib fundamental types this is pretty
straight forward.

For object type properties, one needs to specify the "value-type" of
the param spec, for numeric types, one can optionally specify min/max
boundaries for those.

I dont think we ever documented this part well so, just in case you
can't figure out what you need from the above link to the GTK+
catalog, here is the code where we parse the "parameter-spec"
definitions for manually added properties in the XML file:
https://git.gnome.org/browse/glade/tree/gladeui/glade-property-class.c#n1705

Cheers,
    -Tristan




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