From 410d0c590c9ce4892cf79c9eec8b01249229dfc4 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Sat, 7 Mar 2009 18:08:49 +0900 Subject: [PATCH] Rename identifier and add timestamp for unsaved flag. --- src/ui/gui/psppire-window.c | 14 ++++++++------ src/ui/gui/psppire-window.h | 4 +++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/ui/gui/psppire-window.c b/src/ui/gui/psppire-window.c index e03bd809..7a4f8cef 100644 --- a/src/ui/gui/psppire-window.c +++ b/src/ui/gui/psppire-window.c @@ -97,7 +97,7 @@ psppire_window_set_title (PsppireWindow *window) window->basename ? window->basename : "", mdash, window->description); - if (window->unsaved) + if (window->dirty) g_string_prepend_c (title, '*'); gtk_window_set_title (GTK_WINDOW (window), title->str); @@ -378,7 +378,7 @@ on_delete (PsppireWindow *w, GdkEvent *event, gpointer user_data) { PsppireWindowRegister *reg = psppire_window_register_new (); - if ( w->unsaved ) + if ( w->dirty ) { gint response = psppire_window_query_save (w); @@ -419,7 +419,7 @@ psppire_window_init (PsppireWindow *window) G_CALLBACK (remove_menuitem), window); - window->unsaved = FALSE; + window->dirty = FALSE; g_signal_connect_swapped (window, "delete-event", G_CALLBACK (on_delete), window); @@ -498,7 +498,9 @@ psppire_window_set_filename (PsppireWindow *w, const gchar *filename) void psppire_window_set_unsaved (PsppireWindow *w) { - w->unsaved = TRUE; + w->dirty = TRUE; + + g_get_current_time (&w->savetime); psppire_window_set_title (w); } @@ -506,7 +508,7 @@ psppire_window_set_unsaved (PsppireWindow *w) gboolean psppire_window_get_unsaved (PsppireWindow *w) { - return w->unsaved; + return w->dirty; } @@ -598,7 +600,7 @@ psppire_window_load (PsppireWindow *w, const gchar *file) if ( ok ) { add_most_recent (file, the_recent_mgr); - w->unsaved = FALSE; + w->dirty = FALSE; } else delete_recent (file, the_recent_mgr); diff --git a/src/ui/gui/psppire-window.h b/src/ui/gui/psppire-window.h index c7025b35..441e12af 100644 --- a/src/ui/gui/psppire-window.h +++ b/src/ui/gui/psppire-window.h @@ -72,7 +72,9 @@ struct _PsppireWindow guint insert_handler; guint remove_handler; - gboolean unsaved; + + gboolean dirty; + GTimeVal savetime; }; -- 2.30.2