~danieljabailey/inkscape/arc_node_editor

« back to all changes in this revision

Viewing changes to src/main.cpp

  • Committer: tavmjong-free
  • Date: 2016-05-08 07:44:05 UTC
  • mfrom: (14873.1.1 gtk3)
  • Revision ID: tavmjong@free.fr-20160508074405-rm6tiapoq1ugamph
Start of GTK3 external style sheet support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
#include <glib-object.h>
53
53
#include <gtk/gtk.h>
54
54
 
 
55
#if GTK_CHECK_VERSION(3,0,0)
 
56
#include <gtkmm/cssprovider.h>
 
57
#include <gdkmm/screen.h>
 
58
#endif
 
59
 
55
60
#include "inkgc/gc-core.h"
56
61
 
57
62
#ifdef AND
1051
1056
#endif
1052
1057
    g_free(usericondir);
1053
1058
 
 
1059
 
 
1060
#if GTK_CHECK_VERSION(3,0,0)
 
1061
    // Add style sheet (GTK3)
 
1062
    Glib::RefPtr<Gdk::Screen> screen = Gdk::Screen::get_default();
 
1063
 
 
1064
    Glib::ustring inkscape_style = INKSCAPE_UIDIR;
 
1065
    inkscape_style += "/style.css";
 
1066
    // std::cout << "CSS Stylesheet Inkscape: " << inkscape_style << std::endl;
 
1067
    Glib::RefPtr<Gtk::CssProvider> provider = Gtk::CssProvider::create();
 
1068
    try {
 
1069
        provider->load_from_path (inkscape_style);
 
1070
    }
 
1071
    catch (const Gtk::CssProviderError& ex)
 
1072
    {
 
1073
        std::cerr << "CSSProviderError::load_from_path(): failed to load: " << inkscape_style << "\n  (" << ex.what() << ")" << std::endl;
 
1074
    }
 
1075
    Gtk::StyleContext::add_provider_for_screen (screen, provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
 
1076
 
 
1077
    Glib::ustring user_style = Inkscape::Application::profile_path("ui/style.css");
 
1078
    // std::cout << "CSS Stylesheet User: " << user_style << std::endl;
 
1079
    Glib::RefPtr<Gtk::CssProvider> provider2 = Gtk::CssProvider::create();
 
1080
    try {
 
1081
        provider2->load_from_path (user_style);
 
1082
    }
 
1083
    catch (const Gtk::CssProviderError& ex)
 
1084
    {}
 
1085
    Gtk::StyleContext::add_provider_for_screen (screen, provider2, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
 
1086
#endif
 
1087
 
1054
1088
    gdk_event_handler_set((GdkEventFunc)snooper, NULL, NULL);
1055
1089
    Inkscape::Debug::log_display_config();
1056
1090