|
1: Start a Project:
From the File option on the main menu choose new project. Reply yes to the new project question, and then click on the Project Options menu item, or the Options button. This will bring up a window like that above. Most of the fields are self-explanatory.
The default project name is project#, such as project1/2/3/etc. It is installed in $HOME/Projects/projectname. The default glade file is projectname.glade (in the picture above the project's name is latlongconv). It's in XML, and is loaded by libglade functions. When you build your code (using the build button or the menu item) several subdirectorys will be created in the projectname directory. You can change the names of these in the options window (pixmaps and src). The pixmaps directory is for custom pixmaps, if you have any. These will be installed into /usr/share/pixmaps/projectname when you do 'make install' as root upon completion of your project. The src directory, of course, is where the project's coded guts reside.
Under the C Options tab are the following:
- gettext support: Use this if you want to enable internationalization of your code with gnu gettext.
- set widget names: Use this if you want your code to be able to set widget names. There are a few functions that use this in gtk.
- backup source files: Create backups when you build your source files with Glade?
- Use gnome help support: If you are doing a gnome app, include this. It'll set up the help items gnome uses as standard. (You still have to make them do things though)
- Output main.c: Turn this off if you are breaking up a huge project into several smaller ones (in order to make your *.glade file a manageable size).
- Output support functions: Turn this off to turn off the support functions, utilties such as code to load pixmaps, etc. Basically you'd turn this off if you were splitting up a large project.
- Output build files: Turn this off if you don't want build files (ie the files that go into a standard linux distro, README, AUTHORS, Changelog, etc etc). This will usually be done when you split up a large project.
- Options to rename the basic files: support.c, interface.c, and callbacks.c. Rename them if you are breaking up a large project. Callbacks.c and main.c are the only two files glade doesn't overwrite as it builds. It appends signal callback functions to callbacks.c, and only writes main.c on the first build. Don't mess with interface.c and support.c, as your changes will be overwritten on the next build.
Under Libglade options is only one item. Check it if you wish to internationalize your application, and want a handy file of text strings for your translators.
Remember to save your project when you are finished setting options. It will not be saved to disk until then.
|
|
2. Build a window
Building a window, or a popup box, or a dialog, is not that hard. There are several things to remember, however, while doing so:
- Most widgets are held by containers (which are also widgets, confusingly).
- Containers are held by basic 'window' widgets. For Gtk there are a few of these; the window, the input dialog, the dialog, file selection dialog, etc. For Gnome there are the Gnome Application Window, the Gnome Dialog Box, the Gnome Message Box, Gnome Property Box and the Gnome About Dialog. All of the Gnome 'windows' can be built from the Gtk window widget and various other container and item widgets. Using the Gnome widgets is a convenience, and provides standardization for Gnome applications.
- The container widgets are mostly in the bottom 3 rows of the Gtk menu on the Palette. There are several different kinds, which do different things. The basic ones are vertical and horizontal boxes.
- You can have containers in containers. This can lead to some complex but highly useable designs. Experiment to see what works well.
- Container sizes can be changed. For instance if you set up a vertical box container widget with 3 boxes, and later decide you need four, you can change the size either in the properties window (with that container widget selected) or by right clicking on the actual widget itself.
- Widgets (as selected from Glade's palette) are often combinations of elementary widgets. With these, the part you will work with is the part that takes user input, or displays data.
- You use the properties window to set the names of the handler functions which respond the signals emitted from the various widgets. Remember to use distinctive names for the handlers. The handlers will be listed in callbacks.c when you build the source code from Glade.
- The difficult and most time consuming part of using Glade actually comes after Glade has done its work, when the callbacks and signals need to be connected to the backend code.
|