[Glade-users] in regards with error concerning glade_xml_get_widget and other glade_xml errors



Hi,
   You have to link to libglade, not only include the headers.

Cheers,
          -Tristan

On Thu, Apr 3, 2008 at 1:55 PM, Atmadarshini devi dasi
<atmadarshini_dd at yahoo.com> wrote:
Hi there

I am having some problems with gtk and glade in my source code. I am using
glade version 2 and ubuntu enviornment. 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);
}




 ________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster
Total Access, No Cost.
_______________________________________________
 Glade-users maillist  -  Glade-users at lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/glade-users






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