Commit bcdc7aba authored by Sebastian Ramacher's avatar Sebastian Ramacher

Check adjust mode argument

Signed-off-by: Sebastian Ramacher's avatarSebastian Ramacher <sebastian+dev@ramacher.at>
parent 10641d68
......@@ -100,8 +100,15 @@ sc_adjust_window(girara_session_t* session, girara_argument_t* argument,
zathura_t* zathura = session->global.data;
g_return_val_if_fail(argument != NULL, false);
zathura_document_set_adjust_mode(zathura->document, argument->n);
adjust_view(zathura);
if (argument->n < ZATHURA_ADJUST_NONE || argument->n >= ZATHURA_ADJUST_MODE_NUMBER) {
girara_error("Invalid adjust mode: %d", argument->n);
girara_notify(session, GIRARA_ERROR, _("Invalid adjust mode: %d"), argument->n);
} else {
girara_debug("Setting adjust mode to: %d", argument->n);
zathura_document_set_adjust_mode(zathura->document, argument->n);
adjust_view(zathura);
}
return false;
}
......
......@@ -101,7 +101,8 @@ typedef enum zathura_adjust_mode_e
ZATHURA_ADJUST_NONE, /**< No adjustment */
ZATHURA_ADJUST_BESTFIT, /**< Adjust to best-fit */
ZATHURA_ADJUST_WIDTH, /**< Adjust to width */
ZATHURA_ADJUST_INPUTBAR /**< Focusing the inputbar */
ZATHURA_ADJUST_INPUTBAR, /**< Focusing the inputbar */
ZATHURA_ADJUST_MODE_NUMBER /**< Number of adjust modes */
} zathura_adjust_mode_t;
/**
......
......@@ -121,7 +121,7 @@ error_out:
static void
create_directories(zathura_t* zathura)
{
static const unsigned int mode = 0711;
static const unsigned int mode = 0700;
if (g_mkdir_with_parents(zathura->config.config_dir, mode) == -1) {
girara_error("Could not create '%s': %s", zathura->config.config_dir,
......
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