diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2016-05-16 10:35:28 +0000 |
|---|---|---|
| committer | tavmjong-free <tavmjong@free.fr> | 2016-05-16 10:35:28 +0000 |
| commit | 1984f31c4efcc8be0cdd90a9eb7cc4882890f3cd (patch) | |
| tree | dc454c8483e9dee3123734c6d9b0d0dd74e83bd7 /src | |
| parent | GTK3: Give names to many widgets. Useful for debugging and for using CSS. (diff) | |
| download | inkscape-1984f31c4efcc8be0cdd90a9eb7cc4882890f3cd.tar.gz inkscape-1984f31c4efcc8be0cdd90a9eb7cc4882890f3cd.zip | |
GTK3: Fix compile for GTK3 versions less than 3.16. Try 2.
(bzr r14891)
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp index 4ce8ff145..07d970d59 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1065,28 +1065,39 @@ sp_main_gui(int argc, char const **argv) inkscape_style += "/style.css"; // std::cout << "CSS Stylesheet Inkscape: " << inkscape_style << std::endl; Glib::RefPtr<Gtk::CssProvider> provider = Gtk::CssProvider::create(); + + // From 3.16, throws an error which we must catch. try { provider->load_from_path (inkscape_style); } #if GTK_CHECK_VERSION(3,16,0) + // Gtk::CssProviderError not defined until 3.16. catch (const Gtk::CssProviderError& ex) { std::cerr << "CSSProviderError::load_from_path(): failed to load: " << inkscape_style << "\n (" << ex.what() << ")" << std::endl; } +#else + catch (...) + {} #endif + provider->load_from_path (inkscape_style); + 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<Gtk::CssProvider> provider2 = Gtk::CssProvider::create(); + + // From 3.16, throws an error which we must catch. try { provider2->load_from_path (user_style); } -#if GTK_CHECK_VERSION(3,16,0) - catch (const Gtk::CssProviderError& ex) + catch (...) {} -#endif + provider2->load_from_path (user_style); + Gtk::StyleContext::add_provider_for_screen (screen, provider2, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + #endif gdk_event_handler_set((GdkEventFunc)snooper, NULL, NULL); |
