help for libglade please!!!



Hello,

I try to convert my glade-2 program to use libglade instead of
generated source code.

I have several windows and want to connect the callbacks:

How do I connect an object to the signals from a menuitem?

In xml:
<child>
   <widget class="GtkImageMenuItem" id="konfiguration1">
   <signal name="activate" handler="on_konfiguration_clicked" object="GP"/>

callback is defined:

GCallback
on_konfiguration_clicked               (gpointer user_data)
{
  _global_pointers *gp;
  
  gp=(_global_pointers*)g_object_get_data(user_data,"user_data");
  gtk_widget_show(gp->gnome->dialog1);
}

in main() I have:
   _global_pointers gp[1];
  GObject *GP=g_object_new (G_TYPE_OBJECT,NULL);;
  g_object_set_data (GP, "user_data", gp); 


  xml = glade_xml_new("gzwilling.glade", "app1",NULL);
  gp->gnome->app1 = glade_xml_get_widget(xml,"app1");
  //  glade_xml_signal_connect(xml,"quit1",on_quit1_activate(gp->GP))
  glade_xml_signal_connect_data (xml,"konfiguration1",(GCallback)on_konfiguration_clicked,GP);

  gp->gnome->xml0=xml;
  xml = glade_xml_new("gzwilling.glade", "dialog1",NULL);  
  gp->gnome->dialog1=glade_xml_get_widget(xml,"dialog1");
  gtk_widget_hide(gp->gnome->dialog1);
  glade_xml_signal_autoconnect(xml);
  gp->gnome->xml1=xml;

Now I want the "konfiguration1" (menuentry) to call the callback
on_konfiguration_klicked and this callback has to have the GObject GP!
Because this callback should make

gtk_widget_show(gp->gnome->dialog1)

Or what is the recomended way to show some prior created widgets and
give same data to the callbacks?

Thank you very much.

-- 
Ralf Müller

Institut für Kristallographie   Tel: 0241 80 96906
RWTH Aachen                     Fax: 0241 80 92184
D-52056 Aachen 

Attachment: pgpx3Z7WIrVhh.pgp
Description: PGP signature



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