Rename identifier and add timestamp for unsaved flag.
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 7 Mar 2009 09:08:49 +0000 (18:08 +0900)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 7 Mar 2009 09:08:49 +0000 (18:08 +0900)
src/ui/gui/psppire-window.c
src/ui/gui/psppire-window.h

index e03bd809ab03a97375c2a93f50f57cd6b4b5df6e..7a4f8cefbd16885b6d983410db4941cca29251f3 100644 (file)
@@ -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);
index c7025b355a3b2fe1f9e556f86fcf64e3071673c0..441e12af3f2454eaa7c3aae16e5fba181e9343b7 100644 (file)
@@ -72,7 +72,9 @@ struct _PsppireWindow
 
   guint insert_handler;
   guint remove_handler;
-  gboolean unsaved;
+
+  gboolean dirty;
+  GTimeVal savetime;
 };