From: Daniel Carl Date: Tue, 30 Jul 2013 21:12:47 +0000 (+0200) Subject: Allow to switch off queue feature via config.h. X-Git-Url: https://git.owens.tech/about.html/about.html/git?a=commitdiff_plain;h=c0ca690173cf62e3a861d45b06c5cbbfcef01851;p=vimb.git Allow to switch off queue feature via config.h. --- diff --git a/doc/vimb.1 b/doc/vimb.1 index d2d7572..f551d7a 100644 --- a/doc/vimb.1 +++ b/doc/vimb.1 @@ -240,7 +240,8 @@ Start hinting to open inputboxes or textareas with external editor. Start hinting to download hinted links into configured download directory. .TP .BI "hint-push [" QUERY "]" -Start hinting to push hinted URI into the read it later queue. +Start hinting to push hinted URI into the read it later queue. If PROJECT hab +been compiled with QUEUE feature. .SS Yank .TP @@ -330,14 +331,16 @@ page. .SS Queue The queue allows to mark URLs for later reding (something like a read it later -list). This list is shared between the single instances of PROJECT. +list). This list is shared between the single instances of PROJECT. Only +available if PROJECT has been compiled with QUEUE feature. .TP .BI "push [" URI ] -Push \fIURI\fP or if not given current URI into the queue. +Push \fIURI\fP or if not given +current URI into the queue. .TP .B pop -Open the oldest queue entry in current browser window and remove it from the -queue. +Open the oldest queue entry +in current browser window and remove it from the queue. .SS Misc .TP @@ -583,7 +586,8 @@ Start hinting to open editable form fileds with external editor. Start hinting to download the linkes resource. .TP .B ;\-p -Start hinting to push hinted URI into queue. +If PROJECT has been compiled with QUEUE feature. Start hinting to push hinted +URI into queue. .TP .B y Yank the URI or current page into clipboard. @@ -674,7 +678,8 @@ Holds the bookmarks saved with command `bookmark-add'. .RE .I $XDG_CONFIG_HOME/PROJECT/queue .RS -Holds the read it later queue filled by `hint-push' or `push'. +Holds the read it later queue filled by `hint-push' or `push' if PROJECT has +been compiled with QUEUE feature. .RE .I $XDG_CONFIG_HOME/PROJECT/scripts.js .RS diff --git a/src/bookmark.c b/src/bookmark.c index cdcdd78..330e196 100644 --- a/src/bookmark.c +++ b/src/bookmark.c @@ -148,6 +148,7 @@ gboolean bookmark_fill_completion(GtkListStore *store, const char *input) return found; } +#ifdef FEATURE_QUEUE /** * Push a uri to the end of the queue. * @@ -184,6 +185,7 @@ char *bookmark_queue_pop(void) } return uri; } +#endif /* FEATURE_QUEUE */ static GList *load(const char *file) { diff --git a/src/bookmark.h b/src/bookmark.h index c1986d4..8ecf929 100644 --- a/src/bookmark.h +++ b/src/bookmark.h @@ -23,7 +23,9 @@ gboolean bookmark_add(const char *uri, const char *title, const char *tags); gboolean bookmark_remove(const char *uri); gboolean bookmark_fill_completion(GtkListStore *store, const char *input); +#ifdef FEATURE_QUEUE gboolean bookmark_queue_push(const char *uri); char *bookmark_queue_pop(void); +#endif #endif /* end of include guard: _BOOKMARK_H */ diff --git a/src/command.c b/src/command.c index 82921c2..a770b2d 100644 --- a/src/command.c +++ b/src/command.c @@ -94,7 +94,9 @@ static CommandInfo cmd_list[] = { {"hint-image-tabopen", NULL, command_hints, {HINTS_TYPE_IMAGE | HINTS_PROCESS_OPEN | HINTS_OPEN_NEW}}, {"hint-editor", NULL, command_hints, {HINTS_TYPE_EDITABLE}}, {"hint-save", NULL, command_hints, {HINTS_TYPE_LINK | HINTS_PROCESS_SAVE}}, +#ifdef FEATURE_QUEUE {"hint-push", NULL, command_hints, {HINTS_TYPE_LINK | HINTS_PROCESS_PUSH}}, +#endif {"yank-uri", "yu", command_yank, {VB_CLIPBOARD_PRIMARY | VB_CLIPBOARD_SECONDARY | COMMAND_YANK_URI}}, {"yank-selection", "ys", command_yank, {VB_CLIPBOARD_PRIMARY | VB_CLIPBOARD_SECONDARY | COMMAND_YANK_SELECTION}}, {"search-forward", NULL, command_search, {VB_SEARCH_FORWARD}}, @@ -122,8 +124,10 @@ static CommandInfo cmd_list[] = { {"descent!", NULL, command_descent, {1}}, {"save", NULL, command_save, {COMMAND_SAVE_CURRENT}}, {"shellcmd", NULL, command_shellcmd, {0}}, +#ifdef FEATURE_QUEUE {"push", NULL, command_queue, {COMMAND_QUEUE_PUSH}}, {"pop", NULL, command_queue, {COMMAND_QUEUE_POP}}, +#endif }; static void editor_resume(GPid pid, int status, OpenEditorData *data); @@ -487,9 +491,12 @@ gboolean command_hints(const Arg *arg) prefix = ";y"; } else if (mode & HINTS_PROCESS_SAVE) { prefix = ";s"; - } else if (mode & HINTS_PROCESS_PUSH) { + } +#ifdef FEATURE_QUEUE + else if (mode & HINTS_PROCESS_PUSH) { prefix = ";p"; } +#endif break; case HINTS_TYPE_IMAGE: @@ -891,6 +898,7 @@ gboolean command_shellcmd(const Arg *arg) return false; } +#ifdef FEATURE_QUEUE gboolean command_queue(const Arg *arg) { gboolean res = false; @@ -915,6 +923,7 @@ gboolean command_queue(const Arg *arg) } return res; } +#endif gboolean command_editor(const Arg *arg) { diff --git a/src/command.h b/src/command.h index b12dccb..321c76d 100644 --- a/src/command.h +++ b/src/command.h @@ -44,10 +44,12 @@ enum { COMMAND_SAVE_URI }; +#ifdef FEATURE_QUEUE enum { COMMAND_QUEUE_PUSH, COMMAND_QUEUE_POP }; +#endif typedef gboolean (*Command)(const Arg *arg); @@ -86,6 +88,8 @@ gboolean command_nextprev(const Arg *arg); gboolean command_descent(const Arg *arg); gboolean command_save(const Arg *arg); gboolean command_shellcmd(const Arg *arg); +#ifdef FEATURE_QUEUE gboolean command_queue(const Arg *arg); +#endif #endif /* end of include guard: _COMMAND_H */ diff --git a/src/config.def.h b/src/config.def.h index e42a1f4..3fb4937 100644 --- a/src/config.def.h +++ b/src/config.def.h @@ -27,6 +27,7 @@ #define FEATURE_NO_SCROLLBARS /*#define FEATURE_GTK_PROGRESSBAR*/ #define FEATURE_TITLE_IN_COMPLETION +#define FEATURE_QUEUE /* time in seconds after that message will be removed from inputbox if the diff --git a/src/default.h b/src/default.h index 18c6065..c612fe0 100644 --- a/src/default.h +++ b/src/default.h @@ -68,7 +68,9 @@ static char *default_config[] = { "nmap ;I=hint-image-tabopen", "nmap ;e=hint-editor", "nmap ;s=hint-save", +#ifdef FEATURE_QUEUE "nmap ;p=hint-push", +#endif "nmap y=yank-uri", "nmap Y=yank-selection", "nmap p=open-clipboard", diff --git a/src/hints.c b/src/hints.c index a79ec62..007832a 100644 --- a/src/hints.c +++ b/src/hints.c @@ -169,11 +169,15 @@ static void run_script(char *js) a.s = v; a.i = COMMAND_SAVE_URI; command_save(&a); - } else if (mode & HINTS_PROCESS_PUSH) { + } +#ifdef FEATURE_QUEUE + else if (mode & HINTS_PROCESS_PUSH) { a.s = v; a.i = COMMAND_QUEUE_PUSH; command_queue(&a); - } else { + } +#endif + else { a.i = VB_CLIPBOARD_PRIMARY | VB_CLIPBOARD_SECONDARY; a.s = v; command_yank(&a); diff --git a/src/hints.h b/src/hints.h index 6f835b9..a2f5380 100644 --- a/src/hints.h +++ b/src/hints.h @@ -34,7 +34,9 @@ enum { HINTS_PROCESS_SAVE = (1 << 5), /* additional flag for HINTS_PROCESS_OPEN */ HINTS_OPEN_NEW = (1 << 6), +#ifdef FEATURE_QUEUE HINTS_PROCESS_PUSH = (1 << 7), +#endif }; void hints_init(WebKitWebFrame *frame); diff --git a/src/main.c b/src/main.c index c95256e..3f25eea 100644 --- a/src/main.c +++ b/src/main.c @@ -863,8 +863,10 @@ static void init_files(void) vb.files[FILES_BOOKMARK] = g_build_filename(path, "bookmark", NULL); util_create_file_if_not_exists(vb.files[FILES_BOOKMARK]); +#ifdef FEATURE_QUEUE vb.files[FILES_QUEUE] = g_build_filename(path, "queue", NULL); util_create_file_if_not_exists(vb.files[FILES_QUEUE]); +#endif vb.files[FILES_SCRIPT] = g_build_filename(path, "scripts.js", NULL); diff --git a/src/main.h b/src/main.h index 060aa5f..6e6854d 100644 --- a/src/main.h +++ b/src/main.h @@ -210,7 +210,9 @@ typedef enum { FILES_COMMAND, FILES_SEARCH, FILES_BOOKMARK, +#ifdef FEATURE_QUEUE FILES_QUEUE, +#endif FILES_USER_STYLE, FILES_LAST } VbFile;