summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-27 14:31:09 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-27 14:31:09 -0300
commit51a4e4d928c2ab9563e3ab62a68d20a9f5de7b5c (patch)
tree89302eb49f2b32b8a9b0d1eeedfb28f871d42bb8 /gui
parentb50be73df03140fd263119d39545b58d6954b561 (diff)
downloadeeshow-51a4e4d928c2ab9563e3ab62a68d20a9f5de7b5c.tar.gz
eeshow-51a4e4d928c2ab9563e3ab62a68d20a9f5de7b5c.tar.bz2
eeshow-51a4e4d928c2ab9563e3ab62a68d20a9f5de7b5c.zip
file/git-hist.c: introduce history descriptor to API, removing global "history"
This will be used for more things in the future.
Diffstat (limited to 'gui')
-rw-r--r--gui/common.h3
-rw-r--r--gui/gui.c14
-rw-r--r--gui/sheet.c2
3 files changed, 11 insertions, 8 deletions
diff --git a/gui/common.h b/gui/common.h
index 5148041..6ebc56b 100644
--- a/gui/common.h
+++ b/gui/common.h
@@ -80,7 +80,8 @@ struct gui {
int x, y; /* center, in eeschema coordinates */
struct gui_hist *hist; /* revision history; NULL if none */
- struct hist *vcs_hist; /* underlying VCS data; NULL if none */
+ struct history *vcs_history;
+ /* underlying VCS data; NULL if none */
enum gui_mode {
showing_sheet,
diff --git a/gui/gui.c b/gui/gui.c
index f203f6c..8cb17d8 100644
--- a/gui/gui.c
+++ b/gui/gui.c
@@ -391,8 +391,9 @@ static void get_revisions(struct gui *gui, const struct file_names *fn,
.limit = limit ? limit < 0 ? -limit : limit : -1,
};
- if (gui->vcs_hist)
- hist_iterate(gui->vcs_hist, add_hist, &add_hist_ctx);
+ if (gui->vcs_history)
+ hist_iterate(gui->vcs_history, vcs_head(gui->vcs_history),
+ add_hist, &add_hist_ctx);
else
add_hist(&add_hist_ctx, NULL);
}
@@ -412,15 +413,16 @@ static void count_history(void *user, struct hist *h)
static void get_history(struct gui *gui, const char *sch_name, int limit)
{
if (!vcs_git_try(sch_name)) {
- gui->vcs_hist = NULL;
+ gui->vcs_history = NULL;
return;
}
- gui->vcs_hist = vcs_git_hist(sch_name);
+ gui->vcs_history = vcs_git_history(sch_name);
if (limit)
gui->hist_size = limit > 0 ? limit : -limit;
else
- hist_iterate(gui->vcs_hist, count_history, gui);
+ hist_iterate(gui->vcs_history, vcs_head(gui->vcs_history),
+ count_history, gui);
}
@@ -448,7 +450,7 @@ int run_gui(const struct file_names *fn, bool recurse, int limit)
struct gui gui = {
.scale = 1 / 16.0,
.hist = NULL,
- .vcs_hist = NULL,
+ .vcs_history = NULL,
.mode = showing_sheet,
.sheet_overlays = NULL,
.hist_overlays = NULL,
diff --git a/gui/sheet.c b/gui/sheet.c
index f39bbd8..b1cb67c 100644
--- a/gui/sheet.c
+++ b/gui/sheet.c
@@ -364,7 +364,7 @@ void go_to_sheet(struct gui *gui, struct gui_sheet *sheet)
gui->curr_sheet = sheet;
if (gui->old_hist)
render_delta(gui);
- if (gui->vcs_hist)
+ if (gui->vcs_history && vcs_head(gui->vcs_history))
do_revision_overlays(gui);
do_sheet_overlays(gui);
zoom_to_extents(gui);