summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--git-hist.c6
-rw-r--r--git-hist.h3
-rw-r--r--gui/fmt-pango.c (renamed from fmt-pango.c)4
-rw-r--r--gui/fmt-pango.h (renamed from fmt-pango.h)8
-rw-r--r--gui/gui.c5
-rw-r--r--gui/over.c2
-rw-r--r--main.c2
8 files changed, 17 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index 9c4f74e..05e9cf9 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@
NAME = eeshow
OBJS = main.o sch-parse.o sch-render.o lib-parse.o lib-render.o \
- gui/gui.o gui/over.o gui/style.o gui/aoi.o fmt-pango.o \
+ gui/gui.o gui/over.o gui/style.o gui/aoi.o gui/fmt-pango.o \
file.o git-util.o git-file.o git-hist.o delta.o \
style.o fig.o record.o cro.o diff.o gfx.o dwg.o text.o misc.o diag.o
diff --git a/git-hist.c b/git-hist.c
index 03d02d4..6f18fa8 100644
--- a/git-hist.c
+++ b/git-hist.c
@@ -18,7 +18,6 @@
#include "util.h"
#include "diag.h"
-#include "fmt-pango.h" /* for vcs_long_for_pango */
#include "git-util.h"
#include "git-file.h"
#include "git-hist.h"
@@ -211,7 +210,8 @@ const char *vcs_git_summary(struct hist *h)
* the very specific constraints imposed by the markup format of Pango.
*/
-char *vcs_git_long_for_pango(struct hist *h)
+char *vcs_git_long_for_pango(struct hist *h,
+ char *(*formatter)(const char *fmt, ...))
{
const git_error *e;
git_buf buf = { 0 };
@@ -225,7 +225,7 @@ char *vcs_git_long_for_pango(struct hist *h)
goto fail;
commit_time = git_commit_time(h->commit);
sig = git_commit_committer(h->commit);
- s = fmt_pango("<b>%s</b> %s%s &lt;%s&gt;<small>\n%s</small>",
+ s = formatter("<b>%s</b> %s%s &lt;%s&gt;<small>\n%s</small>",
buf.ptr, ctime(&commit_time), sig->name, sig->email,
git_commit_summary(h->commit));
git_buf_free(&buf);
diff --git a/git-hist.h b/git-hist.h
index 8caebfc..c26cf5d 100644
--- a/git-hist.h
+++ b/git-hist.h
@@ -35,7 +35,8 @@ bool vcs_git_try(const char *path);
struct hist *vcs_git_hist(const char *path);
char *vcs_git_get_rev(struct hist *h);
const char *vcs_git_summary(struct hist *hist);
-char *vcs_git_long_for_pango(struct hist *hist);
+char *vcs_git_long_for_pango(struct hist *hist,
+ char *(*formatter)(const char *fmt, ...));
void hist_iterate(struct hist *h,
void (*fn)(void *user, struct hist *h), void *user);
void dump_hist(struct hist *h);
diff --git a/fmt-pango.c b/gui/fmt-pango.c
index d877b61..96deba4 100644
--- a/fmt-pango.c
+++ b/gui/fmt-pango.c
@@ -1,5 +1,5 @@
/*
- * fmt-pango.c - Format strings for Pango markup
+ * gui/fmt-pango.c - Format strings for Pango markup
*
* Written 2016 by Werner Almesberger
* Copyright 2016 by Werner Almesberger
@@ -20,7 +20,7 @@
#include "util.h"
#include "diag.h"
-#include "fmt-pango.h"
+#include "gui/fmt-pango.h"
unsigned vsfmt_pango(char *buf, const char *fmt, va_list ap)
diff --git a/fmt-pango.h b/gui/fmt-pango.h
index 43628e4..cf4c315 100644
--- a/fmt-pango.h
+++ b/gui/fmt-pango.h
@@ -1,5 +1,5 @@
/*
- * fmt-pango.h - Format strings for Pango markup
+ * gui/fmt-pango.h - Format strings for Pango markup
*
* Written 2016 by Werner Almesberger
* Copyright 2016 by Werner Almesberger
@@ -11,8 +11,8 @@
*/
-#ifndef FMT_PANGO_H
-#define FMT_PANGO_H
+#ifndef GUI_FMT_PANGO_H
+#define GUI_FMT_PANGO_H
#include <stdarg.h>
@@ -22,4 +22,4 @@ char *vfmt_pango(const char *fmt, va_list ap);
char *fmt_pango(const char *fmt, ...)
__attribute__((format(printf, 1, 2)));
-#endif /* !FMT_PANGO_H */
+#endif /* !GUI_FMT_PANGO_H */
diff --git a/gui/gui.c b/gui/gui.c
index 5ed3e82..8bde583 100644
--- a/gui/gui.c
+++ b/gui/gui.c
@@ -38,6 +38,7 @@
#include "delta.h"
#include "diff.h"
#include "dwg.h"
+#include "gui/fmt-pango.h"
#include "gui/aoi.h"
#include "gui/style.h"
#include "gui/over.h"
@@ -489,7 +490,7 @@ static bool hover_history(void *user, bool on)
char *s;
if (on) {
- s = vcs_git_long_for_pango(h->vcs_hist);
+ s = vcs_git_long_for_pango(h->vcs_hist, fmt_pango);
overlay_text_raw(h->over, s);
free(s);
} else {
@@ -680,7 +681,7 @@ static bool show_history_details(void *user, bool on)
char *s;
if (on) {
- s = vcs_git_long_for_pango(h->vcs_hist);
+ s = vcs_git_long_for_pango(h->vcs_hist, fmt_pango);
overlay_text_raw(h->over, s);
free(s);
} else {
diff --git a/gui/over.c b/gui/over.c
index 7ee7a91..aedfd92 100644
--- a/gui/over.c
+++ b/gui/over.c
@@ -31,7 +31,7 @@
#include <pango/pangocairo.h>
#include "util.h"
-#include "fmt-pango.h"
+#include "gui/fmt-pango.h"
#include "gui/aoi.h"
#include "gui/style.h"
#include "gui/over.h"
diff --git a/main.c b/main.c
index d6ff527..e88f0f1 100644
--- a/main.c
+++ b/main.c
@@ -28,7 +28,7 @@
#include "file.h"
#include "lib.h"
#include "sch.h"
-#include "fmt-pango.h"
+#include "gui/fmt-pango.h"
#include "git-hist.h"
#include "gui/gui.h"
#include "main.h"