1
Glade3 internals
2
~~~~~~~~~~~~~~~~
3
4
5
about this document
6
===================
7
8
This is a short description of the designs goals and of the
9
implementation choices of Glade3. It isn't complete, but
10
I hope that it may be useful.
11
12
 * Note: not only I'm not the original author/designer of 
13
   glade3, but also I have not touched glade3 for many months.
14
15
The only reason why I'm writing this doc is that glade3 development
16
has been stagnating for a long time... now it seems that there are some
17
developers interested in resuming work on it, so I thought that it was 
18
right to put down some notes on what I remember to ease their way
19
through the glade3 codebase.
20
21
Everyone who spots errors and inaccuracies in this doc, or who wants to
22
add informations to it, should feel free to improve it!
23
24
25
26
1) Introduction
27
===============
28
29
As you probably know the idea behind glade and libglade is to serialize
30
the description of a Gtk+ GUI to an xml file.
31
32
 * libglade takes care of reading such file at runtime and generates
33
   the interface
34
35
 * glade is a tool to create and edit the desired interface in an easy
36
   way and then automatically serialize it to the xml file.
37
38
Glade3 is a complete rewrite of the original glade and takes advantage
39
of the introspection properties of the GTK+2 toolkit.
40
41
42
43
2) Design goals
44
===============
45
46
Here are some of the goals which were considered when designing glade3
47
48
 * allow to easily "plug-in" new sets ("catalogs") of GtkWidgets. For
49
   instance the collections of GNOME widgets, which was hardcoded in
50
   glade2, should be provided as an external addition.
51
   In theory all what is required to add support for an extra collection
52
   of widgets is some xml describing the widgets and, if needed, a shared
53
   object which overrides some of the properties of the widgets which
54
   cannot be correctly handled with introspection. [Note: as of this
55
   writing this system is not fully functional and the only catalog
56
   available is the normal GTK+ widget collection]
57
58
 * implement full UNDO/REDO for the actions supported by glade
59
60
 * implement the glade tools (palette, editor, etc) as widget themselves
61
   so that it would be possible without too much work to embed them in 
62
   another program (e.g. an IDE).
63
64
 * get rid of code generation. Code generation is considered a bad idea,
65
   the way to go is to use libglade to dinamically load the GUI from the
66
   xml file. If someone really wants to have code generation, it really
67
   belongs in an external program which generates code from the xml file.
68
69
 * FIXME: ADD OTHERS
70
71
72
73
3) File Map
74
===========
75
76
Here is a (not complete) list of the source files of glade3, with a brief
77
explanation of what they do.
78
79
src subdir:
80
81
 * main.c - self explanatory, it parses options, loads the available
82
            catalogs and creates the main window
83
84
 * glade-project-window.[ch] - the main window of glade, with menus,
85
                               toolbar, etc.
86
                               The GladeProjectWindow struct also
87
                               contains the general state of the program
88
                               (e.g. the list of open projects).
89
                               There is just one instance of this
90
                               structure.
91
92
 * glade-palette.[ch]
93
   glade-editor.[ch]
94
   glade-signal-editor.[ch]
95
   glade-clipboard.[ch]
96
   glade-clipboard-view.[ch]
97
   glade-project-view.[ch] - the editing tools offered by glade
98
99
 * glade-commands.[ch] - editing actions available in glade.
100
                         Implements UNDO/REDO.
101
102
 * glade-projects.[ch] - object correspong to each project currently open
103
                         in glade, for instance it contains the list of
104
                         toplevels widgets and if the project has been
105
                         modified.
106
107
 * glade-widget.[ch] - probably the most important file: each GtkWidget
108
                       in the project has an associated GladeWidget
109
                       which contains the name, the properties, the name,
110
                       the signals etc.
111
 
112
 * glade-catalog.[ch] - a collection of widget classes
113
114
 * glade-widget-class.[ch] - a structure describing each type of widget
115
                             in a catalog.
116
117
 * FIXME: add the other files
118
119
 * glade-gtk.c: this implements the shared object that contains
120
                overridden properties for gtk widget catalog.
121
122
123
widgets subdir
124
125
 * *.xml: each widget in a catalog has a corresponding xml description.
126
          At some point it may be worth collapse them in just one file
127
          per catalog, at the moment they are split in a file per widget
128
          because at the beginning glade3 required all the properties
129
          to be described in xml, but now only the properties which
130
          need special handling are listed