Code

change API: separate functions creating a blur filter, one for a given item, another...
[inkscape.git] / src / sp-offset.cpp
index fc9115f24adadbacc7f3af3c1475df4cc962beb4..2253bf1e1170dd7b869304d8aa30da7b09667ebe 100644 (file)
@@ -179,6 +179,7 @@ sp_offset_init(SPOffset *offset)
     offset->sourceHref = NULL;
     offset->sourceRepr = NULL;
     offset->sourceObject = NULL;
+    new (&offset->_modified_connection) sigc::connection();
     new (&offset->_delete_connection) sigc::connection();
     new (&offset->_changed_connection) sigc::connection();
     new (&offset->_transformed_connection) sigc::connection();
@@ -196,8 +197,14 @@ sp_offset_finalize(GObject *obj)
     SPOffset *offset = (SPOffset *) obj;
 
     delete offset->sourceRef;
+
+    offset->_modified_connection.disconnect();
+    offset->_modified_connection.~connection();
+    offset->_delete_connection.disconnect();
     offset->_delete_connection.~connection();
+    offset->_changed_connection.disconnect();
     offset->_changed_connection.~connection();
+    offset->_transformed_connection.disconnect();
     offset->_transformed_connection.~connection();
 }
 
@@ -277,7 +284,7 @@ sp_offset_write(SPObject *object, Inkscape::XML::Node *repr, guint flags)
     }
 
     // write that curve to "d"
-    char *d = sp_svg_write_path (((SPShape *) offset)->curve->bpath);
+    char *d = sp_svg_write_path (SP_CURVE_BPATH(((SPShape *) offset)->curve));
     repr->setAttribute("d", d);
     g_free (d);
 
@@ -346,7 +353,7 @@ sp_offset_set(SPObject *object, unsigned key, gchar const *value)
                 bpath = sp_svg_read_path (offset->original);
                 curve = sp_curve_new_from_bpath (bpath);       // curve se chargera de detruire bpath
                 g_assert (curve != NULL);
-                offset->originalPath = bpath_to_liv_path (curve->bpath);
+                offset->originalPath = bpath_to_liv_path (SP_CURVE_BPATH(curve));
                 sp_curve_unref (curve);
 
                 offset->knotSet = false;
@@ -1023,7 +1030,7 @@ sp_offset_top_point (SPOffset * offset, NR::Point *px)
             return;
     }
 
-    Path *finalPath = bpath_to_liv_path (curve->bpath);
+    Path *finalPath = bpath_to_liv_path (SP_CURVE_BPATH(curve));
     if (finalPath == NULL)
     {
         sp_curve_unref (curve);
@@ -1057,7 +1064,7 @@ static void sp_offset_start_listening(SPOffset *offset,SPObject* to)
 
     offset->_delete_connection = SP_OBJECT(to)->connectDelete(sigc::bind(sigc::ptr_fun(&sp_offset_delete_self), offset));
     offset->_transformed_connection = SP_ITEM(to)->connectTransformed(sigc::bind(sigc::ptr_fun(&sp_offset_move_compensate), offset));
-    offset->_modified_connection = g_signal_connect (G_OBJECT (to), "modified", G_CALLBACK (sp_offset_source_modified), offset);
+    offset->_modified_connection = SP_OBJECT(to)->connectModified(sigc::bind<2>(sigc::ptr_fun(&sp_offset_source_modified), offset));
 }
 
 static void sp_offset_quit_listening(SPOffset *offset)
@@ -1065,7 +1072,7 @@ static void sp_offset_quit_listening(SPOffset *offset)
     if ( offset->sourceObject == NULL )
         return;
 
-    g_signal_handler_disconnect (offset->sourceObject, offset->_modified_connection);
+    offset->_modified_connection.disconnect();
     offset->_delete_connection.disconnect();
     offset->_transformed_connection.disconnect();
 
@@ -1167,7 +1174,7 @@ refresh_offset_source(SPOffset* offset)
         if (curve == NULL)
            return;
     }
-    orig = bpath_to_liv_path (curve->bpath);
+    orig = bpath_to_liv_path (SP_CURVE_BPATH(curve));
     sp_curve_unref (curve);