Blame doc/html/catalogintro.html

Packit 1e8aac
Packit 1e8aac
<html>
Packit 1e8aac
<head>
Packit 1e8aac
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Packit 1e8aac
<title>Introducing the Glade Catalog: Glade User Interface Designer Reference Manual</title>
Packit 1e8aac
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
Packit 1e8aac
<link rel="home" href="index.html" title="Glade User Interface Designer Reference Manual">
Packit 1e8aac
<link rel="up" href="catalog.html" title="Part I. Adding your custom widgets">
Packit 1e8aac
<link rel="prev" href="catalog.html" title="Part I. Adding your custom widgets">
Packit 1e8aac
<link rel="next" href="widgetclasses.html" title="Widget Adaptor Definitions">
Packit 1e8aac
<meta name="generator" content="GTK-Doc V1.28 (XML mode)">
Packit 1e8aac
<link rel="stylesheet" href="style.css" type="text/css">
Packit 1e8aac
</head>
Packit 1e8aac
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
Packit 1e8aac
Packit 1e8aac
Packit 1e8aac
Home
Packit 1e8aac
Up
Packit 1e8aac
Prev
Packit 1e8aac
Next
Packit 1e8aac
Packit 1e8aac
Packit 1e8aac
Packit 1e8aac
Packit 1e8aac
Packit 1e8aac

Introducing the Glade Catalog

Packit 1e8aac

Writing catalogs —

Packit 1e8aac
How to write and install a catalog
Packit 1e8aac
    

Packit 1e8aac
Packit 1e8aac
Packit 1e8aac
Packit 1e8aac
Packit 1e8aac

Introduction

Packit 1e8aac

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
    

Packit 1e8aac

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
    

Packit 1e8aac

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
      

Packit 1e8aac
Packit 1e8aac
<?xml version="1.0" encoding="UTF-8"?>
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>
Packit 1e8aac

Packit 1e8aac
    

Packit 1e8aac
Packit 1e8aac
Packit 1e8aac

Toplevel catalog properties and tags

Packit 1e8aac

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
    

Packit 1e8aac
Packit 1e8aac
Packit 1e8aac
Packit 1e8aac
Packit 1e8aac
Packit 1e8aac
Packit 1e8aac
Packit 1e8aac

name

Packit 1e8aac

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
          

Packit 1e8aac
Packit 1e8aac
Packit 1e8aac

version

Packit 1e8aac

Packit 1e8aac
A 'major.minor' formed version describing the current version of underlying widget kit;
Packit 1e8aac
example: version="1.0". This is needed for version checking to work. 
Packit 1e8aac
Please note that all versioning related support is completely optional.
Packit 1e8aac
          

Packit 1e8aac
Packit 1e8aac
Packit 1e8aac

targetable

Packit 1e8aac

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: targetable="0.6,0.8".
Packit 1e8aac
          

Packit 1e8aac
Packit 1e8aac
Packit 1e8aac

icon-prefix

Packit 1e8aac

Packit 1e8aac
Used to form icon names for widgets. This property defaults to the value of the 'name' attribute.
Packit 1e8aac
          

Packit 1e8aac
Packit 1e8aac
Packit 1e8aac

library

Packit 1e8aac

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
$prefix/lib/glade-3/modules/, or from the default system library 
Packit 1e8aac
paths in the afore mentioned order of precedence.
Packit 1e8aac
          

Packit 1e8aac
Packit 1e8aac
Packit 1e8aac

depends

Packit 1e8aac

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
          

Packit 1e8aac
Packit 1e8aac
Packit 1e8aac

domain

Packit 1e8aac

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
          

Packit 1e8aac
Packit 1e8aac
Packit 1e8aac

book

Packit 1e8aac

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
          

Packit 1e8aac
Packit 1e8aac
Packit 1e8aac

init-function

Packit 1e8aac

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
          

Packit 1e8aac
Packit 1e8aac
Packit 1e8aac
Packit 1e8aac
Packit 1e8aac
Packit 1e8aac

Validating and installing

Packit 1e8aac

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
    

Packit 1e8aac

Packit 1e8aac
To validate a file, do this:
Packit 1e8aac
      

Packit 1e8aac
xmllint --dtdvalid glade-catalog.dtd --noout my-catalog.xml
Packit 1e8aac

Packit 1e8aac
    

Packit 1e8aac

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
      

Packit 1e8aac
pkg-config --variable=catalogdir gladeui-1.0
Packit 1e8aac

Packit 1e8aac
The plugin library should be installed into the modules directory:
Packit 1e8aac
      

Packit 1e8aac
pkg-config --variable=moduledir gladeui-1.0
Packit 1e8aac

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
    

Packit 1e8aac

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
      

Packit 1e8aac
GLADE_CATALOG_SEARCH_PATH=~/mycatalogs:~/work/foo/glade
Packit 1e8aac

Packit 1e8aac
    

Packit 1e8aac

Packit 1e8aac
Same goes for optional plugin libraries, for instance:
Packit 1e8aac
      

Packit 1e8aac
GLADE_MODULE_SEARCH_PATH=~/work/foo/src
Packit 1e8aac

Packit 1e8aac
    

Packit 1e8aac

Packit 1e8aac
Currently loading icons without installing them is unsupported.
Packit 1e8aac
    

Packit 1e8aac
Packit 1e8aac
Packit 1e8aac
Packit 1e8aac

Generated by GTK-Doc V1.28
Packit 1e8aac
</body>
Packit 1e8aac
</html>