implement :open

This commit is contained in:
Sebastian Ramacher 2011-08-31 00:08:33 +02:00
parent e349eddd9d
commit c445b0e679
2 changed files with 22 additions and 0 deletions

View file

@ -47,6 +47,27 @@ cmd_info(girara_session_t* session, girara_list_t* argument_list)
bool
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;
}

View file

@ -257,6 +257,7 @@ document_info_open(gpointer data)
}
document_open(document_info->zathura, document_info->path, document_info->password);
free(document_info);
return FALSE;
}