diff --git a/src/config.cc b/src/config.cc index 3f3c85b..366a7d4 100644 --- a/src/config.cc +++ b/src/config.cc @@ -12,16 +12,9 @@ MainConfig::MainConfig() { GenerateSource(); GenerateDirectoryFilter(); - Singleton::Config::window()->theme=cfg.get("visual.gtk_theme"); - Singleton::Config::window()->theme_variant=cfg.get("visual.gtk_theme_variant"); - - boost::filesystem::create_directories(boost::filesystem::path(Singleton::style_dir())); - boost::filesystem::path juci_style_path=Singleton::style_dir(); - juci_style_path+="juci.xml"; - if(!boost::filesystem::exists(juci_style_path)) - juci::filesystem::write(juci_style_path, juci_style); - Singleton::Config::source()->style=cfg.get("visual.gtk_sourceview_style"); - + Singleton::Config::window()->theme_name=cfg.get("gtk_theme.name"); + Singleton::Config::window()->theme_variant=cfg.get("gtk_theme.variant"); + Singleton::Config::terminal()->make_command=cfg.get("project.make_command"); } @@ -36,6 +29,12 @@ void MainConfig::find_or_create_config_files() { if (file == "menu.xml") juci::filesystem::write(path, menuxml); } } + + boost::filesystem::create_directories(boost::filesystem::path(Singleton::style_dir())); + boost::filesystem::path juci_style_path=Singleton::style_dir(); + juci_style_path+="juci.xml"; + if(!boost::filesystem::exists(juci_style_path)) + juci::filesystem::write(juci_style_path, juci_style); } void MainConfig::GenerateSource() { @@ -52,7 +51,8 @@ void MainConfig::GenerateSource() { for (auto &i : source_json.get_child("clang_types")) source_cfg->clang_types[i.first] = i.second.get_value(); - + + Singleton::Config::source()->style=source_json.get("style"); source_cfg->font=source_json.get("font"); } diff --git a/src/files.h b/src/files.h index 7a64a9e..d7598b7 100644 --- a/src/files.h +++ b/src/files.h @@ -1,12 +1,12 @@ #include const std::string configjson = "{\n" -" \"visual\": {\n" -" \"gtk_theme\": \"Adwaita\", //Use \"\" for default theme, At least these two exist on all systems: Adwaita, Raleigh\n" -" \"gtk_theme_variant\": \"\", //Use \"\" for default variant, and \"dark\" for dark theme variant\n" -" \"gtk_sourceview_style\": \"juci\" //Choices on default install: classic, cobalt, kate, oblivion, solarized-dark, solarized-light, tango\n" +" \"gtk_theme\": {\n" +" \"name\": \"Adwaita\", //Use \"\" for default theme, At least these two exist on all systems: Adwaita, Raleigh\n" +" \"variant\": \"\" //Use \"\" for default variant, and \"dark\" for dark theme variant\n" " },\n" " \"source\": {\n" +" \"style\": \"juci\", //Choices on default install: classic, cobalt, kate, oblivion, solarized-dark, solarized-light, tango\n" " \"font\": \"Monospace\", //Use \"\" for default font, and for instance \"Monospace 12\" to also set size.\n" " \"clang_types\": {\n" " \"43\": \"def:type\",\n" diff --git a/src/juci.cc b/src/juci.cc index 4aa992f..e726127 100644 --- a/src/juci.cc +++ b/src/juci.cc @@ -53,7 +53,7 @@ app::app() : Gtk::Application("no.sout.juci", Gio::APPLICATION_NON_UNIQUE | Gio: MainConfig(); // Read the configs here auto style_context = Gtk::StyleContext::create(); auto screen = Gdk::Screen::get_default(); - auto css_provider = Gtk::CssProvider::get_named(Singleton::Config::window()->theme, Singleton::Config::window()->theme_variant); + auto css_provider = Gtk::CssProvider::get_named(Singleton::Config::window()->theme_name, Singleton::Config::window()->theme_variant); //TODO: add check if theme exists, or else write error to Singleton::terminal() style_context->add_provider_for_screen(screen, css_provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); } diff --git a/src/source.h b/src/source.h index a897876..e76fb1e 100644 --- a/src/source.h +++ b/src/source.h @@ -21,13 +21,13 @@ namespace Source { class Config { public: std::string style; + std::string font; unsigned tab_size; char tab_char; std::string tab; bool highlight_current_line; bool show_line_numbers; std::unordered_map clang_types; - std::string font; }; class Range { diff --git a/src/window.h b/src/window.h index ba6cc1f..dbb08eb 100644 --- a/src/window.h +++ b/src/window.h @@ -16,7 +16,7 @@ public: Notebook notebook; class Config { public: - std::string theme; + std::string theme_name; std::string theme_variant; boost::property_tree::ptree keybindings; };