GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

error in regards with glade_xml_get_widget

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
atma64
Familiar Face


Joined: 01 Apr 2008
Posts: 6

PostPosted: Thu Apr 03, 2008 4:55 pm    Post subject: error in regards with glade_xml_get_widget Reply with quote

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);
}
Back to top
openldev
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 387
Location: Fairfax, Virginia

PostPosted: Sun Apr 06, 2008 3:00 pm    Post subject: Reply with quote

Did you make sure to install the development libraries of libglade (libglade2-dev)?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP