 |
GTK+ Forums Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
|
|
|
| Author |
Message |
|
|
atma64 Familiar Face
Joined: 01 Apr 2008 Posts: 6
|
Posted: Thu Apr 03, 2008 4:55 pm Post subject: error in regards with glade_xml_get_widget |
|
|
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
|
Posted: Sun Apr 06, 2008 3:00 pm Post subject: |
|
|
| Did you make sure to install the development libraries of libglade (libglade2-dev)? |
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group CodeBB 1.0 Beta 2
|