Commit ef7d9f23 authored by Tristan Van Berkom's avatar Tristan Van Berkom

Applied patch for bug 340692


	* doc/Makefile.am: Applied patch for bug 340692

	* src/glade-command.c: glade_command_set_property (), return if
	  the command doesnt change the property.

	* src/glade-editor-property.c: GladeEPropText, if string property is NULL
	  and we recieve "" from the entry, set the property to NULL, if we get
	  NULL from the entry and the property is "", then set the property to
	  "", otherwise set the property to the entry text. (this fixes 339832)

	* src/glade-property.[ch]: constified GValue argument to
	  glade_property_equals_value ().
parent 31f5587d
2006-05-05 Tristan Van Berkom <tvb@gnome.org>
* doc/Makefile.am: Applied patch for bug 340692
* src/glade-command.c: glade_command_set_property (), return if
the command doesnt change the property.
* src/glade-editor-property.c: GladeEPropText, if string property is NULL
and we recieve "" from the entry, set the property to NULL, if we get
NULL from the entry and the property is "", then set the property to
"", otherwise set the property to the entry text. (this fixes 339832)
* src/glade-property.[ch]: constified GValue argument to
glade_property_equals_value ().
2006-05-05 Tristan Van Berkom <tvb@gnome.org>
* src/glade-gtk.c: Fixed up GtkTable to not refresh placehlolders when
......
......@@ -90,7 +90,7 @@ expand_content_files=\
# signals and properties.
# e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
INCLUDES=-I$(top_builddir)/src `pkg-config --cflags gtk+-2.0`
INCLUDES=-I$(top_srcdir)/src `pkg-config --cflags gtk+-2.0`
GTKDOC_LIBS=${top_builddir}/src/libgladeui-1.la
# This includes the standard gtk-doc make rules, copied by gtkdocize.
......
......@@ -55,7 +55,7 @@ typedef struct {
GladeWidget *parent;
GladeProject *project;
GladePlaceholder *placeholder;
gboolean *props_recorded;
gboolean props_recorded;
GList *pack_props;
gulong handler_id;
} CommandData;
......@@ -632,6 +632,12 @@ glade_command_set_properties (GladeProperty *property, const GValue *old_value,
void
glade_command_set_property (GladeProperty *property, const GValue* pvalue)
{
/* Dont generate undo/redo items for unchanging property values.
*/
if (glade_property_equals_value (property, pvalue))
return;
glade_command_set_properties (property, property->value, pvalue, NULL);
}
......
......@@ -1322,7 +1322,8 @@ glade_eprop_text_changed_common (GladeEditorProperty *eprop,
const gchar *text,
gboolean use_command)
{
GValue val = { 0, };
GValue val = { 0, };
gchar *prop_text;
if (eprop->property->class->pspec->value_type == G_TYPE_STRV)
{
......@@ -1332,7 +1333,21 @@ glade_eprop_text_changed_common (GladeEditorProperty *eprop,
else
{
g_value_init (&val, G_TYPE_STRING);
g_value_set_string (&val, text);
glade_property_get (eprop->property, &prop_text);
/* Here we try not to modify the project state by not
* modifying a null value for an unchanged property.
*/
if (prop_text == NULL &&
text && text[0] == '\0')
g_value_set_string (&val, NULL);
else if (text == NULL &&
prop_text && prop_text == '\0')
g_value_set_string (&val, "");
else
g_value_set_string (&val, text);
}
glade_editor_property_commit (eprop, &val);
......
......@@ -2186,9 +2186,6 @@ glade_gtk_table_refresh_placeholders (GtkTable *table)
void GLADEGTK_API
glade_gtk_table_add_child (GObject *object, GObject *child)
{
GList *children, *list;
GtkWidget *placeholder = NULL;
g_return_if_fail (GTK_IS_TABLE (object));
g_return_if_fail (GTK_IS_WIDGET (child));
......
......@@ -1027,7 +1027,7 @@ glade_property_default (GladeProperty *property)
*/
gboolean
glade_property_equals_value (GladeProperty *property,
GValue *value)
const GValue *value)
{
g_return_val_if_fail (GLADE_IS_PROPERTY (property), FALSE);
return GLADE_PROPERTY_GET_KLASS (property)->equals_value (property, value);
......
......@@ -95,7 +95,7 @@ LIBGLADEUI_API
gboolean glade_property_default (GladeProperty *property);
LIBGLADEUI_API
gboolean glade_property_equals_value (GladeProperty *property,
GValue *value);
const GValue *value);
LIBGLADEUI_API
gboolean glade_property_equals (GladeProperty *property,
...);
......
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