summaryrefslogtreecommitdiff
path: root/src/book.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/book.vala')
-rw-r--r--src/book.vala23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/book.vala b/src/book.vala
index 15e79c6..6740fcb 100644
--- a/src/book.vala
+++ b/src/book.vala
@@ -14,7 +14,7 @@ public class Book
private List<Page> pages;
private bool needs_saving;
-
+
public signal void page_added (Page page);
public signal void page_removed (Page page);
public signal void reordered ();
@@ -24,10 +24,25 @@ public class Book
public Book ()
{
+ pages = new List<Page> ();
+ }
+
+ ~Book ()
+ {
+ foreach (var page in pages)
+ {
+ page.pixels_changed.disconnect (page_changed_cb);
+ page.crop_changed.disconnect (page_changed_cb);
+ }
}
public void clear ()
{
+ foreach (var page in pages)
+ {
+ page.pixels_changed.disconnect (page_changed_cb);
+ page.crop_changed.disconnect (page_changed_cb);
+ }
pages = null;
cleared ();
}
@@ -94,7 +109,7 @@ public class Book
string prefix = uri, suffix = "";
var extension_index = basename.last_index_of_char ('.');
if (extension_index >= 0)
- {
+ {
suffix = basename.slice (extension_index, basename.length);
prefix = uri.slice (0, uri.length - suffix.length);
}
@@ -460,7 +475,7 @@ public class Book
writer.write_string ("\n");
writer.write_string ("endstream\n");
writer.write_string ("endobj\n");
-
+
saving (i);
}
@@ -585,5 +600,5 @@ public class PsWriter
}
return Cairo.Status.SUCCESS;
- }
+ }
}