Commit 83f55ff2 authored by Moritz Lipp's avatar Moritz Lipp

Implement sc_print

parent de17088c
......@@ -252,7 +252,7 @@ cmd_print(girara_session_t* session, girara_list_t* UNUSED(argument_list))
return false;
}
print((zathura_t*) session->global.data);
print(zathura);
return true;
}
......
......@@ -195,6 +195,8 @@ config_load_default(zathura_t* zathura)
girara_shortcut_add(gsession, 0, GDK_KEY_space, NULL, sc_navigate_index, INDEX, SELECT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Return, NULL, sc_navigate_index, INDEX, SELECT, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_p, NULL, sc_print, NORMAL, 0, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_i, NULL, sc_recolor, NORMAL, 0, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_R, NULL, sc_reload, NORMAL, 0, NULL);
......@@ -290,6 +292,7 @@ config_load_default(zathura_t* zathura)
girara_shortcut_mapping_add(gsession, "goto", sc_goto);
girara_shortcut_mapping_add(gsession, "navigate_index", sc_navigate_index);
girara_shortcut_mapping_add(gsession, "navigate", sc_navigate);
girara_shortcut_mapping_add(gsession, "print", sc_print);
girara_shortcut_mapping_add(gsession, "quit", sc_quit);
girara_shortcut_mapping_add(gsession, "recolor", sc_recolor);
girara_shortcut_mapping_add(gsession, "reload", sc_reload);
......
......@@ -15,6 +15,7 @@
#include "render.h"
#include "utils.h"
#include "page.h"
#include "print.h"
#include "page-widget.h"
bool
......@@ -427,6 +428,24 @@ sc_navigate(girara_session_t* session, girara_argument_t* argument,
return false;
}
bool
sc_print(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_ERROR, _("No document opened."));
return false;
}
print(zathura);
return true;
}
bool
sc_recolor(girara_session_t* session, girara_argument_t* UNUSED(argument),
girara_event_t* UNUSED(event), unsigned int UNUSED(t))
......
......@@ -105,6 +105,17 @@ bool sc_mouse_zoom(girara_session_t* session, girara_argument_t* argument, girar
*/
bool sc_navigate(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t);
/**
* Calls the print dialog
*
* @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_print(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t);
/**
* Recolor the pages
*
......
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