[Glade-users] How to add code for a treeview
Keith Sharp
kms@passback.co.uk
Fri, 03 Sep 2004 13:48:16 +0100
On Fri, 2004-09-03 at 08:30 -0300, Mario Carugno wrote:
> Hi there, suposse i design an interface with a treeview inside.
> Treeviews needs some extra code in order to work, such as define a
> model, an iterator and other things...
> Now, since the treeview is coded by glade into interface.c and that
> file can't be modified by hand... where can i put the code to complete
> the treeview's logic ?
You should not use the code generation features of GLADE. If you use
libglade and and XML GLADE file you can do:
GladeXML *xml;
GtkWidget *treeview;
GtkTreeSelection *selection;
xml = glade_xml_new ("/path/to/file.glade", NULL, NULL);
treeview = glade_xml_get_widget (xml, "treeview1");
/* Other treeview functions can go here, for example: */
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
Keith.