How to replace gtk_widget_modify_text() with CSS?



Greetings to the list.

Several years ago I took over maintainership of a useful amateur radio
application written for GTK+ 2.  As a winter project I've decided to
port it to GTK+ 3 and have used the transition guide to accomplish
much.  I set the build system to generate warnings for deprecated
constructs and one of the things that has me stumped is how to replace a
call to GTK+ 2's gtk_widget_modify_text() with CSS in GTK+ 3.  Now, I'm
not a complete newcomer to CSS having used it with HTML years back so
that is not the issue.

In the program source there are lines like this which merely set the
foreground color of some text based on a default or some later user
preference:

gtk_widget_modify_text(highentry1, GTK_STATE_NORMAL, &preferences.highcolor1);

Building now generates this warning (I have a lot of these):

  CC       main.o
../../xdx/src/main.c: In function ‘main’:
../../xdx/src/main.c:332:5: warning: ‘gtk_widget_modify_text’ is deprecated: Use 'CSS style classes' instead 
[-Wdeprecated-declarations]
     gtk_widget_modify_text(highentry1, GTK_STATE_NORMAL, &preferences.highcolor1);
     ^~~~~~~~~~~~~~~~~~~~~~

I have been looking through the reference documentation and various
examples to find something relatively simple to change the foreground
color of the text.  Right now what I am looking for is a clue of how to
get from "here" to "there".  What I am finding seems to be rather
complicated and involved.  Hopefully my impression is incorrect.

Is there a function that I've missed that can apply CSS inline similar
to this deprecated function?

TIA

- Nate

-- 

"The optimist proclaims that we live in the best of all
possible worlds.  The pessimist fears this is true."

Web: http://www.n0nb.us  GPG key: D55A8819  GitHub: N0NB


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