From be1716f00566bf34c09ceb3cf6aaaa1ff66743ab Mon Sep 17 00:00:00 2001 From: eidheim Date: Sat, 24 Oct 2015 09:16:32 +0200 Subject: [PATCH] Fixed gtk/gtksourceview version checks. --- src/notebook.cc | 8 ++++---- src/source.cc | 10 ++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/notebook.cc b/src/notebook.cc index 1bbec27..ad33e19 100644 --- a/src/notebook.cc +++ b/src/notebook.cc @@ -6,7 +6,7 @@ #include #include "cmake.h" -#if GTK_VERSION_GE(3, 18) +#if GTKSOURCEVIEWMM_MAJOR_VERSION > 2 & GTKSOURCEVIEWMM_MINOR_VERSION > 17 #include "gtksourceview-3.0/gtksourceview/gtksourcemap.h" #endif @@ -107,7 +107,7 @@ void Notebook::open(const boost::filesystem::path &file_path) { scrolled_windows.back()->add(*source_views.back()); hboxes.back()->pack_start(*scrolled_windows.back()); -#if GTK_VERSION_GE(3, 18) +#if GTKSOURCEVIEWMM_MAJOR_VERSION > 2 & GTKSOURCEVIEWMM_MINOR_VERSION > 17 source_maps.emplace_back(Glib::wrap(gtk_source_map_new())); gtk_source_map_set_view(GTK_SOURCE_MAP(source_maps.back()->gobj()), source_views.back()->gobj()); #endif @@ -149,7 +149,7 @@ void Notebook::open(const boost::filesystem::path &file_path) { } void Notebook::configure(int view_nr) { -#if GTK_VERSION_GE(3, 18) +#if GTKSOURCEVIEWMM_MAJOR_VERSION > 2 & GTKSOURCEVIEWMM_MINOR_VERSION > 17 auto source_font_description=Pango::FontDescription(Singleton::Config::source()->font); auto source_map_font_desc=Pango::FontDescription(static_cast(source_font_description.get_family())+" "+Singleton::Config::source()->map_font_size); source_maps.at(view_nr)->override_font(source_map_font_desc); @@ -245,7 +245,7 @@ bool Notebook::close_current_page() { last_index=-1; } remove_page(page); -#if GTK_VERSION_GE(3, 18) +#if GTKSOURCEVIEWMM_MAJOR_VERSION > 2 & GTKSOURCEVIEWMM_MINOR_VERSION > 17 source_maps.erase(source_maps.begin()+index); #endif auto source_view=source_views.at(index); diff --git a/src/source.cc b/src/source.cc index e59944d..3378d3c 100644 --- a/src/source.cc +++ b/src/source.cc @@ -315,7 +315,7 @@ void Source::View::configure() { property_show_line_numbers() = Singleton::Config::source()->show_line_numbers; if(Singleton::Config::source()->font.size()>0) override_font(Pango::FontDescription(Singleton::Config::source()->font)); -#if GTK_VERSION_GE(3, 16) +#if GTKSOURCEVIEWMM_MAJOR_VERSION > 2 & GTKSOURCEVIEWMM_MINOR_VERSION > 15 gtk_source_view_set_background_pattern(this->gobj(), GTK_SOURCE_BACKGROUND_PATTERN_TYPE_GRID); #endif @@ -354,11 +354,9 @@ void Source::View::configure() { error_property=style->property_background().get_value(); diagnostic_tag_underline->property_underline()=Pango::Underline::UNDERLINE_ERROR; - auto tag_class=G_OBJECT_GET_CLASS(diagnostic_tag_underline->gobj()); //For older GTK+ 3 versions: - auto param_spec=g_object_class_find_property(tag_class, "underline-rgba"); - if(param_spec!=NULL) { - diagnostic_tag_underline->set_property("underline-rgba", Gdk::RGBA(error_property)); - } +#if GTK_VERSION_GE(3, 16) + diagnostic_tag_underline->set_property("underline-rgba", Gdk::RGBA(error_property)); +#endif } //TODO: clear tag_class and param_spec?