1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-23 01:51:33 +02:00

eeshow/gui/gui.c (gui): show build commit in window title

This commit is contained in:
Werner Almesberger 2016-08-19 21:30:58 -03:00
parent 6b901399ce
commit 67fab71ed7

View File

@ -17,13 +17,16 @@
* https://developer.gnome.org/gtk3/stable/gtk-migrating-2-to-3.html * https://developer.gnome.org/gtk3/stable/gtk-migrating-2-to-3.html
*/ */
#define _GNU_SOURCE /* for asprintf */
#include <stddef.h> #include <stddef.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "version.h"
#include "misc/util.h" #include "misc/util.h"
#include "misc/diag.h" #include "misc/diag.h"
#include "file/git-hist.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) int gui(unsigned n_args, char **args, bool recurse, int limit)
{ {
GtkWidget *window; GtkWidget *window;
char *title;
struct gui_ctx ctx = { struct gui_ctx ctx = {
.zoom = 4, /* scale by 1 / 16 */ .zoom = 4, /* scale by 1 / 16 */
.hist = NULL, .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_container_add(GTK_CONTAINER(window), ctx.da);
gtk_window_set_default_size(GTK_WINDOW(window), 640, 480); 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, gtk_widget_set_events(ctx.da,
GDK_EXPOSE | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); GDK_EXPOSE | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);