From 3908c70eec41000f11ee8871630b4f36e7dd6f8c Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Sat, 24 Mar 2012 10:38:48 +0100 Subject: [PATCH] Implemented cmd_quit --- commands.c | 9 +++++++++ commands.h | 9 +++++++++ config.c | 23 ++++++++++++----------- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/commands.c b/commands.c index 7535397..08de4cd 100644 --- a/commands.c +++ b/commands.c @@ -4,6 +4,7 @@ #include #include "commands.h" +#include "shortcuts.h" #include "bookmarks.h" #include "database.h" #include "document.h" @@ -209,6 +210,14 @@ cmd_open(girara_session_t* session, girara_list_t* argument_list) return true; } +bool +cmd_quit(girara_session_t* session, girara_list_t* UNUSED(argument_list)) +{ + sc_quit(session, NULL, NULL, 0); + + return true; +} + bool cmd_print(girara_session_t* session, girara_list_t* UNUSED(argument_list)) { diff --git a/commands.h b/commands.h index f1dc4aa..bdae52c 100644 --- a/commands.h +++ b/commands.h @@ -78,6 +78,15 @@ bool cmd_open(girara_session_t* session, girara_list_t* argument_list); */ bool cmd_print(girara_session_t* session, girara_list_t* argument_list); +/** + * Close zathura + * + * @param session The used girara session + * @param argument_list List of passed arguments + * @return true if no error occured + */ +bool cmd_quit(girara_session_t* session, girara_list_t* argument_list); + /** * Save the current file * diff --git a/config.c b/config.c index 2b1ac24..3d9c373 100644 --- a/config.c +++ b/config.c @@ -237,17 +237,18 @@ config_load_default(zathura_t* zathura) girara_mouse_event_add(gsession, GDK_BUTTON2_MASK, 0, sc_mouse_scroll, NORMAL, GIRARA_EVENT_MOTION_NOTIFY, 0, NULL); /* define default inputbar commands */ - girara_inputbar_command_add(gsession, "bmark", NULL, cmd_bookmark_create, NULL, _("Add a bookmark")); - girara_inputbar_command_add(gsession, "bdelete", NULL, cmd_bookmark_delete, cc_bookmarks, _("Delete a bookmark")); - girara_inputbar_command_add(gsession, "blist", NULL, cmd_bookmark_open, cc_bookmarks, _("List all bookmarks")); - girara_inputbar_command_add(gsession, "close", NULL, cmd_close, NULL, _("Close current file")); - girara_inputbar_command_add(gsession, "info", NULL, cmd_info, NULL, _("Show file information")); - girara_inputbar_command_add(gsession, "help", NULL, cmd_help, NULL, _("Show help")); - girara_inputbar_command_add(gsession, "open", "o", cmd_open, cc_open, _("Open document")); - girara_inputbar_command_add(gsession, "print", NULL, cmd_print, NULL, _("Print document")); - girara_inputbar_command_add(gsession, "write", NULL, cmd_save, cc_write, _("Save document")); - girara_inputbar_command_add(gsession, "write!", NULL, cmd_savef, cc_write, _("Save document (and force overwriting)")); - girara_inputbar_command_add(gsession, "export", NULL, cmd_export, cc_export, _("Save attachments")); + girara_inputbar_command_add(gsession, "bmark", NULL, cmd_bookmark_create, NULL, _("Add a bookmark")); + girara_inputbar_command_add(gsession, "bdelete", NULL, cmd_bookmark_delete, cc_bookmarks, _("Delete a bookmark")); + girara_inputbar_command_add(gsession, "blist", NULL, cmd_bookmark_open, cc_bookmarks, _("List all bookmarks")); + girara_inputbar_command_add(gsession, "close", NULL, cmd_close, NULL, _("Close current file")); + girara_inputbar_command_add(gsession, "info", NULL, cmd_info, NULL, _("Show file information")); + girara_inputbar_command_add(gsession, "help", NULL, cmd_help, NULL, _("Show help")); + girara_inputbar_command_add(gsession, "open", "o", cmd_open, cc_open, _("Open document")); + girara_inputbar_command_add(gsession, "quit", "q", cmd_quit, NULL, _("Close zathura")); + girara_inputbar_command_add(gsession, "print", NULL, cmd_print, NULL, _("Print document")); + girara_inputbar_command_add(gsession, "write", NULL, cmd_save, cc_write, _("Save document")); + girara_inputbar_command_add(gsession, "write!", NULL, cmd_savef, cc_write, _("Save document (and force overwriting)")); + girara_inputbar_command_add(gsession, "export", NULL, cmd_export, cc_export, _("Save attachments")); girara_special_command_add(gsession, '/', cmd_search, true, FORWARD, NULL); girara_special_command_add(gsession, '?', cmd_search, true, BACKWARD, NULL);