[Glade-users] update GTkLabel label



Hi, 
i've done a little applet using glade, to start or end wminput dameon (a
driver that manage wiimote) . 
In my applet, i have to update  some GtkLabel when a GtkButton is
cliked. the code is below

/**button clicked, so i run set_label on the button brothers*/
on_button_clicked(..){
        /** hbox contains my button and my label*/
        hbox2=gtk_widget_get_parent(GTK_WIDGET(button));
gtk_container_foreach(GTK_CONTAINER(hbox2),(GtkCallback)set_label,&state);
        
}
/** Here i have to test along GtkLabel label, to change their label*/
/** what i'd like to do is to test along a reference, or a code, instead
of text*/
set_label(widget,..){
message_label_connected_on="the old label i want to change";
message_label_connected_off="the new label";

/**get the current label*/
current=gtk_label_get_label(GTK_LABEL(widget));
if(g_string_equal(g_string_new(current),g_string_new(message_label_connected_on))){

gtk_label_set_label(GTK_LABEL(widget),message_label_connected_off);
 }

}

Well, it runs, but i'm sure it's not a good solution, as testing along
string is not really good, due to  charset, language...

I've tried to emit  a signal too my GtkLabel from my Gtk_Button_clicked
function, but i get a seg fault. 

The problem is : "how to update GTkLabel state in widget instances
hierarchy when a button, that may be a leaf, is clicked"? 
any code example or advice would be gratelly apprecied. 

cio








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