From ad1aca588a29516896e0088c3c207127d732e3ce Mon Sep 17 00:00:00 2001 From: Harry Jeffery Date: Tue, 8 Dec 2015 15:43:08 +0000 Subject: Refactor imv_navigator interface --- src/navigator.h | 43 ++++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 27 deletions(-) (limited to 'src/navigator.h') diff --git a/src/navigator.h b/src/navigator.h index 4ed2523..5b1d4a1 100644 --- a/src/navigator.h +++ b/src/navigator.h @@ -28,47 +28,36 @@ struct imv_navigator { }; /* Initialises an instance of imv_navigator */ -void imv_init_navigator(struct imv_navigator *nav); +void imv_navigator_init(struct imv_navigator *nav); /* Cleans up all resources owned by a imv_navigator instance */ -void imv_destroy_navigator(struct imv_navigator *nav); +void imv_navigator_destroy(struct imv_navigator *nav); /* Adds the given path to the navigator's internal list. * If a directory is given, all files within that directory are added. - * An internal copy of path is made. */ -void imv_navigator_add_path(struct imv_navigator *nav, const char *path); - -/* Adds the given path to the navigator's internal list. - * If a directory is given, all files within that directory are added. - * Subdirectories are recursed into. An internal copy of path is made. */ -void imv_navigator_add_path_recursive(struct imv_navigator *nav, const char *path); + * An internal copy of path is made. + * If recursive is non-zero then subdirectories are recursed into. */ +void imv_navigator_add(struct imv_navigator *nav, const char *path, + int recursive); /* Returns a read-only reference to the current path. The pointer is only - * guaranteed to be valid until the next call to and imv_navigator method. - */ -const char *imv_navigator_get_current_path(struct imv_navigator *nav); - -/* Changes to the next path */ -void imv_navigator_next_path(struct imv_navigator *nav); - -/* Changes to the previous path */ -void imv_navigator_prev_path(struct imv_navigator *nav); + * guaranteed to be valid until the next call to an imv_navigator method. */ +const char *imv_navigator_selection(struct imv_navigator *nav); -/* Removes the currently selected path. The current selection is updated if - * necessary, based on the last direction the selection moved. */ -void imv_navigator_remove_current_path(struct imv_navigator *nav); +/* Change the currently selected path. dir = -1 for previous, 1 for next */ +void imv_navigator_select_rel(struct imv_navigator *nav, int dir); -/* Removes the given path if it exists. The current selection is updated if - * necessary, based on the last direction the selection moved. */ -void imv_navigator_remove_path(struct imv_navigator *nav, const char *path); +/* Removes the given path. The current selection is updated if necessary, + * based on the last direction the selection moved. */ +void imv_navigator_remove(struct imv_navigator *nav, const char *path); -/* Set the current path to the given path if it exists. */ -void imv_navigator_set_path(struct imv_navigator *nav, const int path); +/* Select the given path if it exists. */ +void imv_navigator_select_str(struct imv_navigator *nav, const int path); /* Return the index of the path given. Returns -1 if not found. */ int imv_navigator_find_path(struct imv_navigator *nav, const char *path); /* Returns 1 if the currently selected path has changed since last called */ -int imv_navigator_has_changed(struct imv_navigator *nav); +int imv_navigator_poll_changed(struct imv_navigator *nav); #endif -- cgit v1.2.3