#include <config.h>
+
#include <gtk/gtkstock.h>
#include <gtk/gtkmessagedialog.h>
#include <gtk/gtksignal.h>
static void psppire_window_init (PsppireWindow *window);
-static PsppireWindowClass *the_class;
static GObjectClass *parent_class;
GType
window->basename ? window->basename : "",
mdash, window->description);
- if ( window->unsaved)
+ if (window->unsaved)
g_string_prepend_c (title, '*');
gtk_window_set_title (GTK_WINDOW (window), title->str);
PROP_FILENAME,
filename_spec);
- the_class = class;
parent_class = g_type_class_peek_parent (class);
}
}
void
-psppire_window_set_unsaved (PsppireWindow *w, gboolean unsaved)
+psppire_window_set_unsaved (PsppireWindow *w)
{
- w->unsaved = unsaved;
+ w->unsaved = TRUE;
psppire_window_set_title (w);
}
i->save (w);
}
+extern GtkRecentManager *the_recent_mgr;
+
+static void add_most_recent (const char *file_name, GtkRecentManager *rm);
+static void delete_recent (const char *file_name, GtkRecentManager *rm);
+
+gboolean
+psppire_window_load (PsppireWindow *w, const gchar *file)
+{
+ gboolean ok;
+ PsppireWindowIface *i = PSPPIRE_WINDOW_MODEL_GET_IFACE (w);
+
+ g_assert (PSPPIRE_IS_WINDOW_MODEL (w));
+
+ g_assert (i);
+
+ g_return_val_if_fail (i->load, FALSE);
+
+ ok = i->load (w, file);
+
+ if ( ok )
+ {
+ add_most_recent (file, the_recent_mgr);
+ w->unsaved = FALSE;
+ }
+ else
+ delete_recent (file, the_recent_mgr);
+
+ psppire_window_set_title (w);
+
+ return ok;
+}
+
/* Puts FILE_NAME into the recent list.
If it's already in the list, it moves it to the top
*/
-void
+static void
add_most_recent (const char *file_name, GtkRecentManager *rm)
{
gchar *uri = g_filename_to_uri (file_name, NULL, NULL);
/*
If FILE_NAME exists in the recent list, then delete it.
*/
-void
+static void
delete_recent (const char *file_name, GtkRecentManager *rm)
{
gchar *uri = g_filename_to_uri (file_name, NULL, NULL);