It is the vpd->view_create = hello_create; with hello_create being a function defined like this :
mstatic void* hello_create(gabywindow* window, gboolean first);Important: hello_create is defined as a "mstatic" function, this means that it will be static excepted when compiled with Miguel wishes.
Let's have an example :
Example 12-2. Creating a view
mstatic void hello_create ( gabywindow *window, gboolean first )
{
GtkWidget *vbox;
GtkWidget *label;
GtkWidget *hbb;
GtkWidget *button;
int *id = &(window->id);
record *r;
r = table_first(v->subtable->table, -1);
*id = ( r == NULL ? 0 : r->id );
r = table_first(window->view->subtable->table, -1);
*id = ( r == NULL ? 0 : r->id );
vbox = gtk_vbox_new(FALSE,0);
window->widget = vbox;
label = gtk_label_new("");
gtk_widget_show(label);
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 0);
hbb = gtk_hbutton_box_new();
gtk_widget_show(hbb);
gtk_box_pack_start(GTK_BOX(vbox), hbb, FALSE, TRUE, 0);
button = gtk_button_new_with_label(_("Previous"));
gtk_widget_show(button);
gtk_signal_connect(GTK_OBJECT(button), "clicked", \
GTK_SIGNAL_FUNC(previous_clicked), window);
gtk_container_add(GTK_CONTAINER(hbb), button);
button = gtk_button_new_with_label(_("Next"));
gtk_widget_show(button);
gtk_signal_connect(GTK_OBJECT(button), "clicked", \
GTK_SIGNAL_FUNC(next_clicked), window);
gtk_container_add(GTK_CONTAINER(hbb), button);
gtk_widget_show(vbox);
return;
} |
int *id = &(window->id);
record *r;
r = table_first(v->subtable->table, -1);
*id = ( r == NULL ? 0 : r->id ); |
Note that unlike the previous version of the API you don't have to play with lots of gtk_object_get_data in your plug-ins, making them cleaner.