From 65d9d488452c6d13d8db7812dfd09be0e985876d Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 15 Sep 2012 05:29:12 -0700 Subject: Display current filename in windows title This seems to make sense since we have a pretty strong concept of the "active file" that we are working on. Signed-off-by: Dirk Hohndel --- info.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'info.c') diff --git a/info.c b/info.c index 34ddfa923..a4d4d4179 100644 --- a/info.c +++ b/info.c @@ -112,9 +112,15 @@ void show_dive_info(struct dive *dive) { const char *text; char buffer[80]; + char title[80]; if (!dive) { - gtk_window_set_title(GTK_WINDOW(main_window), "Subsurface"); + if (existing_filename) { + snprintf(title, 80, "Subsurface: %s", g_path_get_basename(existing_filename)); + gtk_window_set_title(GTK_WINDOW(main_window), title); + } else { + gtk_window_set_title(GTK_WINDOW(main_window), "Subsurface"); + } SET_TEXT_VALUE(divemaster); SET_TEXT_VALUE(buddy); SET_TEXT_VALUE(location); @@ -136,8 +142,14 @@ void show_dive_info(struct dive *dive) text = buffer; if (!dive->number) text += 10; /* Skip the "Dive #0 - " part */ - gtk_window_set_title(GTK_WINDOW(main_window), text); + /* put it all together */ + if (existing_filename) { + snprintf(title, 80, "%s: %s", g_path_get_basename(existing_filename), text); + gtk_window_set_title(GTK_WINDOW(main_window), title); + } else { + gtk_window_set_title(GTK_WINDOW(main_window), text); + } SET_TEXT_VALUE(divemaster); SET_TEXT_VALUE(buddy); SET_TEXT_VALUE(location); -- cgit v1.2.3-70-g09d2