|
Packit |
1e8aac |
<refentry id="catalogintro" revision="8 Feb 2006">
|
|
Packit |
1e8aac |
<refmeta>
|
|
Packit |
1e8aac |
<refentrytitle>Introducing the Glade Catalog</refentrytitle>
|
|
Packit |
1e8aac |
<refmiscinfo>Glade UI</refmiscinfo>
|
|
Packit |
1e8aac |
</refmeta>
|
|
Packit |
1e8aac |
<refnamediv>
|
|
Packit |
1e8aac |
<refname>Writing catalogs</refname>
|
|
Packit |
1e8aac |
<refpurpose>
|
|
Packit |
1e8aac |
How to write and install a catalog
|
|
Packit |
1e8aac |
</refpurpose>
|
|
Packit |
1e8aac |
</refnamediv>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
<refsect1>
|
|
Packit |
1e8aac |
<title>Introduction</title>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
<para>
|
|
Packit |
1e8aac |
You can provide support for your custom widgets in a few ways, you can
|
|
Packit |
1e8aac |
make a package and install it to the system directories, load additional
|
|
Packit |
1e8aac |
catalogs in user directories, project directories for example, and
|
|
Packit |
1e8aac |
you can optionally provide code support and/or icons, normally you need
|
|
Packit |
1e8aac |
to at least have the object type in a library somewhere, but you can work
|
|
Packit |
1e8aac |
around this using the 'parent' property described in the next section.
|
|
Packit |
1e8aac |
If you dont provide icons for the inspector and palette Glade will simply
|
|
Packit |
1e8aac |
print a warning and use a default icon. The catalog file is written in an
|
|
Packit |
1e8aac |
XML format and a DTD for the format can be found in the plugins/ directory
|
|
Packit |
1e8aac |
of the Glade tarball.
|
|
Packit |
1e8aac |
</para>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
<para>
|
|
Packit |
1e8aac |
In most cases gtk+ derived widgets can be added with little effort and it
|
|
Packit |
1e8aac |
is enough to simply specify the widget's type; glade will introspect
|
|
Packit |
1e8aac |
its properties and signals - but due to the organic nature of a widget
|
|
Packit |
1e8aac |
toolkit there are always exceptions. In this document we'll try to provide
|
|
Packit |
1e8aac |
some basic examples and describe a wealth of options that can be used to
|
|
Packit |
1e8aac |
enhance UI editing and workaround exceptions.
|
|
Packit |
1e8aac |
</para>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
<para>
|
|
Packit |
1e8aac |
The catalog file starts by specifying the name of the catalog and the plugin
|
|
Packit |
1e8aac |
library to use, the following examples assume you have a namespace "Foo" and
|
|
Packit |
1e8aac |
are integrating an object "Frobnicator":
|
|
Packit |
1e8aac |
<programlisting>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
<glade-catalog name="foo" library="foo" depends="gtk+">
|
|
Packit |
1e8aac |
<init-function>my_catalog_init</init-function>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
<glade-widget-classes>
|
|
Packit |
1e8aac |
<glade-widget-class name="FooFrobnicator" generic-name="frobnicator" title="Frobnicator"/>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
... widget classes go here
|
|
Packit |
1e8aac |
</glade-widget-classes>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
<glade-widget-group name="foo" title="Foo">
|
|
Packit |
1e8aac |
<glade-widget-class-ref name="FooFrobnicator"/>
|
|
Packit |
1e8aac |
... widget class references go here
|
|
Packit |
1e8aac |
</glade-widget-group>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
... widget groups go here
|
|
Packit |
1e8aac |
</glade-catalog>]]></programlisting>
|
|
Packit |
1e8aac |
</para>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
</refsect1>
|
|
Packit |
1e8aac |
<refsect1>
|
|
Packit |
1e8aac |
<title>Toplevel catalog properties and tags</title>
|
|
Packit |
1e8aac |
<para>
|
|
Packit |
1e8aac |
When defining the catalog, the 'name' and 'library'
|
|
Packit |
1e8aac |
are both manditory attributes of the 'glade-catalog' tag; optionally
|
|
Packit |
1e8aac |
you can also use 'icon-prefix', 'depends' and 'domain'.
|
|
Packit |
1e8aac |
</para>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
<variablelist>
|
|
Packit |
1e8aac |
<varlistentry>
|
|
Packit |
1e8aac |
<term>name</term>
|
|
Packit |
1e8aac |
<listitem>
|
|
Packit |
1e8aac |
<para>
|
|
Packit |
1e8aac |
A string identifier for the catalog in question, it will be used to identify your
|
|
Packit |
1e8aac |
catalog so that the glade file can explicitly require it and to manage inter
|
|
Packit |
1e8aac |
catalog dependencies.
|
|
Packit |
1e8aac |
</para>
|
|
Packit |
1e8aac |
</listitem>
|
|
Packit |
1e8aac |
</varlistentry>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
<varlistentry>
|
|
Packit |
1e8aac |
<term>version</term>
|
|
Packit |
1e8aac |
<listitem>
|
|
Packit |
1e8aac |
<para>
|
|
Packit |
1e8aac |
A 'major.minor' formed version describing the current version of underlying widget kit;
|
|
Packit |
1e8aac |
example: <literal>version="1.0"</literal>. This is needed for version checking to work.
|
|
Packit |
1e8aac |
Please note that all versioning related support is completely optional.
|
|
Packit |
1e8aac |
</para>
|
|
Packit |
1e8aac |
</listitem>
|
|
Packit |
1e8aac |
</varlistentry>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
<varlistentry>
|
|
Packit |
1e8aac |
<term>targetable</term>
|
|
Packit |
1e8aac |
<listitem>
|
|
Packit |
1e8aac |
<para>
|
|
Packit |
1e8aac |
A comma separated list of 'major.minor' formed versions describing sensable previous
|
|
Packit |
1e8aac |
targetable versions of the underlying toolkit not including the current version;
|
|
Packit |
1e8aac |
example: <literal>targetable="0.6,0.8"</literal>.
|
|
Packit |
1e8aac |
</para>
|
|
Packit |
1e8aac |
</listitem>
|
|
Packit |
1e8aac |
</varlistentry>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
<varlistentry>
|
|
Packit |
1e8aac |
<term>icon-prefix</term>
|
|
Packit |
1e8aac |
<listitem>
|
|
Packit |
1e8aac |
<para>
|
|
Packit |
1e8aac |
Used to form icon names for widgets. This property defaults to the value of the 'name' attribute.
|
|
Packit |
1e8aac |
</para>
|
|
Packit |
1e8aac |
</listitem>
|
|
Packit |
1e8aac |
</varlistentry>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
<varlistentry>
|
|
Packit |
1e8aac |
<term>library</term>
|
|
Packit |
1e8aac |
<listitem>
|
|
Packit |
1e8aac |
<para>
|
|
Packit |
1e8aac |
Used to load the types and introspect properties, unless you are faking your widget
|
|
Packit |
1e8aac |
classes (which will be described later on), glade will need to load this library,
|
|
Packit |
1e8aac |
it can either be the name of the library containing the widgets or the plugin library
|
|
Packit |
1e8aac |
which is assumed to implicitly link to your widget library. The library will be loaded
|
|
Packit |
1e8aac |
either by a user specified path, the system plugin directory:
|
|
Packit |
1e8aac |
<literal>$prefix/lib/glade-3/modules/</literal>, or from the default system library
|
|
Packit |
1e8aac |
paths in the afore mentioned order of precedence.
|
|
Packit |
1e8aac |
</para>
|
|
Packit |
1e8aac |
</listitem>
|
|
Packit |
1e8aac |
</varlistentry>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
<varlistentry>
|
|
Packit |
1e8aac |
<term>depends</term>
|
|
Packit |
1e8aac |
<listitem>
|
|
Packit |
1e8aac |
<para>
|
|
Packit |
1e8aac |
Used for inheritance of support code to work properly (i.e. if your object derives
|
|
Packit |
1e8aac |
from an object in gtk+, you'll want the default support code in the gladegtk plugin
|
|
Packit |
1e8aac |
to be enabled for your widget too). This property's value is the `name' property of
|
|
Packit |
1e8aac |
another installed glade plugin; usually you'll want to declare: 'depends="gtk+"'
|
|
Packit |
1e8aac |
for your plugin.
|
|
Packit |
1e8aac |
</para>
|
|
Packit |
1e8aac |
</listitem>
|
|
Packit |
1e8aac |
</varlistentry>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
<varlistentry>
|
|
Packit |
1e8aac |
<term>domain</term>
|
|
Packit |
1e8aac |
<listitem>
|
|
Packit |
1e8aac |
<para>
|
|
Packit |
1e8aac |
The domain in which to search for translatable strings from the
|
|
Packit |
1e8aac |
catalog file; please note that all strings from the catalog that will apear in the UI are
|
|
Packit |
1e8aac |
translated using this domain. If the 'domain' is not specified, the library property will
|
|
Packit |
1e8aac |
be used in it's stead.
|
|
Packit |
1e8aac |
</para>
|
|
Packit |
1e8aac |
</listitem>
|
|
Packit |
1e8aac |
</varlistentry>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
<varlistentry>
|
|
Packit |
1e8aac |
<term>book</term>
|
|
Packit |
1e8aac |
<listitem>
|
|
Packit |
1e8aac |
<para>
|
|
Packit |
1e8aac |
Used to specify a namespace to search devhelp docs library with
|
|
Packit |
1e8aac |
(specificly, it is the $(DOC_MODULE) that you specified in your gtk-doc Makefile.am).
|
|
Packit |
1e8aac |
</para>
|
|
Packit |
1e8aac |
</listitem>
|
|
Packit |
1e8aac |
</varlistentry>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
<varlistentry>
|
|
Packit |
1e8aac |
<term>init-function</term>
|
|
Packit |
1e8aac |
<listitem>
|
|
Packit |
1e8aac |
<para>
|
|
Packit |
1e8aac |
Used to retrieve an optional global entry point to your plugin;
|
|
Packit |
1e8aac |
if you need to initialize any backends or whatnot this is a good place.
|
|
Packit |
1e8aac |
Your catalog's init-function will be called before any widget classes are instantiated.
|
|
Packit |
1e8aac |
</para>
|
|
Packit |
1e8aac |
</listitem>
|
|
Packit |
1e8aac |
</varlistentry>
|
|
Packit |
1e8aac |
</variablelist>
|
|
Packit |
1e8aac |
</refsect1>
|
|
Packit |
1e8aac |
<refsect1>
|
|
Packit |
1e8aac |
<title>Validating and installing</title>
|
|
Packit |
1e8aac |
<para>
|
|
Packit |
1e8aac |
The DTD that is shipped with Glade can be used to validate your catalog
|
|
Packit |
1e8aac |
file. Note that properties must be entered in the same order as they are
|
|
Packit |
1e8aac |
specified in the DTD for the validation to pass.
|
|
Packit |
1e8aac |
</para>
|
|
Packit |
1e8aac |
<para>
|
|
Packit |
1e8aac |
To validate a file, do this:
|
|
Packit |
1e8aac |
<programlisting>xmllint --dtdvalid glade-catalog.dtd --noout my-catalog.xml</programlisting>
|
|
Packit |
1e8aac |
</para>
|
|
Packit |
1e8aac |
<para>
|
|
Packit |
1e8aac |
To install a widget plugin, the catalog XML file should be copied into
|
|
Packit |
1e8aac |
the catalog directory, which can be retrieved as:
|
|
Packit |
1e8aac |
<programlisting>pkg-config --variable=catalogdir gladeui-1.0</programlisting>
|
|
Packit |
1e8aac |
The plugin library should be installed into the modules directory:
|
|
Packit |
1e8aac |
<programlisting>pkg-config --variable=moduledir gladeui-1.0</programlisting>
|
|
Packit |
1e8aac |
Widget icons if provided (recommended) need to be installed into the icon theme,
|
|
Packit |
1e8aac |
this is described in the next chapter.
|
|
Packit |
1e8aac |
</para>
|
|
Packit |
1e8aac |
<para>
|
|
Packit |
1e8aac |
You can also load your catalog from a user directory by specifying
|
|
Packit |
1e8aac |
additional load path(s) in the environment, for instance:
|
|
Packit |
1e8aac |
<programlisting>GLADE_CATALOG_SEARCH_PATH=~/mycatalogs:~/work/foo/glade</programlisting>
|
|
Packit |
1e8aac |
</para>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
<para>
|
|
Packit |
1e8aac |
Same goes for optional plugin libraries, for instance:
|
|
Packit |
1e8aac |
<programlisting>GLADE_MODULE_SEARCH_PATH=~/work/foo/src</programlisting>
|
|
Packit |
1e8aac |
</para>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
<para>
|
|
Packit |
1e8aac |
Currently loading icons without installing them is unsupported.
|
|
Packit |
1e8aac |
</para>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
</refsect1>
|
|
Packit |
1e8aac |
</refentry>
|