Browse Source

Update source config

merge-requests/365/head
Jørgen Lien Sellæg 10 years ago
parent
commit
c46e8ed57a
  1. 10
      src/config.cc
  2. 3
      src/source.cc
  3. 9
      src/source.h

10
src/config.cc

@ -38,19 +38,17 @@ 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_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<unsigned>("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<std::string>();
for (auto &i : style_json)
source_cfg->tags[i.first] = i.second.get_value<std::string>();
for (auto &i : clang_types_json)
source_cfg->types[i.first] = i.second.get_value<std::string>();
DEBUG("Source cfg fetched");
}
void MainConfig::GenerateDirectoryFilter() {

3
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) {

9
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;
unsigned tab_size = 2;
char tab_char = ' ';
std::unordered_map<std::string, std::string> tags, types;
}; // class Config
std::string tab = " ";
std::unordered_map<std::string, std::string> tags, types, gsv;
};
class Range {
public:

Loading…
Cancel
Save