[Glade-users] How to use libglade

John (J5) Palmieri johnp@martianrock.com
28 Jun 2003 10:21:50 -0400


On Tue, 2003-05-06 at 23:31, Cletus Lichte wrote:
> Hello all,
> 
> I've designed an interface with a GtkTreeView and a toolbar and a 
> dialog window for an about dialog.  I saved the file and I'm using 
> Anjuta-HEAD to code in.  Everything compiles and runs just fine but I 
> have 2 questions about programming with libglade.
> 
> 1.  How do I access the GtkTreeView in code?  What I mean is, there are 
> only a couple lines of code to get the program to run when I use 
> libglade but there are no headings in the tree view and no way to set 
> them in the Glade interface builder.  So how do I make changes to the 
> GtkTreeView?  Do I have to change the XML file or is there way to 
> access widgets with code?  As you can tell, this is my first time with 
> Glade and libglade so if someone can point me to a web page or a 
> project that uses libglade I'd appreciate it.  Maybe I should just have 
> glade generate the code so that I can learn, but I keep reading that 
> the next version of glade will not have the code generation so I'm 
> trying to learn libglade.  I've read everything that comes with glade 
> and libglade and Anjuta but I don't find anything beyond how to get a 
> libglade file to compile and run.
GtkTreeView is only a view.  You need to associate it with a store
(Usualy a GtkListStore or GtkTreeStore).  Basicly you would create the
store in the startup of your code, give it columns and tell the
GtkTreeView to use it.  Anytime you add data to the store the view will
automaticly update.  Check out the API documentation on gtk.org.  There
are examples on how to use the tree view there.

> 2.  When I start the program, the dialog box *always* starts with the 
> program instead of only when I click the "About" button. When I cancel 
> the dialog and click on the "About" button, it works just fine but how 
> do I get it to not start up when I run the program?

In glade you need to set the visibility of the dialog box to false in
the common tab.

> Thanks for any pointers or files/web sites that anyone can direct me to.

--
J5