diff --git a/src/config.cc b/src/config.cc index ed7d4e9..cf2a7c1 100644 --- a/src/config.cc +++ b/src/config.cc @@ -37,20 +37,18 @@ void MainConfig::find_or_create_config_files() { } void MainConfig::GenerateSource() { - auto source_cfg=Singleton::Config::source(); - DEBUG("Fetching source cfg"); - // boost::property_tree::ptree + auto source_cfg = Singleton::Config::source(); auto source_json = cfg.get_child("source"); auto clang_types_json = source_json.get_child("clang_types"); auto style_json = source_json.get_child("style"); - source_cfg->tab_size = source_json.get("tab_size"); - for (unsigned c = 0; c < source_cfg->tab_size; c++) - source_cfg->tab+=" "; + auto gsv_json = source_json.get_child("sourceview"); + + for (auto &i : gsv_json) + source_cfg->gsv[i.first] = i.second.get_value(); for (auto &i : style_json) - source_cfg->tags[i.first]=i.second.get_value(); + source_cfg->tags[i.first] = i.second.get_value(); for (auto &i : clang_types_json) - source_cfg->types[i.first]=i.second.get_value(); - DEBUG("Source cfg fetched"); + source_cfg->types[i.first] = i.second.get_value(); } void MainConfig::GenerateDirectoryFilter() { diff --git a/src/source.cc b/src/source.cc index 358b43a..aa6cef7 100644 --- a/src/source.cc +++ b/src/source.cc @@ -65,6 +65,9 @@ Source::View::View(const std::string& file_path): file_path(file_path) { if(scheme) { get_source_buffer()->set_style_scheme(scheme); } + + property_highlight_current_line() = Singleton::Config::source()->gsv["highlight_current_line"] == "true"; + property_show_line_numbers() = Singleton::Config::source()->gsv["show_line_numbers"] == "true"; } void Source::View::search_occurrences_updated(GtkWidget* widget, GParamSpec* property, gpointer data) { diff --git a/src/source.h b/src/source.h index 40b4b37..b24fb2b 100644 --- a/src/source.h +++ b/src/source.h @@ -20,12 +20,11 @@ namespace Source { class Config { public: - unsigned tab_size; - bool show_line_numbers, highlight_current_line; - std::string tab; - char tab_char=' '; - std::unordered_map tags, types; - }; // class Config + unsigned tab_size = 2; + char tab_char = ' '; + std::string tab = " "; + std::unordered_map tags, types, gsv; + }; class Range { public: