Insensitivity doesn't propagate to icon



Hi,

I have a gtk 1.2 application in which I would like to change the
contents of a toolbar button when it is clicked. Using the following
function I have accomplished this, however I have also introduced an
unwanted side effect.

Whenever the toolbar button is set as insensitive, the modified icon
does not change its appearance. The label on the other hand continues
to change correctly. This is confusing since both are within the list
of children for the vbox.

Obviously there is something that I have overlooked, but I am not sure
what it is. Does anyone know where I am going wrong?


void mainapp_connection_button_set_state(gboolean connected)
{
    GtkToolbarChild *child;
    GtkWidget *vbox;

    g_return_if_fail((child = g_list_nth_data(
        GTK_TOOLBAR(mainapp.toolbar)->children, 0)));

    vbox = g_list_nth_data(gtk_container_children(
        GTK_CONTAINER(child->widget)), 0);

    g_return_if_fail(GTK_IS_BOX(vbox));

    if(child->icon)
        gtk_widget_destroy(child->icon);

    if(connected)
    {
        child->icon = gnome_pixmap_new_from_xpm_d(disconnect_xpm);
        gtk_label_set_text(GTK_LABEL(child->label), "Disconnect");
    }
    else
    {
        child->icon = gnome_pixmap_new_from_xpm_d(connect_xpm);
        gtk_label_set_text(GTK_LABEL(child->label), "Connect");
    }

    gtk_box_pack_end(GTK_BOX(vbox), child->icon, FALSE, FALSE, 0);
    gtk_widget_show(child->icon);
}





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