Auto-refresh views when changes are detected in the repository
[tig.git] / include / tig / watch.h
blobef43c91d9d83b0addc35e940d9c7e6edad7f9dc2
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 #ifndef TIG_WATCH_H
15 #define TIG_WATCH_H
17 #include "tig/tig.h"
18 #include "tig/types.h"
20 enum watch_event {
21 WATCH_EVENT_SWITCH_VIEW,
22 WATCH_EVENT_AFTER_EXTERNAL,
23 WATCH_EVENT_PERIODIC,
26 enum watch_trigger {
27 WATCH_NONE = 0,
28 WATCH_INDEX_STAGED = 1 << 0,
29 WATCH_INDEX_UNSTAGED = 1 << 1,
30 WATCH_HEAD = 1 << 2,
31 WATCH_STASH = 1 << 3,
34 struct watch {
35 struct watch *next;
36 enum watch_trigger triggers;
37 bool dirty;
40 void watch_register(struct watch *watch, enum watch_trigger triggers);
41 void watch_unregister(struct watch *watch);
42 bool watch_dirty(struct watch *watch);
43 enum watch_trigger watch_update(enum watch_event event);
44 int watch_periodic(int interval);
46 #endif
47 /* vim: set ts=8 sw=8 noexpandtab: */