[Glade-users] Newbe problem with tutorial example



On Monday 15 February 2010 4:06:43 pm Tristan Van Berkom wrote:
Errr, where did you get the tutorial and why does it still say to use
gtk-builder-convert ?

If you show us the code I'm sure we can point out whats going wrong, my
instinct already tells me that your tutorial code reffers to a widget by
name that is not present in the interface xml.

Cheers,
       -Tristan


On Mon, Feb 15, 2010 at 3:08 PM, Gerald I. Evenden

<geraldi.evenden at gmail.com> wrote:
I am a glade3 newbe working on Kubuntu 8.4 64bit.

For testing I am trying the tutorial and have performed the steps in the
main.c file to generate 'tutorial':

/*
First run tutorial.glade through gtk-builder-convert with this command:
?gtk-builder-convert tutorial.glade tutorial.xml

Then save this file as main.c and compile it using this command
(those are backticks, not single quotes):
?gcc -Wall -g -o tutorial main.c `pkg-config --cflags --libs
gtk+-2.0` -export-dynamic

Then execute it using:
?./tutorial
*/


Next, when executing:

./tutorial

(tutorial:2112): Gtk-CRITICAL **: gtk_widget_show: assertion
`GTK_IS_WIDGET (widget)' failed

which must be followed by <cntrl>C to exit.

Any hint or suggestion would be greatly appreciated.

Thank-you.

A url reference is:
http://www.micahcarrick.com/12-24-2007/gtk-glade-tutorial-part-1.html

You've given me a clue that the tutorial isn't worth s__t which is very 
helpful. :-) The gtk-builder-convert bothered me but remember, I'm new to 
this.

BTW, the tutorial.glade file is:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.0 on Tue Nov 20 14:05:37 2007 -->
<glade-interface>
  <widget class="GtkWindow" id="window1">
    <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
    <child>
      <placeholder/>
    </child>
  </widget>
</glade-interface> 

and the main.c file:

/*
First run tutorial.glade through gtk-builder-convert with this command:
  gtk-builder-convert tutorial.glade tutorial.xml
  
Then save this file as main.c and compile it using this command
(those are backticks, not single quotes):
  gcc -Wall -g -o tutorial main.c `pkg-config --cflags --libs 
gtk+-2.0` -export-dynamic
  
Then execute it using:
  ./tutorial
*/
#include <gtk/gtk.h>
 
void 
on_window_destroy (GtkObject *object, gpointer user_data)
{
    gtk_main_quit ();
}
 
int
main (int argc, char *argv[])
{
    GtkBuilder      *builder; 
    GtkWidget       *window;
 
    gtk_init (&argc, &argv);
 
    builder = gtk_builder_new ();
    gtk_builder_add_from_file (builder, "tutorial.xml", NULL);
    window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
    gtk_builder_connect_signals (builder, NULL);
 
    g_object_unref (G_OBJECT (builder));
        
    gtk_widget_show (window);                
    gtk_main ();
 
    return 0;
}

-- 
The whole religious complexion of the modern world is due
to the absence from Jerusalem of a lunatic asylum.
-- Havelock Ellis (1859-1939) British psychologist




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