mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-01 08:06:00 +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
|
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue