GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sat Dec 20, 2014 8:54 pm

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: glade_get_widget_tree: assertion 'widget !=null' failed
PostPosted: Fri Jun 06, 2008 11:50 am 
Offline
Familiar Face

Joined: Thu May 15, 2008 8:50 am
Posts: 9
Hello,

I have a problem getting a GladeXML from a widget, when calling from a separate c file. The runtime error is:
glade_get_widget_tree: assertion 'widget !=null' failed

The sample code on this forum is nearly exactly the same, but I cannot get it to work. Ideas?

in callbacks.c I have:

#include <gtk/gtk.h>
#include <glade/glade.h>
#include "callbacks.h"

void on_button1_clicked(GtkButton *button, gpointer user_data){
printf("button 1 pressed\n");
GladeXML *gxml;
GtkWidget *but2Widget;
GtkButton *but2;
gxml = glade_get_widget_tree(GTK_WIDGET(button));

};

and in main.c i have:


#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <config.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
#include "callbacks.h"
#define GLADE_FILE "p4.glade"
GtkWidget*
create_window (void)
{
GtkWidget *window;
GladeXML *gxml;
gxml = glade_xml_new (GLADE_FILE, NULL, NULL);
glade_xml_signal_autoconnect (gxml);
window = glade_xml_get_widget (gxml, "window");
return window;
}


int
main (int argc, char *argv[])
{
GtkWidget *window;
gtk_set_locale ();
gtk_init (&argc, &argv);
window = create_window ();
gtk_widget_show (window);
gtk_main ();
return 0;
}


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group