From fbb9317b912eba2ac02019869b687ec637790e9f Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sun, 8 May 2016 09:29:51 +0200 Subject: Start of GTK3 external style sheet support. (bzr r14873.1.1) --- src/main.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 840643a90..99e3ccfe6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -52,6 +52,11 @@ #include #include +#if GTK_CHECK_VERSION(3,0,0) +#include +#include +#endif + #include "inkgc/gc-core.h" #ifdef AND @@ -1051,6 +1056,35 @@ sp_main_gui(int argc, char const **argv) #endif g_free(usericondir); + +#if GTK_CHECK_VERSION(3,0,0) + // Add style sheet (GTK3) + Glib::RefPtr screen = Gdk::Screen::get_default(); + + Glib::ustring inkscape_style = INKSCAPE_UIDIR; + inkscape_style += "/style.css"; + // std::cout << "CSS Stylesheet Inkscape: " << inkscape_style << std::endl; + Glib::RefPtr provider = Gtk::CssProvider::create(); + try { + provider->load_from_path (inkscape_style); + } + catch (const Gtk::CssProviderError& ex) + { + std::cerr << "CSSProviderError::load_from_path(): failed to load: " << inkscape_style << "\n (" << ex.what() << ")" << std::endl; + } + Gtk::StyleContext::add_provider_for_screen (screen, provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + + Glib::ustring user_style = Inkscape::Application::profile_path("ui/style.css"); + // std::cout << "CSS Stylesheet User: " << user_style << std::endl; + Glib::RefPtr provider2 = Gtk::CssProvider::create(); + try { + provider2->load_from_path (user_style); + } + catch (const Gtk::CssProviderError& ex) + {} + Gtk::StyleContext::add_provider_for_screen (screen, provider2, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); +#endif + gdk_event_handler_set((GdkEventFunc)snooper, NULL, NULL); Inkscape::Debug::log_display_config(); -- cgit v1.2.3