BOND - Building object network databases
treshna Enterprises Ltd

This documentent is outdated, please refer to the website
for more uptodate information.

This file outlines what you need to do to create an application
with the BOND library. 

Overview
--------

What you need:

Postgresql Database  
Glade file
gtkcallback.c
.bond
run program

The database contains the data that the application will search from and 
add and remove to. At the moment only postgresql is supported but this
should be changed pretty soon. The glade file defines the interface for 
the application and it is neccesary to follow naming conventions when 
creating widgets to ensure the application works. The gtkcallback.c contains
the custom signal handlers for the widgets. The .bond file contains
configuration information for the application. The run program is a very 
small c file that initiates gtk and bond and tries to display the specified 
window in the glade file.

Writing the Application
-----------------------

First the database needs to be set up, in order for your application to
do anything useful. See docs/naming for information on how to properly 
name widget fields. To perform something useful buttons need to have 
signals attached. To let bond autoattach signals to the buttons, don't
attach anything and follow the conventions provided in the docs/naming
under buttons. To attach a custom signal, select the signal you want to
attach in glade and provide a name for the handler method. This method 
must then be defined in gtkcallback.c. All the windows should be made 
not visible, that way they are only shown when needed. When the glade file
and the database are set up the .bond file should be made, this lets bond
know where to find the database and glade file. Finally a small c file 
must be made that calls the top level window in the application and sets 
up any additional information.

.bond
-----
A template for a .bond file.

debuginfo=1
debuglineinfo=0
fladexmlfile=yourgladefilehere.glade
db=host = hostthatdatabaseison dbname = databasename user = dbusername

GtkCallBack.c
-------------

A typical gtkcallback.c file might have the following includes:

#include <glade/glade.h>
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>

#include "gtkcallback.h"
#include "superglue.h"
#include "globalgtk.h"
#include "roof.h"
#include "stickypaper.h"
#include "postit.h"
#include "api.h"

#include "debug.h"

In the signal handler, first you should call bond_specifyclass to 
ensure the window matches up with the class you want to use. Then
you should call whatever api call you need. A signal handler that
takes care of the signal when a search button is clicked might
look like. This is where soldiersearch is the window that the
button is in, soldier is the class that we want to search through
and searchresult is where to display the results.

void
on_soldier_search(GtkWidget * button, gpointer user_data)
   {
   bond_specifyclass("soldiersearch", "soldier");
   bond_formsearch("soldiersearch", "searchresult");
   }
   
Run Program
-----------

This is a basic template for a run program,

programname.c

#include <stdio.h>
#include <glade/glade.h>
#include <gtk/gtk.h>
#include <glib.h>

#include "api.h"
#include "bond.h"
#include "debug.h"
#include "globalgtk.h"
#include "roof.h"
#include "db.h"

int
main(int argc, char *argv[])
   {
   gtk_init(&argc, &argv);
   bond_init(NULL);

   bond_specifyclass("soldiersearch", "soldier");

   gtk_widget_show(getgtkwindow("soldiersearch"));
   /* clean up geas and corba connections */
   gtk_main();
   bond_cleanup();

   return 0;
   }







