summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Geddes <vgeddes@src.gnome.org>2007-07-10 23:26:52 +0000
committerVincent Geddes <vgeddes@src.gnome.org>2007-07-10 23:26:52 +0000
commiteabfc634c67bc70f1fff50f78720cce0d712e8b1 (patch)
treeeb4457d1df94c6e4c63b880154f96a7d195d666b
parent57f71bdbf50a280c2be45ce3d05ac776982cff7f (diff)
downloadglade-eabfc634c67bc70f1fff50f78720cce0d712e8b1.tar.gz
merge from changes from trunk into branch
* merge from changes from trunk into branch svn path=/branches/BINDINGS/; revision=1445
-rw-r--r--ChangeLog6
-rw-r--r--gladeui/glade-project.c48
2 files changed, 38 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index e5ddb270..6adbf26d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-07-10 Vincent Geddes <vgeddes@gnome.org>
+
+ * gladeui/glade-project: fix bug with regards to setting the
+ project as unmodified when undoing the command that caused
+ the first unsaved command.
+
2007-07-09 Vincent Geddes <vgeddes@gnome.org>
* configure.ac, src/main.c: Initialize threading system (#406039).
diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c
index 58a240f7..31c8ba12 100644
--- a/gladeui/glade-project.c
+++ b/gladeui/glade-project.c
@@ -245,28 +245,46 @@ glade_project_get_property (GObject *object,
}
}
+/**
+ * glade_project_set_modified:
+ * @project: a #GladeProject
+ * @modified: Whether the project should be set as modified or not
+ * @modification: The first #GladeCommand which caused the project to have unsaved changes
+ *
+ * Set's whether a #GladeProject should be flagged as modified or not. This is useful
+ * for indicating that a project has unsaved changes. If @modified is #TRUE, then
+ * @modification will be recorded as the first change which caused the project to
+ * have unsaved changes. @modified is #FALSE then @modification will be ignored.
+ *
+ * If @project is already flagged as modified, then calling this method with
+ * @modified as #TRUE, will have no effect. Likewise, if @project is unmodified
+ * then calling this method with @modified as #FALSE, will have no effect.
+ *
+ */
static void
-glade_project_set_modified (GladeProject *project, gboolean modified)
+glade_project_set_modified (GladeProject *project,
+ gboolean modified,
+ GladeCommand *modification)
{
GladeProjectPrivate *priv = project->priv;
if (priv->modified != modified)
{
priv->modified = !priv->modified;
-
+
if (priv->modified)
{
g_assert (priv->first_modification == NULL);
- priv->first_modification = glade_project_next_undo_item (project);
+ g_assert (modification != NULL);
+ priv->first_modification = modification;
}
else
{
g_assert (priv->first_modification != NULL);
priv->first_modification = NULL;
}
-
+
g_object_notify (G_OBJECT (project), "modified");
-
}
}
@@ -304,14 +322,6 @@ glade_project_undo_impl (GladeProject *project)
glade_project_signals [CHANGED],
0, cmd, FALSE);
- /* set "modified" to FALSE if this undo command caused
- * any unsaved changes.
- */
- if (cmd == project->priv->first_modification)
- {
- glade_project_set_modified (project, FALSE);
- }
-
if ((next_cmd = glade_project_next_undo_item (project)) != NULL &&
(next_cmd->group_id == 0 || next_cmd->group_id != cmd->group_id))
break;
@@ -431,9 +441,15 @@ glade_project_changed_impl (GladeProject *project,
GladeCommand *command,
gboolean forward)
{
- if (!project->priv->modified && !project->priv->loading)
+ if (!project->priv->loading)
{
- glade_project_set_modified (project, TRUE);
+ /* if this command is the first modification to cause the project
+ * to have unsaved changes, then we can now flag the project as unmodified
+ */
+ if (command == project->priv->first_modification)
+ glade_project_set_modified (project, FALSE, NULL);
+ else
+ glade_project_set_modified (project, TRUE, command);
}
glade_app_update_ui ();
}
@@ -1766,7 +1782,7 @@ glade_project_save (GladeProject *project, const gchar *path, GError **error)
project->priv->mtime = glade_util_get_file_mtime (project->priv->path, NULL);
- glade_project_set_modified (project, FALSE);
+ glade_project_set_modified (project, FALSE, NULL);
if (project->priv->unsaved_number > 0)
{