diff --git a/src/vido.cc b/src/vido.cc index e2e1483..e8d4b80 100644 --- a/src/vido.cc +++ b/src/vido.cc @@ -49,8 +49,24 @@ Window *window; Widget *html; GtkWidget *html_wg; +static zim::File zimFile; +static bool initialized = false; + // // // misc functions +const zim::File get_file() +{ + if (!initialized){ + std::cout<<"file not initialized :"<(static_cast(m.getCountArticles()) * rand_r(&seed) / RAND_MAX); zim::Article article = m.getArticle(idx); @@ -92,7 +112,7 @@ void search_window(main_window *window_x){ void set_html(const gchar *url){ // // create ZIM file accessor - zim::File m(file); + zim::File m = get_file(); // // convert url to string std::string term; @@ -156,7 +176,7 @@ void set_html(const gchar *url){ // // test functions void set_search(const gchar *url){ // std::cout<<"url"<getUrl() << '\n'; @@ -235,36 +255,44 @@ bool on_link_clicked(GtkHTML *html, const gchar *url) // // main function int main(int argc, char **argv) { + if (argc == 2) + { + file = argv[1]; - file = argv[1]; + std::cout<<"vido is here file:"<