summaryrefslogtreecommitdiffstats
path: root/info.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-09-17 21:27:43 -0400
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-09-17 21:44:28 -0400
commit3835faa8fb02df8edb299278f4258389d3e99bda (patch)
tree6ac1697a5f7343157f73ad5063b2cefa23395e20 /info.c
parentfebae4d165866ca4a4e28347aebe446d65ed44e5 (diff)
parentd7465129bb7fc912ec89671051192983b80711c4 (diff)
downloadsubsurface-3835faa8fb02df8edb299278f4258389d3e99bda.tar.gz
Merge branch 'defaultfile'
By now the default file code seems quite matured, so in preparation for 2.0 we'll bring it back into master. I made a few small clean-ups during the merge, but the merge itself is very much straight forward. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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);