From 53a01182a333defa9165f22a9435e500a8790b78 Mon Sep 17 00:00:00 2001 From: werner Date: Thu, 18 Feb 2010 14:03:14 +0000 Subject: [PATCH] Show fped's SVN revision in the title bar. - Makefile: pass SVN version and commit status to CPP - gui.c (gui_main): show SVN revision in the title bar, if available git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5845 99fdad57-331a-0410-800a-d7fa5415bdb3 --- Makefile | 7 ++++++- gui.c | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 583c1c0..cb64d02 100644 --- a/Makefile +++ b/Makefile @@ -37,13 +37,18 @@ LIBS_GTK = `pkg-config --libs gtk+-2.0` CFLAGS_WARN = -Wall -Wshadow -Wmissing-prototypes \ -Wmissing-declarations -Wno-format-zero-length -CFLAGS = -g -std=gnu99 $(CFLAGS_GTK) -DCPP='"cpp"' $(CFLAGS_WARN) +CFLAGS = -g -std=gnu99 $(CFLAGS_GTK) -DCPP='"cpp"' \ + -DSVN_VERSION='"$(SVN_VERSION)$(SVN_STATUS)"' $(CFLAGS_WARN) SLOPPY = -Wno-unused -Wno-implicit-function-declaration \ -Wno-missing-prototypes -Wno-missing-declarations LDLIBS = -lm -lfl $(LIBS_GTK) YACC = bison -y YYFLAGS = -v +SVN_VERSION=$(shell svn info | sed '/Last Changed Rev: /s///p;d') +SVN_STATUS=$(shell [ -z "`svn status -q`" ] || echo +) + + # ----- Verbosity control ----------------------------------------------------- CPP := $(CPP) # make sure changing CC won't affect CPP diff --git a/gui.c b/gui.c index 1c811cd..1665c54 100644 --- a/gui.c +++ b/gui.c @@ -314,7 +314,11 @@ int gui_main(void) root = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_position(GTK_WINDOW(root), GTK_WIN_POS_CENTER); gtk_window_set_default_size(GTK_WINDOW(root), 620, 460); - gtk_window_set_title(GTK_WINDOW(root), "fped"); + if (*SVN_VERSION) + gtk_window_set_title(GTK_WINDOW(root), + "fped (rev " SVN_VERSION ")"); + else + gtk_window_set_title(GTK_WINDOW(root), "fped"); /* get root->window */ gtk_widget_show_all(root);