I am trying to get the text color of a GTK class. I have a GtkStyleContext with widgets and classes that I want to get with my properties.
GtkWidgetPath* widgetPath = gtk_widget_path_new (); gtk_widget_path_append_type(widgetPath, GTK_TYPE_WINDOW); gtk_widget_path_iter_set_name(widgetPath, -1 , "UnityPanelWidget"); GtkStyleContext *context = gtk_style_context_new(); gtk_style_context_set_path(context, widgetPath); gtk_style_context_add_class(context, "gnome-panel-menu-bar"); gtk_style_context_add_class(context, "unity-panel");
I used gtk_style_context_lookup_color, and it got the usual text color, but not the color of the text in the gnome-panel-panel menu panel or panel panel.
I tried using GtkCssProvider, but it got a generic style without added classes.
I use it in a Qt application to get the look of GTK3. This code works great in a GTK application.
Thanks!
source share