Merge pull request #457 from vivien/text-variable
[tig.git] / include / tig / watch.h
blob79ee97618048781d5ff10246c9afd8c72e033a2e
1 /* Copyright (c) 2006-2015 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_COMMAND,
23 WATCH_EVENT_LOAD,
24 WATCH_EVENT_PERIODIC,
27 enum watch_trigger {
28 WATCH_NONE = 0,
29 WATCH_INDEX_STAGED_YES = 1 << 0,
30 WATCH_INDEX_STAGED_NO = 1 << 1,
31 WATCH_INDEX_UNSTAGED_YES = 1 << 2,
32 WATCH_INDEX_UNSTAGED_NO = 1 << 3,
33 WATCH_HEAD = 1 << 4,
34 WATCH_STASH = 1 << 5,
35 WATCH_REFS = 1 << 6,
37 WATCH_INDEX_STAGED = WATCH_INDEX_STAGED_YES | WATCH_INDEX_STAGED_NO,
38 WATCH_INDEX_UNSTAGED = WATCH_INDEX_UNSTAGED_YES | WATCH_INDEX_UNSTAGED_NO,
39 WATCH_INDEX = WATCH_INDEX_STAGED | WATCH_INDEX_UNSTAGED,
42 struct watch {
43 struct watch *next;
44 enum watch_trigger triggers;
45 enum watch_trigger changed;
46 enum watch_trigger state;
49 void watch_register(struct watch *watch, enum watch_trigger triggers);
50 void watch_unregister(struct watch *watch);
51 bool watch_dirty(struct watch *watch);
52 enum watch_trigger watch_update(enum watch_event event);
53 enum watch_trigger watch_update_single(struct watch *watch, enum watch_event event);
54 void watch_apply(struct watch *source, enum watch_trigger changed);
55 int watch_periodic(int interval);
57 #endif
58 /* vim: set ts=8 sw=8 noexpandtab: */