From fd004fdb1b4d26dd5692754b381cf32740fed20c Mon Sep 17 00:00:00 2001 From: neldoreth Date: Sun, 3 Jan 2010 16:25:51 +0100 Subject: [PATCH] Added export function and export completion --- config.def.h | 1 + zathura.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/config.def.h b/config.def.h index 846595d..921c061 100644 --- a/config.def.h +++ b/config.def.h @@ -88,6 +88,7 @@ InputbarShortcut inputbar_shortcuts[] = { Command commands[] = { /* command, abbreviation, function, completion, description */ {"close", "c", cmd_close, 0, "Close current file" }, + {"export", "e", cmd_export, cc_export, "Export images or attached files" }, {"info", "i", cmd_info, 0, "Show information about the document" }, {"open", "o", cmd_open, cc_open, "Open a file" }, {"print", "p", cmd_print, cc_print, "Print the document" }, diff --git a/zathura.c b/zathura.c index ef28ac8..b07c5b7 100644 --- a/zathura.c +++ b/zathura.c @@ -247,6 +247,7 @@ void isc_string_manipulation(Argument*); /* command declarations */ gboolean cmd_close(int, char**); +gboolean cmd_export(int, char**); gboolean cmd_info(int, char**); gboolean cmd_open(int, char**); gboolean cmd_print(int, char**); @@ -256,6 +257,7 @@ gboolean cmd_quit(int, char**); gboolean cmd_save(int, char**); /* completion commands */ +Completion* cc_export(char*); Completion* cc_open(char*); Completion* cc_print(char*); Completion* cc_set(char*); @@ -1416,6 +1418,12 @@ cmd_close(int argc, char** argv) return TRUE; } +gboolean +cmd_export(int argc, char** argv) +{ + return TRUE; +} + gboolean cmd_info(int argc, char** argv) { @@ -1673,6 +1681,38 @@ cmd_save(int argc, char** argv) } /* completion command implementation */ +Completion* +cc_export(char* input) +{ + /* init completion group */ + Completion *completion = malloc(sizeof(Completion)); + CompletionGroup* group = malloc(sizeof(CompletionGroup)); + + group->value = NULL; + group->next = NULL; + group->elements = NULL; + + completion->groups = group; + + /* export images */ + CompletionElement *export_images = malloc(sizeof(CompletionElement)); + export_images->value = "images"; + export_images->description = "Export images"; + export_images->next = NULL; + + /* export attachmants */ + CompletionElement *export_attachments = malloc(sizeof(CompletionElement)); + export_attachments->value = "attachments"; + export_attachments->description = "Export attachments"; + export_attachments->next = NULL; + + /* connect */ + group->elements = export_attachments; + export_attachments->next = export_images; + + return completion; +} + Completion* cc_open(char* input) {