mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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 <dirk@hohndel.org>
This commit is contained in:
parent
1771500078
commit
65d9d48845
3 changed files with 16 additions and 4 deletions
1
dive.h
1
dive.h
|
@ -463,6 +463,7 @@ const char *monthname(int mon);
|
||||||
extern const char *star_strings[];
|
extern const char *star_strings[];
|
||||||
|
|
||||||
extern const char *default_filename;
|
extern const char *default_filename;
|
||||||
|
extern char *existing_filename;
|
||||||
extern const char *subsurface_default_filename(void);
|
extern const char *subsurface_default_filename(void);
|
||||||
#define AIR_PERMILLE 209
|
#define AIR_PERMILLE 209
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ GtkWidget *vpane, *hpane;
|
||||||
GtkWidget *notebook;
|
GtkWidget *notebook;
|
||||||
|
|
||||||
int error_count;
|
int error_count;
|
||||||
|
char *existing_filename;
|
||||||
const char *divelist_font;
|
const char *divelist_font;
|
||||||
const char *default_filename;
|
const char *default_filename;
|
||||||
|
|
||||||
|
@ -81,7 +81,6 @@ void repaint_dive(void)
|
||||||
gtk_widget_queue_draw(dive_profile);
|
gtk_widget_queue_draw(dive_profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *existing_filename;
|
|
||||||
static gboolean need_icon = TRUE;
|
static gboolean need_icon = TRUE;
|
||||||
|
|
||||||
static void on_info_bar_response(GtkWidget *widget, gint response,
|
static void on_info_bar_response(GtkWidget *widget, gint response,
|
||||||
|
|
16
info.c
16
info.c
|
@ -112,9 +112,15 @@ void show_dive_info(struct dive *dive)
|
||||||
{
|
{
|
||||||
const char *text;
|
const char *text;
|
||||||
char buffer[80];
|
char buffer[80];
|
||||||
|
char title[80];
|
||||||
|
|
||||||
if (!dive) {
|
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(divemaster);
|
||||||
SET_TEXT_VALUE(buddy);
|
SET_TEXT_VALUE(buddy);
|
||||||
SET_TEXT_VALUE(location);
|
SET_TEXT_VALUE(location);
|
||||||
|
@ -136,8 +142,14 @@ void show_dive_info(struct dive *dive)
|
||||||
text = buffer;
|
text = buffer;
|
||||||
if (!dive->number)
|
if (!dive->number)
|
||||||
text += 10; /* Skip the "Dive #0 - " part */
|
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(divemaster);
|
||||||
SET_TEXT_VALUE(buddy);
|
SET_TEXT_VALUE(buddy);
|
||||||
SET_TEXT_VALUE(location);
|
SET_TEXT_VALUE(location);
|
||||||
|
|
Loading…
Add table
Reference in a new issue