GtkDrawingArea realize event not connected when using libglade?



   Hello.
   I must be doing something wrong but I don't know what is it, I can't
believe that it is a bug in libglade since it should hit a lot of
applications and people and I am not very experienced with GTK2 (I used
GTK1 some long time ago though).
   It seems that libglade is not connecting the realize event of the
drawing area but I can't believe it.
   Can someone tell what I am doing wrong or what I am missing? I
googled for this, read a lot of documentation, invested like 4 hours and
still don't get it. I know I can do some workarounds to what I am trying
to do, but I think that it is better to learn. Your toughts are very
appreciated.
   Here is my testglade.c file:

/*
   Compile with:
gcc -Wall -o testglade testglade.c $(pkg-config libglade-2.0 --cflags
--libs) -export-dynamic
*/

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

void realize(GtkWidget *da, gpointer ud)
{
   g_print("realize_event of DrawingArea called!!!\n");
}

int main(int argc, char *argv[])
{
   GladeXML *gxml;
   gtk_init(&argc, &argv);
   gxml = glade_xml_new("test.glade", NULL, NULL);
   glade_xml_signal_autoconnect(gxml);
   gtk_main();
   return 0;
}


   Here is my test.glade file:

<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>

<glade-interface>

<widget class="GtkWindow" id="window1">
 <property name="visible">True</property>
 <property name="title" translatable="yes">window1</property>
 <property name="type">GTK_WINDOW_TOPLEVEL</property>
 <property name="window_position">GTK_WIN_POS_NONE</property>
 <property name="modal">False</property>
 <property name="resizable">True</property>
 <property name="destroy_with_parent">False</property>
 <property name="decorated">True</property>
 <property name="skip_taskbar_hint">False</property>
 <property name="skip_pager_hint">False</property>
 <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
 <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
 <property name="focus_on_map">True</property>
 <property name="urgency_hint">False</property>

 <child>
   <widget class="GtkDrawingArea" id="drawingarea1">
     <property name="visible">True</property>
     <signal name="realize" handler="realize" after="yes"
last_modification_time="Mon, 12 Jun 2006 22:21:03 GMT"/>
   </widget>
 </child>
</widget>

</glade-interface>


   I made a testgtk.c file too to see if I can get the realize event
and this works (I used a notebook because thats what I am doing in my
real application which uses libglade):
/*
   Compile with:
gcc -Wall -o testgtk testgtk.c $(pkg-config gtk+-2.0 --cflags --libs)
*/

#include <gtk/gtk.h>

void realize(GtkWidget *da, gpointer ud)
{
   g_print("realize_event of DrawingArea called!!!\n");
}

int main(int argc, char *argv[])
{
   GtkWidget *window, *nb, *lbl, *da;
   gtk_init(&argc, &argv);
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   da = gtk_drawing_area_new ();
   gtk_widget_set_size_request (da, 100, 100);
   g_signal_connect_after (da, "realize", G_CALLBACK (realize), NULL);
   lbl = gtk_label_new ("A notebook with a Drawing Area");
   nb = gtk_notebook_new ();
   gtk_notebook_append_page(GTK_NOTEBOOK(nb), GTK_WIDGET(da),
GTK_WIDGET(lbl));
   gtk_container_add (GTK_CONTAINER (window), nb);
   gtk_widget_show_all (window);
   gtk_main();
   return 0;
}

   Goodbye.
P.s.: I posted this email to gtk-app-devel-list yesterday but it didn't show up...


--
Ivan Baldo - ibaldo adinet com uy - http://ibaldo.codigolibre.net/
ICQ 10215364 - Phone/FAX (598) (2) 613 3223.
Caldas 1781, Malvin, Montevideo, Uruguay, South America, planet Earth.
In favour of world peace and freedom, against U.S.A. and allies!!!
Alternatives: ibaldo codigolibre net - http://go.to/ibaldo






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