widget setting problem in signal handler



Hi,

I have the following code snippet (a callback function for a gtk button).

static void
button_cb (GtkWidget *button, gpointer d)
{
 static guint loop_id = 0;

 if ( loop_id == 0)
   {
     loop_id = gtk_idle_add_priority (G_PRIORITY_LOW, refresh_image, NULL);
     gtk_widget_set (button, "label", "Freeze");
   }
 else
   {
     gtk_idle_remove (loop_id);
     gtk_widget_set (button, "label", "Live");
     loop_id = 0;
   }
}

The button display "Freeze" with no problem, however, when ever I click when the label is Freeze, Gtk gives me this warning msg:

Gtk-WARNING **: gtk_widget_set(): could not find argument [some junk char] in the `GtkButton' class ancestry

The button label didn't change back to "Live".

The callback goes to the proper if branch whenever I click on the button.

The button is set up like this:

 button = gtk_button_new_with_label ("Live");
 gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0);
 gtk_signal_connect (GTK_OBJECT (button), "clicked",
             GTK_SIGNAL_FUNC (button_cb), NULL);

Can anybody tell me what I have done wrong?

Patrick





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