Unify view refresh checking
[tig.git] / src / stash.c
blobd87bd45f90e1eca1e9a67fd2ae6083506f49df1f
1 /* Copyright (c) 2006-2014 Jonas Fonseca <jonas.fonseca@gmail.com>
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License as
5 * published by the Free Software Foundation; either version 2 of
6 * the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #include "tig/draw.h"
15 #include "tig/main.h"
17 static bool
18 stash_open(struct view *view, enum open_flags flags)
20 static const char *stash_argv[] = { "git", "stash", "list",
21 encoding_arg, "--no-color", "--pretty=raw", NULL };
22 struct main_state *state = view->private;
24 state->with_graph = FALSE;
25 return begin_update(view, NULL, stash_argv, flags | OPEN_RELOAD);
28 static void
29 stash_select(struct view *view, struct line *line)
31 main_select(view, line);
32 string_format(view->env->stash, "stash@{%d}", line->lineno - 1);
33 string_copy(view->ref, view->env->stash);
36 static struct view_ops stash_ops = {
37 "stash",
38 argv_env.stash,
39 VIEW_SEND_CHILD_ENTER | VIEW_REFRESH,
40 sizeof(struct main_state),
41 stash_open,
42 main_read,
43 view_column_draw,
44 main_request,
45 view_column_grep,
46 stash_select,
47 main_done,
48 view_column_bit(AUTHOR) | view_column_bit(COMMIT_TITLE) |
49 view_column_bit(DATE) | view_column_bit(ID) |
50 view_column_bit(LINE_NUMBER),
51 main_get_column_data,
54 DEFINE_VIEW(stash);
56 /* vim: set ts=8 sw=8 noexpandtab: */