summaryrefslogtreecommitdiffstats
path: root/info.c
diff options
context:
space:
mode:
Diffstat (limited to 'info.c')
-rw-r--r--info.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/info.c b/info.c
index e9cd3c812..3f7bbcd58 100644
--- a/info.c
+++ b/info.c
@@ -112,6 +112,23 @@ void show_dive_info(struct dive *dive)
{
const char *text;
char buffer[80];
+ char title[80];
+
+ if (!dive) {
+ 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);
+ SET_TEXT_VALUE(suit);
+ gtk_entry_set_text(rating, star_strings[0]);
+ gtk_text_buffer_set_text(gtk_text_view_get_buffer(notes), "", -1);
+ return;
+ }
/* dive number and location (or lacking that, the date) go in the window title */
text = dive->location;
@@ -125,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);