mirror of https://gitlab.com/cppit/jucipp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.3 KiB
50 lines
1.3 KiB
|
11 years ago
|
#include "juci.h"
|
||
|
11 years ago
|
#include "singletons.h"
|
||
|
11 years ago
|
|
||
|
11 years ago
|
void init_logging() {
|
||
|
|
add_common_attributes();
|
||
|
11 years ago
|
add_file_log(keywords::file_name = Singleton::log_dir() + "juci.log",
|
||
|
11 years ago
|
keywords::auto_flush = true);
|
||
|
|
INFO("Logging initalized");
|
||
|
|
}
|
||
|
|
|
||
|
11 years ago
|
int Juci::on_command_line(const Glib::RefPtr<Gio::ApplicationCommandLine> &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) {
|
||
|
11 years ago
|
for(int c=1;c<argc;c++) {
|
||
|
11 years ago
|
boost::filesystem::path p=boost::filesystem::canonical(argv[c]);
|
||
|
|
if(boost::filesystem::exists(p)) {
|
||
|
|
if(boost::filesystem::is_regular_file(p))
|
||
|
|
files.emplace_back(p.string());
|
||
|
|
else if(directory=="" && boost::filesystem::is_directory(p))
|
||
|
|
directory=p.string();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
activate();
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
void Juci::on_activate() {
|
||
|
|
window = std::unique_ptr<Window>(new Window());
|
||
|
|
add_window(*window);
|
||
|
|
window->show();
|
||
|
|
if(directory!="") {
|
||
|
11 years ago
|
window->notebook.project_path=directory;
|
||
|
|
window->directories.open_folder(directory);
|
||
|
11 years ago
|
}
|
||
|
|
for(auto &f: files)
|
||
|
11 years ago
|
window->notebook.open(f);
|
||
|
11 years ago
|
}
|
||
|
|
|
||
|
11 years ago
|
int main(int argc, char *argv[]) {
|
||
|
11 years ago
|
init_logging();
|
||
|
11 years ago
|
return Juci().run(argc, argv);
|
||
|
11 years ago
|
}
|