GTK3: Getting a style class property



I'm trying to get the text color of a class of a GTK style. I have a GtkStyleContext with the widget path and the classes that I want to get their properties.
The code is:

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 gets the normal text color but not the text color in gnome-panel-menu-bar or unity-panel.

I tried using GtkCssProvider but it gets the generic style without the classes I added.

I'm using it in a Qt application to get a native GTK3 look and feel. This code is working fine in a GTK application.

Thanks!


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