mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-28 21:06:01 +01:00
implement :open
This commit is contained in:
parent
e349eddd9d
commit
c445b0e679
2 changed files with 22 additions and 0 deletions
21
commands.c
21
commands.c
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue