Problem passing data to g_idle_add



I am having a problem passing data into the g_idle_add() function. The exact line of code i am using is as follows:

    g_idle_add(update_server_version,(gpointer)data.data);

data is a structure, and data.data is a string of characters (char *). The data that I am passing into the g_idle_add() function is correct, however once the update_server_version() callback is called the data that is passed in is corrupted. Is there something wrong with what I am doing here? How would I pass a string of characters into my update_server_version() callback function?

Thank you for any help you can provide, the code below is my update_server_version() callback.

Sincerely
Melvin Newman

gboolean update_server_version(GtkButton *button, gpointer data)
{
    /* Variables
    ******************************************/
    GtkWidget *server_version;
    gchar *string_buffer;
    /*****************************************/
   
    string_buffer = g_strdup_printf("V%s", (char *)data);
    server_version=glade_xml_get_widget(xml,"label2");
    gtk_label_set_text(server_version,string_buffer);
    g_idle_remove_by_data(data);
}


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