## A small example

## Application presentation and context

This section presents a small example of how to use some powerfull widgets provided with the libgnomedb library (the usage of the data dictionary is better seen in the source of the 'gnome-db-browser' application located in the extra/ directory). This small application will allow direct manipulation of data stored in a database representing a small company's shipments. Each shipment (order) is represented by an entry in the 'orders' table, and the corresponding's contents are listed as entries in the 'order_contents' table. Moreover, the customer the order is for is expressed as a link from the 'orders' table to the 'customers' table.

The sample application will allow to select a customer, will provide a tabular (grid) view of all the orders for that customers, and in another tabular (grid) view whill display the selected order's contents. The orders and the order's contents can be directly edited from the tabular views.

The following picture is a screenshot of the final sample application to be built. The resulting window allows to select a customer from a drop-down menu at the top ('Lew Bonito' in the example); the middle part shows the orders for the selected customer, and the bottom part shows the selected order's contents (four items in the example). Even though they are used, all the primary and foreign keys are hidden from the user.

This sample example is built using Glade, and avoids concentrating on the GTK specific layout code. The code is located in the 'examples/SampleApp/' directory, the specific hand-written code being in the 'src/' sub-directory.