From 67fab71ed7f8e8a40d3918062da0c2de159f8e9e Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Fri, 19 Aug 2016 21:30:58 -0300 Subject: [PATCH] eeshow/gui/gui.c (gui): show build commit in window title --- eeshow/gui/gui.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eeshow/gui/gui.c b/eeshow/gui/gui.c index ec738ca..229a14d 100644 --- a/eeshow/gui/gui.c +++ b/eeshow/gui/gui.c @@ -17,13 +17,16 @@ * https://developer.gnome.org/gtk3/stable/gtk-migrating-2-to-3.html */ +#define _GNU_SOURCE /* for asprintf */ #include #include #include +#include #include #include +#include "version.h" #include "misc/util.h" #include "misc/diag.h" #include "file/git-hist.h" @@ -380,6 +383,7 @@ static void get_history(struct gui_ctx *ctx, const char *sch_name, int limit) int gui(unsigned n_args, char **args, bool recurse, int limit) { GtkWidget *window; + char *title; struct gui_ctx ctx = { .zoom = 4, /* scale by 1 / 16 */ .hist = NULL, @@ -403,7 +407,8 @@ int gui(unsigned n_args, char **args, bool recurse, int limit) gtk_container_add(GTK_CONTAINER(window), ctx.da); gtk_window_set_default_size(GTK_WINDOW(window), 640, 480); - gtk_window_set_title(GTK_WINDOW(window), "eeshow"); + if (asprintf(&title, "eeshow (rev %s)", version)) {}; + gtk_window_set_title(GTK_WINDOW(window), title); gtk_widget_set_events(ctx.da, GDK_EXPOSE | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);