LibGlade query: trouble with lookup_widget.


After asking a bit about this problem on irc, I decided to ask on the mailing
lists. Well, in my app using libglade to develop the dialog. heres what the
creation function looks like.

create_my_dialog ()
	GladeXML *gui;

	gui = glade_xml_new ("", "dialog1");
	glade_xml_signal_autoconnect (gui);
	gtk_object_unref (GTK_OBJECT (gui));


Hope that is ok. In dialog1, I have a GtkEntry from which I want to get the
string typed in by the user. I have connected the callback for the Ok button
of the dialog box and it looks like this (roughly).

dialog_ok_cb (GtkWidget *w, gpointer data)
	GtkWidget *entry;

	entry = lookup_widget (GTK_WIDGET (widget), "entry1");

Well lookup_widget is a func which is generated by glade when you tell it to
build the source code. So I copied it from some other project(Guys using glade
with C source code output, will be familiar with it). Well lookup_widget is
not able to get the pointer to the entry widget for me. What do I do.

If I use glade_xml_get_widget (), I will have to remove the call to 
gtk_object_unref () from the creation function and have a GladeXML* passed as
data to the callback. Also I'll have to gtk_signal_connect_object_after (), so
that the GladeXML* is freed after the clicked signal using gtk_object_unref.
So how do I achieve this. Remember I'm a lazy programmer and what I'm looking
for is for some way to specify this in the glade file itself and make 
glade_xml_signal_autoconnect () do things for me.

Archit Baweja

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]