Browse Source

Minor theme/style cleanup. files.h changed so rm ~/.juci before testing.

merge-requests/365/head
eidheim 10 years ago
parent
commit
3f7555bc4f
  1. 18
      src/config.cc
  2. 8
      src/files.h
  3. 2
      src/juci.cc
  4. 2
      src/source.h
  5. 2
      src/window.h

18
src/config.cc

@ -12,15 +12,8 @@ MainConfig::MainConfig() {
GenerateSource();
GenerateDirectoryFilter();
Singleton::Config::window()->theme=cfg.get<std::string>("visual.gtk_theme");
Singleton::Config::window()->theme_variant=cfg.get<std::string>("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<std::string>("visual.gtk_sourceview_style");
Singleton::Config::window()->theme_name=cfg.get<std::string>("gtk_theme.name");
Singleton::Config::window()->theme_variant=cfg.get<std::string>("gtk_theme.variant");
Singleton::Config::terminal()->make_command=cfg.get<std::string>("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() {
@ -53,6 +52,7 @@ void MainConfig::GenerateSource() {
for (auto &i : source_json.get_child("clang_types"))
source_cfg->clang_types[i.first] = i.second.get_value<std::string>();
Singleton::Config::source()->style=source_json.get<std::string>("style");
source_cfg->font=source_json.get<std::string>("font");
}

8
src/files.h

@ -1,12 +1,12 @@
#include <string>
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"

2
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);
}

2
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<std::string, std::string> clang_types;
std::string font;
};
class Range {

2
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;
};

Loading…
Cancel
Save