GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Oct 23, 2014 3:02 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: error in regards with glade_xml_get_widget
PostPosted: Thu Apr 03, 2008 4:55 pm 
Offline
Familiar Face

Joined: Tue Apr 01, 2008 11:56 am
Posts: 6
Hi there

I am having some problems with gtk and glade in my source code. I am using glade version 2 and ubuntu OS. I included libglade2 in my make file and #include <glade/glade.h> in my code in order to be able to see a widget that i created by glade. Now I am working as part of a project. I am creating an application as part of another project.

now I created a treeview using glade and now i want to be able to fill it up so I saw in examples and also read in the book gtk+ development that the way to do it is to define a GladeXML object and then use the functions such as glade_xml_new , glade_xml_get_widget, glade_xml_signal_autoconnect but when i use these, i get an error that says undefined reference to glade_xml_new
undefined reference to glade_xml_get_widget
undefined reference to glade_xml_signal_autoconnect


i defined the GladeXML in my main and called these functions in my main.

I also tried to use lookup_widget but it doesnt work. I just get an empty treeview.

I have pasted my code below. the first file is the main.c where i have used the glade_xml commands and the other file is called addressbook.c where I ahve created just the renderer for the moment to display the columns.

I have been struggling with this problem for a long time. I would appreciate if someone could help and tell me what I am doing wrong. thanks

Aakanksha


my code for my main is mentioned below.
//main.c
#include <glade/glade.h>

int main( int argc, char *argv[] )
{
GtkWidget *view_address_window, *treeview;
GladeXML *xml;


/* Initialize libraries */
gtk_init (&argc, &argv);
gst_init(NULL, NULL);
xml = glade_xml_new ("imsua.glade", NULL, NULL);
view_address_window = glade_xml_get_widget (xml, "view_address_window");
treeview = glade_xml_get_widget (xml, "treeview");

setup_tree_view (treeview);
glade_xml_signal_autoconnect (xml);
gtk_widget_show_all (view_address_window);

/* Display the main GUI */
imsUA = create_imsUA ();
gtk_widget_show (imsUA);

/* run the main GUI */
gtk_main ();

}
//addressbook.c

GtkWidget *view_address_window;
GtkWidget *address_window;


/* A structure used to hold a single event. */
typedef struct
{
gchar *lastname;
gchar *firstname;
gchar *relationship;
}Contact;

enum
{
LASTNAME = 0,
FIRSTNAME,
RELATIONSHIP,
COLUMNS
};

const Contact list[] =
{
{ "Aggarwal", "Aakanksha", "self" },
{ "Aggarwal", "Priya", "sister" },
{ "Aggarwal", "Ankur", "Brother" },
};

/* Populate the GtkTreeView with three columns */
static void setup_tree_view (GtkWidget *treeview)
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;

renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("Last Name", renderer,
"text", LASTNAME, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);

renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("First Name", renderer,
"text", FIRSTNAME, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);

renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("Relationship", renderer,
"text", RELATIONSHIP, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
}


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 06, 2008 3:00 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
Did you make sure to install the development libraries of libglade (libglade2-dev)?

_________________
Andrew Krause

Foundations of GTK+ Development: Buy now for only $31.49!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group