Phlenum
Phlenum

Reputation: 35

How do I set a default theme for my Gtk+ application?

I'm building my Gtk+-3.0 application on Windows 7 and I want to change it's default theme. I noticed GIMP does not require the Gtk+ Runtime to be installed in order to render it's default theme. I can't find any function that sets a given theme at runtime for my application.

Also I considered using CSS styling however that feature was introduced in Gtk+-3.X and GIMP uses Gtk+-2.X as far as I know.

So my question is: Is it even possible to change the Gtk theme at runtime and if so what functions does the application have to call?

Upvotes: 1

Views: 1851

Answers (1)

XTL
XTL

Reputation: 861

Gimp on Windows probably doesn't require a separate Gtk+ runtime, because it has been bundled in the installer. This means the application lugs along its own libraries and runtime files just like a lot of Windows software usually does. System integration in Windows is pretty miserable (no repositories, libraries or dependency tracking, so almost nobody shares libraries).

I suspect because of this, setting a system wide GTK theme might not be applied everywhere. You can hunt for the gtk rc files, though.

If you want to style a single application, Gtk3 should be able to load custom CSS at runtime. There is an example for Python at http://wolfvollprecht.de/blog/gtk-python-and-css-are-an-awesome-combo/. The API will be similar.

Upvotes: 1

Related Questions