2005-10-16 [wwp] 1.9.15cvs51
[claws.git] / doc / src / glade.txt
1 Using glade to create interfaces for Sylpheed
2 ---------------------------------------------
3
4 Sylpheed is not a glade project and so it cannot use the directory and
5 file structure that is created by glade directly. Glade is only used to
6 design the user interface and write most of the GTK code.
7
8 To create a part of the Sylpheed user interface ,create a new window in
9 glade and put all the widgets that you need into it. Glade always wants
10 to have its glade file in the project directory where it creates the
11 files, so its better to do this in a temporary directory. After saving
12 the C source copy the GTK code from the create_<WINDOWNAME>() function to
13 your own code in Sylpheed. Remove the code that is actually creating the
14 window and the function call that adds the top widget to the window. Also
15 remove all calls to gtk_widget_ref() and gtk_object_set_data_full(). To
16 make it to replace the glade part it is probably better to leave the rest
17 untouched. If you put the copied part at the beginning of your function
18 you can keep the function calls and the variable declarations in one part.
19 As it is done in other parts of Sylpheed, you can define a struct for
20 your window that uses the widgets created by glade and remembers all of
21 the widgets that you need using pointers in the struct. You can simply
22 assign the widget pointers to your struct members after the glade block.
23
24 To make glade's code match Sylpheed's coding style you can use the indent
25 command with the -kr and -i8 parameters on the interface.c file before
26 you copy the code.
27
28 To make it easy to find which glade file contains the widget description
29 for the code contained in a C file its probably good to copy the glade
30 file from the temporary directory to a file with the same name as the
31 C file with a ".glade" suffix instead of ".c". If you want to change an
32 existing user interface you can either copy the glade file to a temporary
33 directory or open it directly and change the project directory in glade
34 to a temporary directory, because, otherwise, glade will write all its
35 project stuff into the Sylpheed source directory. Don't forget to copy
36 the modified file back after you saved your user interface in glade.
37
38 If you want to use different composite widgets in one C file you should
39 use multiple windows in glade to create them and then copy them one by
40 one to your own code.