Toggle multi-page-mode with d

This commit is contained in:
Moritz Lipp 2012-10-06 14:58:07 +02:00
parent ac88923e5b
commit 94d8eef959
3 changed files with 41 additions and 0 deletions

View file

@ -292,6 +292,7 @@ config_load_default(zathura_t* zathura)
girara_shortcut_add(gsession, 0, GDK_KEY_F5, NULL, sc_toggle_fullscreen, FULLSCREEN, 0, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_n, NULL, girara_sc_toggle_statusbar, NORMAL, 0, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_m, NULL, girara_sc_toggle_inputbar, NORMAL, 0, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_d, NULL, sc_toggle_page_mode, NORMAL, 0, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_q, NULL, sc_quit, NORMAL, 0, NULL);

View file

@ -1008,6 +1008,35 @@ error_ret:
return false;
}
bool
sc_toggle_page_mode(girara_session_t* session, girara_argument_t*
UNUSED(argument), girara_event_t* UNUSED(event), unsigned int UNUSED(t))
{
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 == NULL) {
girara_notify(session, GIRARA_WARNING, _("No document opened."));
return false;
}
int pages_per_row = 1;
girara_setting_get(zathura->ui.session, "pages-per-row", &pages_per_row);
static int tmp = 2;
int value = 1;
if (pages_per_row == 1) {
value = tmp;
} else {
tmp = pages_per_row;
}
girara_setting_set(zathura->ui.session, "pages-per-row", &value);
return true;
}
bool
sc_toggle_fullscreen(girara_session_t* session, girara_argument_t*
UNUSED(argument), girara_event_t* UNUSED(event), unsigned int UNUSED(t))

View file

@ -204,6 +204,17 @@ bool sc_navigate_index(girara_session_t* session, girara_argument_t* argument, g
*/
bool sc_toggle_index(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t);
/**
* Toggle multi page mode
*
* @param session The used girara session
* @param argument The used argument
* @param event Girara event
* @param t Number of executions
* @return true if no error occured otherwise false
*/
bool sc_toggle_page_mode(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t);
/**
* Toggle fullscreen mode
*