Re: Theme switching



On Fri, 2010-07-09 at 11:54 +0200, Miroslav Rajcic wrote:
I am trying to write a code to set a custom GTK theme for my program (should 
affect only my application).

The problem is that this sample code works fine on Windows, but not on 
Linux:

char *pszStyle = "gtk-theme-name = \"HighContrastInverse\"\nstyle \"custom\" 
{\nfont_name="Sans 10"\n} widget_class \"*\" style \"custom\"\n";
gtk_rc_parse_string(pszStyle);

Note that the theme exists on the test distro.

Is this officially supported ? Any tips ?
Should it work even after the application window was created ? 



Since you are just changing various GtkSettings, it would be better to
use the GtkSettings API:

g_object_set (gtk_settings_get_default (),
              "gtk-theme-name", "HighContrastInverse",
              "gtk-font-name", "Sans 10",
              NULL);


Your original approach may not be working because the values could be
overridden by the system (xsettings) values.

Regards,

Thomas




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