gtk_widget_set_style() not working on GtkText



I tried to set the backgrond color of a GtkText using another
GtkStyle.

First I created the GtkText and made a copy of its style
onto itself.

        w = gtk_text_new(...);
        style_ptr = gtk_widget_get_style(w);
        style_ptr = ((style_ptr == NULL) ?
            NULL : gtk_style_copy(style_ptr)
        );
        if(style_ptr != NULL)
        {
            GtkStyle *style_src_ptr;

            style_src_ptr = styles_list->edit_text_background;
            if(style_src_ptr != NULL)
                style_ptr->base[GTK_STATE_NORMAL] =
                    style_src_ptr->base[GTK_STATE_NORMAL];

            style_src_ptr = styles_list->edit_text_standard;
            if(style_src_ptr != NULL)
                style_ptr->font = style_src_ptr->font;  

            gtk_widget_set_style(w, style_ptr);
        }

This much seems to work, but later on in my program. I want to change
its color again:

            /* Get the GtkText. */
            w = editor->section_text;
            if(w != NULL)
            {
                GtkStyle *cur_style = gtk_widget_get_style(w);
                if(cur_style != NULL)
                {
                    style_ptr = styles_list->edit_text_background;
                    if(style_ptr != NULL)
                    {
                        cur_style->base[GTK_STATE_NORMAL] =
                            style_ptr->base[GTK_STATE_NORMAL];
                    }
                    gtk_widget_set_style(w, cur_style);
                    gtk_widget_ensure_style(w);
                }
            }

This dosen't seem to update things, the GtkText still thinks the style did
not change.

How do I ensure that the GtkText sees the new style?

--
Sincerely,                  ,"-_                         \|/
-Capt. Taura M.             ,   O=__                    --X--
..__                         ,_JNMNNEO=_                 /|\
OMNOUMmnne.                  {OMMNNNEEEEOO=_
UOOOBIOOOEOMMn.               'LONMMMMNNEEEOOO=.__..,,..
UUOOEUUOOOOOOOObe              '"=OMMMMWNEEEOOOOO,"=OEEEOO=,._
OOUUUIEEIOONNOIUbe.                "7OMMMMNNNNNWWEEEEOOOOOO"   "'.
EEBNNMMMNWNWWEEIMMNe.             __  7EMMMNNNNNWWWEEEEEEEOO.     " .
NNMMMMWWWMMMWEINMMMNn            "=BBEEEEMMMMMMMMNNNWWWEEOOOOO=._     .
                  http://furry.ao.net/~learfox/





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