gtk_statusbar_pop (GTK_STATUSBAR (window->sb), window->text_context);
}
+static void
+on_modified_changed (GtkTextBuffer *buffer, PsppireWindow *window)
+{
+ psppire_window_set_unsaved (window, gtk_text_buffer_get_modified (buffer));
+}
+
+
extern struct source_stream *the_source_stream ;
static void
g_signal_connect (window->buffer, "changed", G_CALLBACK (on_text_changed), window);
+ g_signal_connect (window->buffer, "modified-changed",
+ G_CALLBACK (on_modified_changed), window);
+
connect_help (xml);
gtk_container_add (GTK_CONTAINER (window), box);
static void
psppire_window_set_title (PsppireWindow *window)
{
- gchar *title =
- g_strdup_printf ( _("%s %s PSPPIRE %s"),
- window->basename, mdash, window->description);
+ GString *title = g_string_sized_new (80);
- gtk_window_set_title (GTK_WINDOW (window), title);
+ g_string_printf (title, _("%s %s PSPPIRE %s"),
+ window->basename, mdash, window->description);
- free (title);
+ if ( window->unsaved)
+ g_string_prepend_c (title, '*');
+
+ gtk_window_set_title (GTK_WINDOW (window), title->str);
+
+ g_string_free (title, TRUE);
}
static void
g_signal_connect (item, "activate", G_CALLBACK (menu_activate), key);
gtk_widget_show (item);
-
+
gtk_menu_shell_append (window->menu, item);
/* Set the state without emitting a signal */
"removed",
G_CALLBACK (remove_menuitem),
window);
+
+ window->unsaved = FALSE;
}
g_object_set (w, "filename", filename, NULL);
}
+void
+psppire_window_set_unsaved (PsppireWindow *w, gboolean unsaved)
+{
+ w->unsaved = unsaved;
+
+ psppire_window_set_title (w);
+}
+
\f
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2008 Free Software Foundation
+ Copyright (C) 2008, 2009 Free Software Foundation
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
guint insert_handler;
guint remove_handler;
+ gboolean unsaved;
};
struct _PsppireWindowClass
void psppire_window_minimise_all (void);
+void psppire_window_set_unsaved (PsppireWindow *, gboolean );
G_END_DECLS