mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-16 03:15:52 +01:00
Implement TOGGLE for sc_navigate_index
Closes: #396 Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
parent
f41d372f75
commit
f504da0dd1
3 changed files with 65 additions and 10 deletions
1
config.c
1
config.c
|
@ -452,6 +452,7 @@ config_load_default(zathura_t* zathura)
|
||||||
girara_argument_mapping_add(gsession, "expand", EXPAND);
|
girara_argument_mapping_add(gsession, "expand", EXPAND);
|
||||||
girara_argument_mapping_add(gsession, "expand-all", EXPAND_ALL);
|
girara_argument_mapping_add(gsession, "expand-all", EXPAND_ALL);
|
||||||
girara_argument_mapping_add(gsession, "select", SELECT);
|
girara_argument_mapping_add(gsession, "select", SELECT);
|
||||||
|
girara_argument_mapping_add(gsession, "toggle", TOGGLE);
|
||||||
girara_argument_mapping_add(gsession, "forward", FORWARD);
|
girara_argument_mapping_add(gsession, "forward", FORWARD);
|
||||||
girara_argument_mapping_add(gsession, "full-down", FULL_DOWN);
|
girara_argument_mapping_add(gsession, "full-down", FULL_DOWN);
|
||||||
girara_argument_mapping_add(gsession, "full-up", FULL_UP);
|
girara_argument_mapping_add(gsession, "full-up", FULL_UP);
|
||||||
|
|
14
shortcuts.c
14
shortcuts.c
|
@ -989,7 +989,7 @@ sc_navigate_index(girara_session_t* session, girara_argument_t* argument,
|
||||||
* moving anywhere. */
|
* moving anywhere. */
|
||||||
is_valid_path = gtk_tree_path_up(path) && (gtk_tree_path_get_depth(path) > 0);
|
is_valid_path = gtk_tree_path_up(path) && (gtk_tree_path_get_depth(path) > 0);
|
||||||
} else { /* row above */
|
} else { /* row above */
|
||||||
while(gtk_tree_view_row_expanded(tree_view, path)) {
|
while (gtk_tree_view_row_expanded(tree_view, path)) {
|
||||||
gtk_tree_model_get_iter(model, &iter, path);
|
gtk_tree_model_get_iter(model, &iter, path);
|
||||||
/* select last child */
|
/* select last child */
|
||||||
gtk_tree_model_iter_nth_child(model, &child_iter, &iter,
|
gtk_tree_model_iter_nth_child(model, &child_iter, &iter,
|
||||||
|
@ -1035,13 +1035,23 @@ sc_navigate_index(girara_session_t* session, girara_argument_t* argument,
|
||||||
path = gtk_tree_path_new_first();
|
path = gtk_tree_path_new_first();
|
||||||
gtk_tree_view_set_cursor(tree_view, path, NULL, FALSE);
|
gtk_tree_view_set_cursor(tree_view, path, NULL, FALSE);
|
||||||
break;
|
break;
|
||||||
|
case TOGGLE:
|
||||||
|
gtk_tree_model_get_iter(model, &iter, path);
|
||||||
|
if (gtk_tree_model_iter_has_child(model, &iter) == TRUE) {
|
||||||
|
if (gtk_tree_view_row_expanded(tree_view, path) == TRUE) {
|
||||||
|
gtk_tree_view_collapse_row(tree_view, path);
|
||||||
|
} else {
|
||||||
|
gtk_tree_view_expand_row(tree_view, path, FALSE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case SELECT:
|
case SELECT:
|
||||||
cb_index_row_activated(tree_view, path, NULL, zathura);
|
cb_index_row_activated(tree_view, path, NULL, zathura);
|
||||||
gtk_tree_path_free(path);
|
gtk_tree_path_free(path);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_valid_path) {
|
if (is_valid_path == TRUE) {
|
||||||
gtk_tree_view_set_cursor(tree_view, path, NULL, FALSE);
|
gtk_tree_view_set_cursor(tree_view, path, NULL, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
60
zathura.h
60
zathura.h
|
@ -10,14 +10,58 @@
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN, BOTTOM, TOP, HIDE, HIGHLIGHT,
|
enum {
|
||||||
DELETE_LAST_WORD, DELETE_LAST_CHAR, DEFAULT, ERROR, WARNING, NEXT_GROUP,
|
NEXT,
|
||||||
PREVIOUS_GROUP, ZOOM_IN, ZOOM_OUT, ZOOM_ORIGINAL, ZOOM_SPECIFIC, FORWARD,
|
PREVIOUS,
|
||||||
BACKWARD, CONTINUOUS, DELETE_LAST, EXPAND, EXPAND_ALL, COLLAPSE_ALL, COLLAPSE,
|
LEFT,
|
||||||
SELECT, GOTO_DEFAULT, GOTO_LABELS, GOTO_OFFSET, HALF_UP, HALF_DOWN, FULL_UP,
|
RIGHT,
|
||||||
FULL_DOWN, HALF_LEFT, HALF_RIGHT, FULL_LEFT, FULL_RIGHT, NEXT_CHAR,
|
UP,
|
||||||
PREVIOUS_CHAR, DELETE_TO_LINE_START, APPEND_FILEPATH, ROTATE_CW, ROTATE_CCW,
|
DOWN,
|
||||||
PAGE_BOTTOM, PAGE_TOP };
|
BOTTOM,
|
||||||
|
TOP,
|
||||||
|
HIDE,
|
||||||
|
HIGHLIGHT,
|
||||||
|
DELETE_LAST_WORD,
|
||||||
|
DELETE_LAST_CHAR,
|
||||||
|
DEFAULT,
|
||||||
|
ERROR,
|
||||||
|
WARNING,
|
||||||
|
NEXT_GROUP,
|
||||||
|
PREVIOUS_GROUP,
|
||||||
|
ZOOM_IN,
|
||||||
|
ZOOM_OUT,
|
||||||
|
ZOOM_ORIGINAL,
|
||||||
|
ZOOM_SPECIFIC,
|
||||||
|
FORWARD,
|
||||||
|
BACKWARD,
|
||||||
|
CONTINUOUS,
|
||||||
|
DELETE_LAST,
|
||||||
|
EXPAND,
|
||||||
|
EXPAND_ALL,
|
||||||
|
COLLAPSE_ALL,
|
||||||
|
COLLAPSE,
|
||||||
|
TOGGLE,
|
||||||
|
SELECT,
|
||||||
|
GOTO_DEFAULT,
|
||||||
|
GOTO_LABELS,
|
||||||
|
GOTO_OFFSET,
|
||||||
|
HALF_UP,
|
||||||
|
HALF_DOWN,
|
||||||
|
FULL_UP,
|
||||||
|
FULL_DOWN,
|
||||||
|
HALF_LEFT,
|
||||||
|
HALF_RIGHT,
|
||||||
|
FULL_LEFT,
|
||||||
|
FULL_RIGHT,
|
||||||
|
NEXT_CHAR,
|
||||||
|
PREVIOUS_CHAR,
|
||||||
|
DELETE_TO_LINE_START,
|
||||||
|
APPEND_FILEPATH,
|
||||||
|
ROTATE_CW,
|
||||||
|
ROTATE_CCW,
|
||||||
|
PAGE_BOTTOM,
|
||||||
|
PAGE_TOP
|
||||||
|
};
|
||||||
|
|
||||||
/* unspecified page number */
|
/* unspecified page number */
|
||||||
enum {
|
enum {
|
||||||
|
|
Loading…
Reference in a new issue