[Glade-users] Signal Bindings



This is my first time making a GTK/Glade program and I am running into 
an issue trying to pass one widget to another widget's signal handler. 
In my test example, I am trying to pass a progress bar to an update 
function when a separate button is clicked. I am able to get this to 
work without any issues when I manually set the callback function, but I 
haven't been able to do it just through the Glade file using 
glade_xml_signal_autoconnect().

Below is my sample XML and C code:

XML:
<widget class="GtkButton" id="button3">
  <property name="visible">True</property>
  <signal name="clicked" handler="updateProgress" object="progressbar"/>
  <child>
    <widget class="GtkLabel" id="label10">
      <property name="visible">True</property>
      <property name="label" translatable="yes">&lt;b&gt;_Run 
Report&lt;/b&gt;</property>
      <property name="use_markup">True</property>
      <property name="use_underline">True</property>
    </widget>
  </child>
</widget>

C:

void updateProgress(GtkWidget *button,GtkProgressBar *progressBar){
/*...*/
}
int main(int argc, char **argv){
    GladeXML *xml;

    gtk_init(&argc, &argv);
    xml = glade_xml_new("my_file.glade", NULL, NULL);

    /* this works */
    //GtkWidget *button;
    //GtkWidget *progressBar;
    //button = glade_xml_get_widget(xml, "button3");
    //progressBar = glade_xml_get_widget(xml, "progressbar1");
    //g_signal_connect(G_OBJECT (button),"clicked",G_CALLBACK 
(updateProgress),progressBar);

    /* but this doesn't  do anything*/
    glade_xml_signal_autoconnect(xml);
/*...*/
}






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