#include "juci.h" #include "singletons.h" #include "config.h" #include using namespace std; //TODO: remove void init_logging() { add_common_attributes(); add_file_log(keywords::file_name = Singleton::log_dir() + "juci.log", keywords::auto_flush = true); INFO("Logging initalized"); } int app::on_command_line(const Glib::RefPtr &cmd) { Glib::set_prgname("juci"); Glib::OptionContext ctx("[PATH ...]"); Glib::OptionGroup gtk_group(gtk_get_option_group(true)); ctx.add_group(gtk_group); int argc; char **argv = cmd->get_arguments(argc); ctx.parse(argc, argv); if(argc>=2) { for(int c=1;c(new Window()); add_window(*window); window->show(); bool first_directory=true; for(auto &directory: directories) { if(first_directory) { window->directories.open(directory); first_directory=false; } else { std::string files_in_directory; for(size_t c=0;casync_print("Executing: juci "+directory+files_in_directory); Singleton::terminal()->execute("juci "+directory+files_in_directory, ""); //TODO: do not open pipes here, doing this after Juci compiles on Windows }); another_juci_app.detach(); } } for(auto &file: files) window->notebook.open(file); } app::app() : Gtk::Application("no.sout.juci", Gio::APPLICATION_NON_UNIQUE | Gio::APPLICATION_HANDLES_COMMAND_LINE) { 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_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); } int main(int argc, char *argv[]) { init_logging(); return app().run(argc, argv); }