Code

remove mnemonic which does not work anyway
[inkscape.git] / src / dialogs / sp-attribute-widget.cpp
index d7c4316e1d99cb9cd2dd6a0e303f0e8c5072400a..de14fc173bb5732e667243f41f82fb6d510f498b 100644 (file)
@@ -1,20 +1,12 @@
-#define __SP_ATTRIBUTE_WIDGET_C__
-
-/**
- * \brief  SPAttributeWidget
- *
- * Widget, that listens and modifies repr attributes
- *
- * Authors:
+/** @file
+ * @brief Widget that listens and modifies repr attributes
+ */
+/* Authors:
  *  Lauris Kaplinski <lauris@ximian.com>
  *
  * Copyright (C) 2001 Ximian, Inc.
- *
- * Licensed under GNU GPL
+ * Released under GNU GPL, read the file 'COPYING' for more information
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
 
 #include <gtk/gtktable.h>
 #include <gtk/gtklabel.h>
@@ -24,6 +16,9 @@
 #include "sp-object.h"
 #include <glibmm/i18n.h>
 
+#include <sigc++/functors/ptr_fun.h>
+#include <sigc++/adaptors/bind.h>
+
 #include "sp-attribute-widget.h"
 
 static void sp_attribute_widget_class_init (SPAttributeWidgetClass *klass);
@@ -32,10 +27,10 @@ static void sp_attribute_widget_destroy (GtkObject *object);
 
 static void sp_attribute_widget_changed (GtkEditable *editable);
 
-static void sp_attribute_widget_object_modified ( SPObject *object, 
-                                                  guint flags, 
+static void sp_attribute_widget_object_modified ( SPObject *object,
+                                                  guint flags,
                                                   SPAttributeWidget *spaw );
-static void sp_attribute_widget_object_release ( SPObject *object, 
+static void sp_attribute_widget_object_release ( SPObject *object,
                                                  SPAttributeWidget *spaw );
 
 static GtkEntryClass *parent_class;
@@ -43,23 +38,25 @@ static GtkEntryClass *parent_class;
 
 
 
-GtkType
-sp_attribute_widget_get_type (void)
+GType sp_attribute_widget_get_type(void)
 {
     static GtkType type = 0;
     if (!type) {
-        static const GtkTypeInfo info = {
-            "SPAttributeWidget",
-            sizeof (SPAttributeWidget),
-            sizeof (SPAttributeWidgetClass),
-            (GtkClassInitFunc) sp_attribute_widget_class_init,
-            (GtkObjectInitFunc) sp_attribute_widget_init,
-            NULL, NULL, NULL
+        GTypeInfo info = {
+            sizeof(SPAttributeWidgetClass),
+            0, // base_init
+            0, // base_finalize
+            (GClassInitFunc)sp_attribute_widget_class_init,
+            0, // class_finalize
+            0, // class_data
+            sizeof(SPAttributeWidget),
+            0, // n_preallocs
+            (GInstanceInitFunc)sp_attribute_widget_init,
+            0 // value_table
         };
-        type = gtk_type_unique (GTK_TYPE_ENTRY, &info);
+        type = g_type_register_static(GTK_TYPE_ENTRY, "SPAttributeWidget", &info, static_cast<GTypeFlags>(0));
     }
     return type;
-    
 } // end of sp_attribute_widget_get_type()
 
 
@@ -94,6 +91,9 @@ sp_attribute_widget_init (SPAttributeWidget *spaw)
     spaw->src.object = NULL;
 
     spaw->attribute = NULL;
+
+    new (&spaw->modified_connection) sigc::connection();
+    new (&spaw->release_connection) sigc::connection();
 }
 
 
@@ -101,7 +101,7 @@ sp_attribute_widget_init (SPAttributeWidget *spaw)
 static void
 sp_attribute_widget_destroy (GtkObject *object)
 {
-    
+
     SPAttributeWidget *spaw;
 
     spaw = SP_ATTRIBUTE_WIDGET (object);
@@ -111,20 +111,24 @@ sp_attribute_widget_destroy (GtkObject *object)
         spaw->attribute = NULL;
     }
 
-    
+
     if (spaw->hasobj) {
-        
+
         if (spaw->src.object) {
-            sp_signal_disconnect_by_data (spaw->src.object, spaw);
+            spaw->modified_connection.disconnect();
+            spaw->release_connection.disconnect();
             spaw->src.object = NULL;
         }
     } else {
-    
+
         if (spaw->src.repr) {
             spaw->src.repr = Inkscape::GC::release(spaw->src.repr);
         }
     } // end of if()
-    
+
+    spaw->modified_connection.~connection();
+    spaw->release_connection.~connection();
+
     ((GtkObjectClass *) parent_class)->destroy (object);
 
 }
@@ -140,37 +144,27 @@ sp_attribute_widget_changed (GtkEditable *editable)
     spaw = SP_ATTRIBUTE_WIDGET (editable);
 
     if (!spaw->blocked) {
-    
+
         const gchar *text;
         spaw->blocked = TRUE;
         text = gtk_entry_get_text (GTK_ENTRY (spaw));
-        if (!*text) 
+        if (!*text)
             text = NULL;
-        
+
         if (spaw->hasobj && spaw->src.object) {
-            
-            if (!sp_repr_set_attr ( SP_OBJECT_REPR (spaw->src.object), 
-                                    spaw->attribute, text) )
-            {
-                /* Cannot set attribute */
-                text = SP_OBJECT_REPR (spaw->src.object)->attribute(spaw->attribute);
-                gtk_entry_set_text (GTK_ENTRY (spaw), text ? text : "");
-            }
-            sp_document_done (SP_OBJECT_DOCUMENT (spaw->src.object));
-            
-        } else if (spaw->src.repr) {
         
-            if (!sp_repr_set_attr (spaw->src.repr, spaw->attribute, text))
-            {
-                /* Cannot set attribute */
-                text = spaw->src.repr->attribute(spaw->attribute);
-                gtk_entry_set_text (GTK_ENTRY (spaw), text ? text : "");
-            }
+            SP_OBJECT_REPR (spaw->src.object)->setAttribute(spaw->attribute, text, false);
+            sp_document_done (SP_OBJECT_DOCUMENT (spaw->src.object), SP_VERB_NONE,
+                              _("Set attribute"));
+
+        } else if (spaw->src.repr) {
+
+            spaw->src.repr->setAttribute(spaw->attribute, text, false);
             /* TODO: Warning! Undo will not be flushed in given case */
         }
         spaw->blocked = FALSE;
     }
-    
+
 } // end of sp_attribute_widget_changed()
 
 
@@ -188,7 +182,7 @@ sp_attribute_widget_new ( SPObject *object, const gchar *attribute )
     sp_attribute_widget_set_object (spaw, object, attribute);
 
     return GTK_WIDGET (spaw);
-    
+
 } // end of sp_attribute_widget_new()
 
 
@@ -208,8 +202,8 @@ sp_attribute_widget_new_repr ( Inkscape::XML::Node *repr, const gchar *attribute
 
 
 void
-sp_attribute_widget_set_object ( SPAttributeWidget *spaw, 
-                                 SPObject *object, 
+sp_attribute_widget_set_object ( SPAttributeWidget *spaw,
+                                 SPObject *object,
                                  const gchar *attribute )
 {
 
@@ -225,13 +219,14 @@ sp_attribute_widget_set_object ( SPAttributeWidget *spaw,
     }
 
     if (spaw->hasobj) {
-    
+
         if (spaw->src.object) {
-            sp_signal_disconnect_by_data (spaw->src.object, spaw);
+            spaw->modified_connection.disconnect();
+            spaw->release_connection.disconnect();
             spaw->src.object = NULL;
         }
     } else {
-        
+
         if (spaw->src.repr) {
             spaw->src.repr = Inkscape::GC::release(spaw->src.repr);
         }
@@ -244,12 +239,9 @@ sp_attribute_widget_set_object ( SPAttributeWidget *spaw,
 
         spaw->blocked = TRUE;
         spaw->src.object = object;
-        g_signal_connect ( G_OBJECT (object), "modified", 
-                           G_CALLBACK (sp_attribute_widget_object_modified), 
-                           spaw );
-        g_signal_connect ( G_OBJECT (object), "release", 
-                           G_CALLBACK (sp_attribute_widget_object_release), 
-                           spaw );
+
+        spaw->modified_connection = object->connectModified(sigc::bind<2>(sigc::ptr_fun(&sp_attribute_widget_object_modified), spaw));
+        spaw->release_connection = object->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_attribute_widget_object_release), spaw));
 
         spaw->attribute = g_strdup (attribute);
 
@@ -265,8 +257,8 @@ sp_attribute_widget_set_object ( SPAttributeWidget *spaw,
 
 
 void
-sp_attribute_widget_set_repr ( SPAttributeWidget *spaw, 
-                               Inkscape::XML::Node *repr, 
+sp_attribute_widget_set_repr ( SPAttributeWidget *spaw,
+                               Inkscape::XML::Node *repr,
                                const gchar *attribute )
 {
 
@@ -280,13 +272,14 @@ sp_attribute_widget_set_repr ( SPAttributeWidget *spaw,
     }
 
     if (spaw->hasobj) {
-    
+
         if (spaw->src.object) {
-            sp_signal_disconnect_by_data (spaw->src.object, spaw);
+            spaw->modified_connection.disconnect();
+            spaw->release_connection.disconnect();
             spaw->src.object = NULL;
         }
     } else {
-        
+
         if (spaw->src.repr) {
             spaw->src.repr = Inkscape::GC::release(spaw->src.repr);
         }
@@ -313,29 +306,29 @@ sp_attribute_widget_set_repr ( SPAttributeWidget *spaw,
 
 
 static void
-sp_attribute_widget_object_modified ( SPObject *object, 
-                                      guint flags, 
+sp_attribute_widget_object_modified ( SPObject */*object*/,
+                                      guint flags,
                                       SPAttributeWidget *spaw )
 {
 
     if (flags && SP_OBJECT_MODIFIED_FLAG) {
-        
+
         const gchar *val, *text;
         val = SP_OBJECT_REPR (spaw->src.object)->attribute(spaw->attribute);
         text = gtk_entry_get_text (GTK_ENTRY (spaw));
-        
+
         if (val || text) {
-            
+
             if (!val || !text || strcmp (val, text)) {
                 /* We are different */
                 spaw->blocked = TRUE;
-                gtk_entry_set_text ( GTK_ENTRY (spaw), 
+                gtk_entry_set_text ( GTK_ENTRY (spaw),
                                      val ? val : (const gchar *) "");
                 spaw->blocked = FALSE;
             } // end of if()
-        
+
         } // end of if()
-        
+
     } //end of if()
 
 } // end of sp_attribute_widget_object_modified()
@@ -343,7 +336,7 @@ sp_attribute_widget_object_modified ( SPObject *object,
 
 
 static void
-sp_attribute_widget_object_release ( SPObject *object, 
+sp_attribute_widget_object_release ( SPObject */*object*/,
                                      SPAttributeWidget *spaw )
 {
     sp_attribute_widget_set_object (spaw, NULL, NULL);
@@ -366,23 +359,25 @@ static GtkVBoxClass *table_parent_class;
 
 
 
-GtkType
-sp_attribute_table_get_type (void)
+GType sp_attribute_table_get_type(void)
 {
     static GtkType type = 0;
     if (!type) {
-        static const GtkTypeInfo info = {
-            "SPAttributeTable",
-            sizeof (SPAttributeTable),
-            sizeof (SPAttributeTableClass),
-            (GtkClassInitFunc) sp_attribute_table_class_init,
-            (GtkObjectInitFunc) sp_attribute_table_init,
-            NULL, NULL, NULL
+        GTypeInfo info = {
+            sizeof(SPAttributeTableClass),
+            0, // base_init
+            0, // base_finalize
+            (GClassInitFunc)sp_attribute_table_class_init,
+            0, // class_finalize
+            0, // class_data
+            sizeof(SPAttributeTable),
+            0, // n_preallocs
+            (GInstanceInitFunc)sp_attribute_table_init,
+            0 // value_table
         };
-        type = gtk_type_unique (GTK_TYPE_VBOX, &info);
+        type = g_type_register_static(GTK_TYPE_VBOX, "SPAttributeTable", &info, static_cast<GTypeFlags>(0));
     }
     return type;
-
 } // end of sp_attribute_table_get_type()
 
 
@@ -414,6 +409,9 @@ sp_attribute_table_init ( SPAttributeTable *spat )
     spat->num_attr = 0;
     spat->attributes = NULL;
     spat->entries = NULL;
+
+    new (&spat->modified_connection) sigc::connection();
+    new (&spat->release_connection) sigc::connection();
 }
 
 static void
@@ -433,9 +431,10 @@ sp_attribute_table_destroy ( GtkObject *object )
     }
 
     if (spat->hasobj) {
-        
+
         if (spat->src.object) {
-            sp_signal_disconnect_by_data (spat->src.object, spat);
+            spat->modified_connection.disconnect();
+            spat->release_connection.disconnect();
             spat->src.object = NULL;
         }
     } else {
@@ -444,7 +443,9 @@ sp_attribute_table_destroy ( GtkObject *object )
         }
     } // end of if()
 
-    
+    spat->modified_connection.~connection();
+    spat->release_connection.~connection();
+
     if (spat->entries) {
         g_free (spat->entries);
         spat->entries = NULL;
@@ -455,14 +456,14 @@ sp_attribute_table_destroy ( GtkObject *object )
     if (((GtkObjectClass *) table_parent_class)->destroy) {
         (* ((GtkObjectClass *) table_parent_class)->destroy) (object);
     }
-        
+
 } // end of sp_attribute_table_destroy()
 
 
 GtkWidget *
-sp_attribute_table_new ( SPObject *object, 
-                         gint num_attr, 
-                         const gchar **labels, 
+sp_attribute_table_new ( SPObject *object,
+                         gint num_attr,
+                         const gchar **labels,
                          const gchar **attributes )
 {
     SPAttributeTable *spat;
@@ -482,9 +483,9 @@ sp_attribute_table_new ( SPObject *object,
 
 
 GtkWidget *
-sp_attribute_table_new_repr ( Inkscape::XML::Node *repr, 
-                              gint num_attr, 
-                              const gchar **labels, 
+sp_attribute_table_new_repr ( Inkscape::XML::Node *repr,
+                              gint num_attr,
+                              const gchar **labels,
                               const gchar **attributes )
 {
     SPAttributeTable *spat;
@@ -505,10 +506,10 @@ sp_attribute_table_new_repr ( Inkscape::XML::Node *repr,
 #define YPAD 0
 
 void
-sp_attribute_table_set_object ( SPAttributeTable *spat, 
-                                SPObject *object, 
-                                gint num_attr, 
-                                const gchar **labels, 
+sp_attribute_table_set_object ( SPAttributeTable *spat,
+                                SPObject *object,
+                                gint num_attr,
+                                const gchar **labels,
                                 const gchar **attributes )
 {
 
@@ -539,7 +540,8 @@ sp_attribute_table_set_object ( SPAttributeTable *spat,
 
     if (spat->hasobj) {
         if (spat->src.object) {
-            sp_signal_disconnect_by_data (spat->src.object, spat);
+            spat->modified_connection.disconnect();
+            spat->release_connection.disconnect();
             spat->src.object = NULL;
         }
     } else {
@@ -558,12 +560,10 @@ sp_attribute_table_set_object ( SPAttributeTable *spat,
         /* Set up object */
         spat->src.object = object;
         spat->num_attr = num_attr;
-        g_signal_connect ( G_OBJECT (object), "modified", 
-                           G_CALLBACK (sp_attribute_table_object_modified), 
-                           spat );
-        g_signal_connect ( G_OBJECT (object), "release", 
-                           G_CALLBACK (sp_attribute_table_object_release), 
-                           spat );
+
+        spat->modified_connection = object->connectModified(sigc::bind<2>(sigc::ptr_fun(&sp_attribute_table_object_modified), spat));
+        spat->release_connection = object->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_attribute_table_object_release), spat));
+
         /* Create table */
         spat->table = gtk_table_new (num_attr, 2, FALSE);
         gtk_container_add (GTK_CONTAINER (spat), spat->table);
@@ -579,21 +579,21 @@ sp_attribute_table_set_object ( SPAttributeTable *spat,
             w = gtk_label_new (_(labels[i]));
             gtk_widget_show (w);
             gtk_misc_set_alignment (GTK_MISC (w), 1.0, 0.5);
-            gtk_table_attach ( GTK_TABLE (spat->table), w, 0, 1, i, i + 1, 
-                               GTK_FILL, 
-                               (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 
+            gtk_table_attach ( GTK_TABLE (spat->table), w, 0, 1, i, i + 1,
+                               GTK_FILL,
+                               (GtkAttachOptions)(GTK_EXPAND | GTK_FILL),
                                XPAD, YPAD );
             w = gtk_entry_new ();
             gtk_widget_show (w);
             val = SP_OBJECT_REPR (object)->attribute(attributes[i]);
             gtk_entry_set_text (GTK_ENTRY (w), val ? val : (const gchar *) "");
-            gtk_table_attach ( GTK_TABLE (spat->table), w, 1, 2, i, i + 1, 
-                               (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 
-                               (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 
+            gtk_table_attach ( GTK_TABLE (spat->table), w, 1, 2, i, i + 1,
+                               (GtkAttachOptions)(GTK_EXPAND | GTK_FILL),
+                               (GtkAttachOptions)(GTK_EXPAND | GTK_FILL),
                                XPAD, YPAD );
             spat->entries[i] = w;
-            g_signal_connect ( G_OBJECT (w), "changed", 
-                               G_CALLBACK (sp_attribute_table_entry_changed), 
+            g_signal_connect ( G_OBJECT (w), "changed",
+                               G_CALLBACK (sp_attribute_table_entry_changed),
                                spat );
         }
         /* Show table */
@@ -602,7 +602,7 @@ sp_attribute_table_set_object ( SPAttributeTable *spat,
         spat->blocked = FALSE;
     }
 
-    gtk_widget_set_sensitive ( GTK_WIDGET (spat), 
+    gtk_widget_set_sensitive ( GTK_WIDGET (spat),
                                (spat->src.object != NULL) );
 
 } // end of sp_attribute_table_set_object()
@@ -610,10 +610,10 @@ sp_attribute_table_set_object ( SPAttributeTable *spat,
 
 
 void
-sp_attribute_table_set_repr ( SPAttributeTable *spat, 
-                              Inkscape::XML::Node *repr, 
-                              gint num_attr, 
-                              const gchar **labels, 
+sp_attribute_table_set_repr ( SPAttributeTable *spat,
+                              Inkscape::XML::Node *repr,
+                              gint num_attr,
+                              const gchar **labels,
                               const gchar **attributes )
 {
     g_return_if_fail (spat != NULL);
@@ -641,7 +641,8 @@ sp_attribute_table_set_repr ( SPAttributeTable *spat,
 
     if (spat->hasobj) {
         if (spat->src.object) {
-            sp_signal_disconnect_by_data (spat->src.object, spat);
+            spat->modified_connection.disconnect();
+            spat->release_connection.disconnect();
             spat->src.object = NULL;
         }
     } else {
@@ -666,7 +667,7 @@ sp_attribute_table_set_repr ( SPAttributeTable *spat,
         /* Arrays */
         spat->attributes = g_new0 (gchar *, num_attr);
         spat->entries = g_new0 (GtkWidget *, num_attr);
-        
+
         /* Fill rows */
         for (i = 0; i < num_attr; i++) {
             GtkWidget *w;
@@ -676,21 +677,21 @@ sp_attribute_table_set_repr ( SPAttributeTable *spat,
             w = gtk_label_new (labels[i]);
             gtk_widget_show (w);
             gtk_misc_set_alignment (GTK_MISC (w), 1.0, 0.5);
-            gtk_table_attach ( GTK_TABLE (spat->table), w, 0, 1, i, i + 1, 
-                               GTK_FILL, 
-                               (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 
+            gtk_table_attach ( GTK_TABLE (spat->table), w, 0, 1, i, i + 1,
+                               GTK_FILL,
+                               (GtkAttachOptions)(GTK_EXPAND | GTK_FILL),
                                XPAD, YPAD );
             w = gtk_entry_new ();
             gtk_widget_show (w);
             val = repr->attribute(attributes[i]);
             gtk_entry_set_text (GTK_ENTRY (w), val ? val : (const gchar *) "");
-            gtk_table_attach ( GTK_TABLE (spat->table), w, 1, 2, i, i + 1, 
-                               (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 
-                               (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 
+            gtk_table_attach ( GTK_TABLE (spat->table), w, 1, 2, i, i + 1,
+                               (GtkAttachOptions)(GTK_EXPAND | GTK_FILL),
+                               (GtkAttachOptions)(GTK_EXPAND | GTK_FILL),
                                XPAD, YPAD );
             spat->entries[i] = w;
-            g_signal_connect ( G_OBJECT (w), "changed", 
-                               G_CALLBACK (sp_attribute_table_entry_changed), 
+            g_signal_connect ( G_OBJECT (w), "changed",
+                               G_CALLBACK (sp_attribute_table_entry_changed),
                                spat );
         }
         /* Show table */
@@ -706,8 +707,8 @@ sp_attribute_table_set_repr ( SPAttributeTable *spat,
 
 
 static void
-sp_attribute_table_object_modified ( SPObject *object, 
-                                     guint flags, 
+sp_attribute_table_object_modified ( SPObject */*object*/,
+                                     guint flags,
                                      SPAttributeTable *spat )
 {
     if (flags && SP_OBJECT_MODIFIED_FLAG)
@@ -721,20 +722,20 @@ sp_attribute_table_object_modified ( SPObject *object,
                 if (!val || !text || strcmp (val, text)) {
                     /* We are different */
                     spat->blocked = TRUE;
-                    gtk_entry_set_text ( GTK_ENTRY (spat->entries[i]), 
+                    gtk_entry_set_text ( GTK_ENTRY (spat->entries[i]),
                                          val ? val : (const gchar *) "");
                     spat->blocked = FALSE;
                 }
             }
         }
     } // end of if()
-    
+
 } // end of sp_attribute_table_object_modified()
 
 
 
 static void
-sp_attribute_table_object_release (SPObject *object, SPAttributeTable *spat)
+sp_attribute_table_object_release (SPObject */*object*/, SPAttributeTable *spat)
 {
     sp_attribute_table_set_object (spat, NULL, 0, NULL, NULL);
 }
@@ -742,43 +743,30 @@ sp_attribute_table_object_release (SPObject *object, SPAttributeTable *spat)
 
 
 static void
-sp_attribute_table_entry_changed ( GtkEditable *editable, 
+sp_attribute_table_entry_changed ( GtkEditable *editable,
                                    SPAttributeTable *spat )
 {
     if (!spat->blocked)
     {
         gint i;
         for (i = 0; i < spat->num_attr; i++) {
-        
+
             if (GTK_WIDGET (editable) == spat->entries[i]) {
                 const gchar *text;
                 spat->blocked = TRUE;
                 text = gtk_entry_get_text (GTK_ENTRY (spat->entries[i]));
-                
-                if (!*text) 
+
+                if (!*text)
                     text = NULL;
-                
+
                 if (spat->hasobj && spat->src.object) {
-                    if (!sp_repr_set_attr ( SP_OBJECT_REPR (spat->src.object), 
-                                            spat->attributes[i], text))
-                    {
-                        /* Cannot set attribute */
-                        text = SP_OBJECT_REPR (spat->src.object)->attribute(spat->attributes[i]);
-                        gtk_entry_set_text ( GTK_ENTRY (spat->entries[i]), 
-                                             text ? text : (const gchar *) "");
-                    }
-                    sp_document_done (SP_OBJECT_DOCUMENT (spat->src.object));
-                    
+                    SP_OBJECT_REPR (spat->src.object)->setAttribute(spat->attributes[i], text, false);
+                    sp_document_done (SP_OBJECT_DOCUMENT (spat->src.object), SP_VERB_NONE,
+                                      _("Set attribute"));
+
                 } else if (spat->src.repr) {
-                    
-                    if (!sp_repr_set_attr (spat->src.repr, 
-                                           spat->attributes[i], text)) 
-                    {
-                        /* Cannot set attribute */
-                        text = spat->src.repr->attribute(spat->attributes[i]);
-                        gtk_entry_set_text ( GTK_ENTRY (spat->entries[i]), 
-                                             text ? text : (const gchar *) "" );
-                    }
+
+                    spat->src.repr->setAttribute(spat->attributes[i], text, false);
                     /* TODO: Warning! Undo will not be flushed in given case */
                 }
                 spat->blocked = FALSE;