Code

lpe interpolate: fix traversal of trajectory_path. add option for equidistant_spacing
[inkscape.git] / src / dialogs / sp-attribute-widget.cpp
index 92da747a42db484478a219860461ef3ba18bf4ff..9848d9f266c86430ee12aff55b9aebac6550571b 100644 (file)
@@ -46,23 +46,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()
 
 
@@ -158,25 +160,14 @@ sp_attribute_widget_changed (GtkEditable *editable)
             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_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) {
 
-            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 : "");
-            }
+            spaw->src.repr->setAttribute(spaw->attribute, text, false);
             /* TODO: Warning! Undo will not be flushed in given case */
         }
         spaw->blocked = FALSE;
@@ -376,23 +367,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()
 
 
@@ -775,27 +768,13 @@ sp_attribute_table_entry_changed ( GtkEditable *editable,
                     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_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;