Commit c445b0e6 authored by Sebastian Ramacher's avatar Sebastian Ramacher

implement :open

parent e349eddd
...@@ -47,6 +47,27 @@ cmd_info(girara_session_t* session, girara_list_t* argument_list) ...@@ -47,6 +47,27 @@ cmd_info(girara_session_t* session, girara_list_t* argument_list)
bool bool
cmd_open(girara_session_t* session, girara_list_t* argument_list) cmd_open(girara_session_t* session, girara_list_t* argument_list)
{ {
g_return_val_if_fail(session != NULL, false);
g_return_val_if_fail(session->global.data != NULL, false);
zathura_t* zathura = session->global.data;
if (zathura->document) {
document_close(zathura);
}
const int argc = girara_list_size(argument_list);
if (argc > 2) {
girara_error("too many arguments");
return false;
}
else if (argc >= 1) {
document_open(zathura, girara_list_nth(argument_list, 0), (argc == 2) ? girara_list_nth(argument_list, 1) : NULL);
}
else {
girara_error("no arguments");
return false;
}
return true; return true;
} }
......
...@@ -257,6 +257,7 @@ document_info_open(gpointer data) ...@@ -257,6 +257,7 @@ document_info_open(gpointer data)
} }
document_open(document_info->zathura, document_info->path, document_info->password); document_open(document_info->zathura, document_info->path, document_info->password);
free(document_info);
return FALSE; return FALSE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment