Commit 370ad0ce authored by Tristan Van Berkom's avatar Tristan Van Berkom

Applied patch from Pavel Kostyuchenko to fix project modified state flag


	* gladeui/glade-property.c: Applied patch from Pavel Kostyuchenko to fix project
	  modified state flag glitches (bug 532017).


svn path=/trunk/; revision=1820
parent 85c334e5
......@@ -6,6 +6,9 @@
* gladeui/glade-property.c, gladeui/glade-property-class.c: Applied patch from
Pavel Kostyuchenko to unify duplicate implementation property comparisons (bug 532013)
* gladeui/glade-property.c: Applied patch from Pavel Kostyuchenko to fix project
modified state flag glitches (bug 532017).
2008-05-05 Tristan Van Berkom <tvb@gnome.org>
* gladeui/glade-editor-property.c: Avoid feedback loops when committing properties,
......
......@@ -107,7 +107,9 @@ struct _GladeProjectPrivate
GHashTable *widget_names_allocator; /* hash table with the used widget names */
GHashTable *widget_old_names; /* widget -> old name of the widget */
GladeCommand *first_modification; /* we record the first modification, so that we
gboolean first_modification_is_na; /* the flag indicates that the first_modification item has been lost */
GList *first_modification; /* we record the first modification, so that we
* can set "modification" to FALSE when we
* undo this modification
*/
......@@ -283,8 +285,7 @@ glade_project_get_property (GObject *object,
*/
static void
glade_project_set_modified (GladeProject *project,
gboolean modified,
GladeCommand *modification)
gboolean modified)
{
GladeProjectPrivate *priv = project->priv;
......@@ -292,16 +293,10 @@ glade_project_set_modified (GladeProject *project,
{
priv->modified = !priv->modified;
if (priv->modified)
{
g_assert (priv->first_modification == NULL);
g_assert (modification != NULL);
priv->first_modification = modification;
}
else
if (!priv->modified)
{
g_assert (priv->first_modification != NULL);
priv->first_modification = NULL;
priv->first_modification = project->priv->prev_redo_item;
priv->first_modification_is_na = FALSE;
}
g_object_notify (G_OBJECT (project), "modified");
......@@ -422,9 +417,8 @@ glade_project_push_undo_impl (GladeProject *project, GladeCommand *cmd)
{
g_assert (tmp_redo_item->data);
/* just for safety, we might not need this */
if (GLADE_COMMAND (tmp_redo_item->data) == priv->first_modification)
priv->first_modification = NULL;
if (tmp_redo_item == priv->first_modification)
priv->first_modification_is_na = TRUE;
g_object_unref (G_OBJECT (tmp_redo_item->data));
......@@ -466,10 +460,10 @@ glade_project_changed_impl (GladeProject *project,
/* 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);
if (!project->priv->first_modification_is_na && project->priv->prev_redo_item == project->priv->first_modification)
glade_project_set_modified (project, FALSE);
else
glade_project_set_modified (project, TRUE, command);
glade_project_set_modified (project, TRUE);
}
glade_app_update_ui ();
}
......@@ -706,6 +700,7 @@ glade_project_init (GladeProject *project)
priv->undo_stack = NULL;
priv->prev_redo_item = NULL;
priv->first_modification = NULL;
priv->first_modification_is_na = FALSE;
priv->widget_names_allocator = g_hash_table_new_full (g_str_hash,
g_str_equal,
......@@ -2612,7 +2607,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, NULL);
glade_project_set_modified (project, FALSE);
if (project->priv->unsaved_number > 0)
{
......
......@@ -1868,7 +1868,8 @@ glade_widget_show (GladeWidget *widget)
if (GTK_WIDGET_REALIZED (layout))
glade_widget_add_to_layout (widget, layout);
else
g_signal_connect_data (layout, "map", (GCallback) glade_widget_add_to_layout,
g_signal_connect_data (G_OBJECT (layout), "map",
G_CALLBACK (glade_widget_add_to_layout),
widget, NULL, G_CONNECT_AFTER | G_CONNECT_SWAPPED);
} else if (GTK_IS_WIDGET (widget->object))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment