summaryrefslogtreecommitdiff
path: root/src/book.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/book.c')
-rw-r--r--src/book.c112
1 files changed, 83 insertions, 29 deletions
diff --git a/src/book.c b/src/book.c
index c59870c..de54fb4 100644
--- a/src/book.c
+++ b/src/book.c
@@ -1,4 +1,4 @@
-/* book.c generated by valac 0.16.1, the Vala compiler
+/* book.c generated by valac 0.17.7, the Vala compiler
* generated from book.vala, do not modify */
/*
@@ -49,10 +49,10 @@ typedef struct _BookPrivate BookPrivate;
typedef struct _Page Page;
typedef struct _PageClass PageClass;
+#define _page_unref0(var) ((var == NULL) ? NULL : (var = (page_unref (var), NULL)))
#define __g_list_free__page_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__page_unref0_ (var), NULL)))
#define TYPE_SCAN_DIRECTION (scan_direction_get_type ())
-#define _page_unref0(var) ((var == NULL) ? NULL : (var = (page_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _cairo_destroy0(var) ((var == NULL) ? NULL : (var = (cairo_destroy (var), NULL)))
@@ -175,19 +175,19 @@ GType page_get_type (void) G_GNUC_CONST;
enum {
BOOK_DUMMY_PROPERTY
};
+static void book_page_changed_cb (Book* self, Page* page);
+static void _book_page_changed_cb_page_pixels_changed (Page* _sender, gpointer self);
+static void _book_page_changed_cb_page_crop_changed (Page* _sender, gpointer self);
static void _page_unref0_ (gpointer var);
static void _g_list_free__page_unref0_ (GList* self);
Book* book_new (void);
Book* book_construct (GType object_type);
void book_clear (Book* self);
-static void book_page_changed_cb (Book* self, Page* page);
void book_set_needs_saving (Book* self, gboolean needs_saving);
GType scan_direction_get_type (void) G_GNUC_CONST;
Page* book_append_page (Book* self, gint width, gint height, gint dpi, ScanDirection scan_direction);
Page* page_new (gint width, gint height, gint dpi, ScanDirection scan_direction);
Page* page_construct (GType object_type, gint width, gint height, gint dpi, ScanDirection scan_direction);
-static void _book_page_changed_cb_page_pixels_changed (Page* _sender, gpointer self);
-static void _book_page_changed_cb_page_crop_changed (Page* _sender, gpointer self);
void book_move_page (Book* self, Page* page, guint location);
void book_delete_page (Book* self, Page* page);
guint book_get_n_pages (Book* self);
@@ -251,6 +251,21 @@ static cairo_status_t _ps_writer_write_cairo_data_cairo_write_func_t (gpointer s
static void ps_writer_finalize (PsWriter* obj);
+static gpointer _page_ref0 (gpointer self) {
+ return self ? page_ref (self) : NULL;
+}
+
+
+static void _book_page_changed_cb_page_pixels_changed (Page* _sender, gpointer self) {
+ book_page_changed_cb (self, _sender);
+}
+
+
+static void _book_page_changed_cb_page_crop_changed (Page* _sender, gpointer self) {
+ book_page_changed_cb (self, _sender);
+}
+
+
static void _page_unref0_ (gpointer var) {
(var == NULL) ? NULL : (var = (page_unref (var), NULL));
}
@@ -265,6 +280,8 @@ static void _g_list_free__page_unref0_ (GList* self) {
Book* book_construct (GType object_type) {
Book* self = NULL;
self = (Book*) g_type_create_instance (object_type);
+ __g_list_free__page_unref0_0 (self->priv->pages);
+ self->priv->pages = NULL;
return self;
}
@@ -275,7 +292,33 @@ Book* book_new (void) {
void book_clear (Book* self) {
+ GList* _tmp0_;
g_return_if_fail (self != NULL);
+ _tmp0_ = self->priv->pages;
+ {
+ GList* page_collection = NULL;
+ GList* page_it = NULL;
+ page_collection = _tmp0_;
+ for (page_it = page_collection; page_it != NULL; page_it = page_it->next) {
+ Page* _tmp1_;
+ Page* page = NULL;
+ _tmp1_ = _page_ref0 ((Page*) page_it->data);
+ page = _tmp1_;
+ {
+ Page* _tmp2_;
+ guint _tmp3_ = 0U;
+ Page* _tmp4_;
+ guint _tmp5_ = 0U;
+ _tmp2_ = page;
+ g_signal_parse_name ("pixels-changed", TYPE_PAGE, &_tmp3_, NULL, FALSE);
+ g_signal_handlers_disconnect_matched (_tmp2_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, 0, NULL, (GCallback) _book_page_changed_cb_page_pixels_changed, self);
+ _tmp4_ = page;
+ g_signal_parse_name ("crop-changed", TYPE_PAGE, &_tmp5_, NULL, FALSE);
+ g_signal_handlers_disconnect_matched (_tmp4_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp5_, 0, NULL, (GCallback) _book_page_changed_cb_page_crop_changed, self);
+ _page_unref0 (page);
+ }
+ }
+ }
__g_list_free__page_unref0_0 (self->priv->pages);
self->priv->pages = NULL;
g_signal_emit_by_name (self, "cleared");
@@ -289,21 +332,6 @@ static void book_page_changed_cb (Book* self, Page* page) {
}
-static void _book_page_changed_cb_page_pixels_changed (Page* _sender, gpointer self) {
- book_page_changed_cb (self, _sender);
-}
-
-
-static void _book_page_changed_cb_page_crop_changed (Page* _sender, gpointer self) {
- book_page_changed_cb (self, _sender);
-}
-
-
-static gpointer _page_ref0 (gpointer self) {
- return self ? page_ref (self) : NULL;
-}
-
-
Page* book_append_page (Book* self, gint width, gint height, gint dpi, ScanDirection scan_direction) {
Page* result = NULL;
gint _tmp0_;
@@ -2408,7 +2436,7 @@ static void book_save_pdf (Book* self, GFile* file, GError** error) {
offset_collection = _tmp373_;
for (offset_it = offset_collection; offset_it != NULL; offset_it = offset_it->next) {
guint offset = 0U;
- offset = GPOINTER_TO_UINT (offset_it->data);
+ offset = (guint) ((guintptr) offset_it->data);
{
PDFWriter* _tmp374_;
guint _tmp375_;
@@ -2708,7 +2736,33 @@ static void book_instance_init (Book * self) {
static void book_finalize (Book* obj) {
Book * self;
- self = BOOK (obj);
+ GList* _tmp0_;
+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BOOK, Book);
+ _tmp0_ = self->priv->pages;
+ {
+ GList* page_collection = NULL;
+ GList* page_it = NULL;
+ page_collection = _tmp0_;
+ for (page_it = page_collection; page_it != NULL; page_it = page_it->next) {
+ Page* _tmp1_;
+ Page* page = NULL;
+ _tmp1_ = _page_ref0 ((Page*) page_it->data);
+ page = _tmp1_;
+ {
+ Page* _tmp2_;
+ guint _tmp3_ = 0U;
+ Page* _tmp4_;
+ guint _tmp5_ = 0U;
+ _tmp2_ = page;
+ g_signal_parse_name ("pixels-changed", TYPE_PAGE, &_tmp3_, NULL, FALSE);
+ g_signal_handlers_disconnect_matched (_tmp2_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, 0, NULL, (GCallback) _book_page_changed_cb_page_pixels_changed, self);
+ _tmp4_ = page;
+ g_signal_parse_name ("crop-changed", TYPE_PAGE, &_tmp5_, NULL, FALSE);
+ g_signal_handlers_disconnect_matched (_tmp4_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp5_, 0, NULL, (GCallback) _book_page_changed_cb_page_crop_changed, self);
+ _page_unref0 (page);
+ }
+ }
+ }
__g_list_free__page_unref0_0 (self->priv->pages);
}
@@ -2797,7 +2851,7 @@ void pdf_writer_write (PDFWriter* self, guint8* data, int data_length1) {
_inner_error_ = NULL;
_tmp2_ = e;
_tmp3_ = _tmp2_->message;
- g_warning ("book.vala:547: Error writing PDF: %s", _tmp3_);
+ g_warning ("book.vala:562: Error writing PDF: %s", _tmp3_);
_g_error_free0 (e);
}
__finally0:
@@ -2863,8 +2917,8 @@ void pdf_writer_write_string (PDFWriter* self, const gchar* text) {
_tmp0_ = text;
_tmp2_ = string_to_utf8 (_tmp0_, &_tmp1_);
_tmp3_ = (guint8*) _tmp2_;
- _tmp3__length1 = _tmp1_;
- pdf_writer_write (self, _tmp3_, _tmp1_);
+ _tmp3__length1 = (_tmp1_ * sizeof (gchar)) / sizeof (guint8);
+ pdf_writer_write (self, _tmp3_, (_tmp1_ * sizeof (gchar)) / sizeof (guint8));
_tmp3_ = (g_free (_tmp3_), NULL);
}
@@ -2876,7 +2930,7 @@ guint pdf_writer_start_object (PDFWriter* self) {
guint _tmp2_ = 0U;
g_return_val_if_fail (self != NULL, 0U);
_tmp0_ = self->offset;
- self->object_offsets = g_list_append (self->object_offsets, GUINT_TO_POINTER ((guint) _tmp0_));
+ self->object_offsets = g_list_append (self->object_offsets, (gpointer) ((guintptr) ((guint) _tmp0_)));
_tmp1_ = self->object_offsets;
_tmp2_ = g_list_length (_tmp1_);
result = _tmp2_;
@@ -3010,7 +3064,7 @@ static void pdf_writer_instance_init (PDFWriter * self) {
static void pdf_writer_finalize (PDFWriter* obj) {
PDFWriter * self;
- self = PDF_WRITER (obj);
+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_PDF_WRITER, PDFWriter);
_g_list_free0 (self->object_offsets);
_g_object_unref0 (self->priv->stream);
}
@@ -3104,7 +3158,7 @@ static cairo_status_t ps_writer_write_cairo_data (PsWriter* self, guint8* data,
_inner_error_ = NULL;
_tmp2_ = e;
_tmp3_ = _tmp2_->message;
- g_warning ("book.vala:583: Error writing data: %s", _tmp3_);
+ g_warning ("book.vala:598: Error writing data: %s", _tmp3_);
result = CAIRO_STATUS_WRITE_ERROR;
_g_error_free0 (e);
return result;
@@ -3243,7 +3297,7 @@ static void ps_writer_instance_init (PsWriter * self) {
static void ps_writer_finalize (PsWriter* obj) {
PsWriter * self;
- self = PS_WRITER (obj);
+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_PS_WRITER, PsWriter);
_cairo_surface_destroy0 (self->surface);
_g_object_unref0 (self->stream);
}