summaryrefslogtreecommitdiff
path: root/src/autosave-manager.c
diff options
context:
space:
mode:
authorAlessio Treglia <alessio@debian.org>2014-04-10 15:37:02 +0100
committerAlessio Treglia <alessio@debian.org>2014-04-10 15:37:02 +0100
commite9ca3b0060facd753744602a3baca5a1effdbd83 (patch)
tree5acbac3a3a7b195d9a5e2ef101f5758ff9201369 /src/autosave-manager.c
parent2d71d20a62ca8f6989d86db58ce64c7a862675dd (diff)
Imported Upstream version 3.12.0upstream/3.12.0
Diffstat (limited to 'src/autosave-manager.c')
-rw-r--r--src/autosave-manager.c5113
1 files changed, 2194 insertions, 2919 deletions
diff --git a/src/autosave-manager.c b/src/autosave-manager.c
index a97cb6c..3cb458a 100644
--- a/src/autosave-manager.c
+++ b/src/autosave-manager.c
@@ -1,9 +1,10 @@
-/* autosave-manager.c generated by valac 0.20.1, the Vala compiler
+/* autosave-manager.c generated by valac 0.22.1, the Vala compiler
* generated from autosave-manager.vala, do not modify */
/*
* Copyright (C) 2011 Timo Kluck
- * Author: Timo Kluck <tkluck@infty.nl>
+ * Authors: Timo Kluck <tkluck@infty.nl>
+ * Robert Ancell <robert.ancell@canonical.com>
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
@@ -11,39 +12,13 @@
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
-/*
- * We store autosaves in a database named
- * ~/.cache/simple-scan/autosaves/autosaves.db
- * It contains a single table of pages, each containing the process id (pid) of
- * the simple-scan instance that saved it, and a hash of the Book and Page
- * objects corresponding to it. The pixels are saved as a BLOB.
- * Additionally, the autosaves directory contains a number of tiff files that
- * the user can use for manual recovery.
- *
- * At startup, we check whether autosaves.db contains any records
- * with a pid that does not match a current pid for simple-scan. If so, we take
- * ownership by an UPDATE statement changing to our own pid. Then, we
- * recover the book. We're trying our best to avoid the possible race
- * condition if several instances of simple-scan are started simultaneously.
- *
- * At application exit, we delete the records corresponding to our own pid.
- *
- * Important notes:
- * - We enforce that there is only one AutosaveManager instance in a given
- * process by using a create function.
- * - It should be possible to change the book object at runtime, although this
- * is not used in the current implementation so it has not been tested.
- */
#include <glib.h>
#include <glib-object.h>
-#include <sqlite3.h>
#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
#include <gio/gio.h>
-#include <float.h>
-#include <math.h>
+#include <glib/gstdio.h>
#include <gobject/gvaluecollector.h>
@@ -58,16 +33,6 @@ typedef struct _AutosaveManager AutosaveManager;
typedef struct _AutosaveManagerClass AutosaveManagerClass;
typedef struct _AutosaveManagerPrivate AutosaveManagerPrivate;
-#define TYPE_BOOK (book_get_type ())
-#define BOOK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BOOK, Book))
-#define BOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BOOK, BookClass))
-#define IS_BOOK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BOOK))
-#define IS_BOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BOOK))
-#define BOOK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BOOK, BookClass))
-
-typedef struct _Book Book;
-typedef struct _BookClass BookClass;
-
#define TYPE_PAGE (page_get_type ())
#define PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PAGE, Page))
#define PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PAGE, PageClass))
@@ -77,29 +42,26 @@ typedef struct _BookClass BookClass;
typedef struct _Page Page;
typedef struct _PageClass PageClass;
-#define _sqlite3_close0(var) ((var == NULL) ? NULL : (var = (sqlite3_close (var), NULL)))
-#define _book_unref0(var) ((var == NULL) ? NULL : (var = (book_unref (var), NULL)))
+
+#define TYPE_BOOK (book_get_type ())
+#define BOOK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BOOK, Book))
+#define BOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BOOK, BookClass))
+#define IS_BOOK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BOOK))
+#define IS_BOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BOOK))
+#define BOOK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BOOK, BookClass))
+
+typedef struct _Book Book;
+typedef struct _BookClass BookClass;
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
-#define _autosave_manager_unref0(var) ((var == NULL) ? NULL : (var = (autosave_manager_unref (var), NULL)))
-#define _g_free0(var) (var = (g_free (var), NULL))
-#define _sqlite3_finalize0(var) ((var == NULL) ? NULL : (var = (sqlite3_finalize (var), NULL)))
+#define _book_unref0(var) ((var == NULL) ? NULL : (var = (book_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
-#define _page_unref0(var) ((var == NULL) ? NULL : (var = (page_unref (var), NULL)))
-#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_key_file_unref0(var) ((var == NULL) ? NULL : (var = (g_key_file_unref (var), NULL)))
#define TYPE_SCAN_DIRECTION (scan_direction_get_type ())
-
-#define TYPE_SCAN_PAGE_INFO (scan_page_info_get_type ())
-#define SCAN_PAGE_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SCAN_PAGE_INFO, ScanPageInfo))
-#define SCAN_PAGE_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SCAN_PAGE_INFO, ScanPageInfoClass))
-#define IS_SCAN_PAGE_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SCAN_PAGE_INFO))
-#define IS_SCAN_PAGE_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SCAN_PAGE_INFO))
-#define SCAN_PAGE_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SCAN_PAGE_INFO, ScanPageInfoClass))
-
-typedef struct _ScanPageInfo ScanPageInfo;
-typedef struct _ScanPageInfoClass ScanPageInfoClass;
-typedef struct _ScanPageInfoPrivate ScanPageInfoPrivate;
-#define _scan_page_info_unref0(var) ((var == NULL) ? NULL : (var = (scan_page_info_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 _page_unref0(var) ((var == NULL) ? NULL : (var = (page_unref (var), NULL)))
+#define _g_dir_close0(var) ((var == NULL) ? NULL : (var = (g_dir_close (var), NULL)))
typedef struct _ParamSpecAutosaveManager ParamSpecAutosaveManager;
struct _AutosaveManager {
@@ -114,11 +76,9 @@ struct _AutosaveManagerClass {
};
struct _AutosaveManagerPrivate {
- sqlite3* database_connection;
- Book* _book;
guint update_timeout;
- GHashTable* dirty_pages;
- gint cur_book_revision;
+ GHashTable* page_filenames;
+ Book* book_;
};
typedef enum {
@@ -128,23 +88,6 @@ typedef enum {
SCAN_DIRECTION_RIGHT_TO_LEFT
} ScanDirection;
-struct _ScanPageInfo {
- GTypeInstance parent_instance;
- volatile int ref_count;
- ScanPageInfoPrivate * priv;
- gint width;
- gint height;
- gint depth;
- gint n_channels;
- gdouble dpi;
- gchar* device;
-};
-
-struct _ScanPageInfoClass {
- GTypeClass parent_class;
- void (*finalize) (ScanPageInfo *self);
-};
-
struct _ParamSpecAutosaveManager {
GParamSpec parent_instance;
};
@@ -153,16 +96,10 @@ struct _ParamSpecAutosaveManager {
static gpointer autosave_manager_parent_class = NULL;
static gchar* autosave_manager_AUTOSAVE_DIR;
static gchar* autosave_manager_AUTOSAVE_DIR = NULL;
-static gchar* autosave_manager_AUTOSAVE_NAME;
-static gchar* autosave_manager_AUTOSAVE_NAME = NULL;
-static gchar* autosave_manager_AUTOSAVE_EXT;
-static gchar* autosave_manager_AUTOSAVE_EXT = NULL;
static gchar* autosave_manager_AUTOSAVE_FILENAME;
static gchar* autosave_manager_AUTOSAVE_FILENAME = NULL;
-static gchar* autosave_manager_PID;
-static gchar* autosave_manager_PID = NULL;
-static gint autosave_manager_number_of_instances;
-static gint autosave_manager_number_of_instances = 0;
+static gchar* autosave_manager_AUTOSAVE_PATH;
+static gchar* autosave_manager_AUTOSAVE_PATH = NULL;
gpointer autosave_manager_ref (gpointer instance);
void autosave_manager_unref (gpointer instance);
@@ -171,13 +108,6 @@ void value_set_autosave_manager (GValue* value, gpointer v_object);
void value_take_autosave_manager (GValue* value, gpointer v_object);
gpointer value_get_autosave_manager (const GValue* value);
GType autosave_manager_get_type (void) G_GNUC_CONST;
-gpointer book_ref (gpointer instance);
-void book_unref (gpointer instance);
-GParamSpec* param_spec_book (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-void value_set_book (GValue* value, gpointer v_object);
-void value_take_book (GValue* value, gpointer v_object);
-gpointer value_get_book (const GValue* value);
-GType book_get_type (void) G_GNUC_CONST;
gpointer page_ref (gpointer instance);
void page_unref (gpointer instance);
GParamSpec* param_spec_page (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
@@ -185,2988 +115,2329 @@ void value_set_page (GValue* value, gpointer v_object);
void value_take_page (GValue* value, gpointer v_object);
gpointer value_get_page (const GValue* value);
GType page_get_type (void) G_GNUC_CONST;
+gpointer book_ref (gpointer instance);
+void book_unref (gpointer instance);
+GParamSpec* param_spec_book (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
+void value_set_book (GValue* value, gpointer v_object);
+void value_take_book (GValue* value, gpointer v_object);
+gpointer value_get_book (const GValue* value);
+GType book_get_type (void) G_GNUC_CONST;
#define AUTOSAVE_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_AUTOSAVE_MANAGER, AutosaveManagerPrivate))
enum {
AUTOSAVE_MANAGER_DUMMY_PROPERTY
};
-AutosaveManager* autosave_manager_create (Book** book);
-static AutosaveManager* autosave_manager_new (void);
-static AutosaveManager* autosave_manager_construct (GType object_type);
-static sqlite3* autosave_manager_open_database_connection (GError** error);
-static void autosave_manager_recover_book (AutosaveManager* self, Book** book);
-void autosave_manager_set_book (AutosaveManager* self, Book* value);
-guint book_get_n_pages (Book* self);
-Page* book_get_page (Book* self, gint page_number);
-static void autosave_manager_on_page_added (AutosaveManager* self, Page* page);
+AutosaveManager* autosave_manager_new (void);
+AutosaveManager* autosave_manager_construct (GType object_type);
static void _page_unref0_ (gpointer var);
+static void _g_free0_ (gpointer var);
+void autosave_manager_load (AutosaveManager* self);
+Book* autosave_manager_get_book (AutosaveManager* self);
+void book_clear (Book* self);
+static gchar* autosave_manager_get_value (AutosaveManager* self, GKeyFile* file, const gchar* group_name, const gchar* key, const gchar* _default_);
+static gint autosave_manager_get_integer (AutosaveManager* self, GKeyFile* file, const gchar* group_name, const gchar* key, gint _default_);
+GType scan_direction_get_type (void) G_GNUC_CONST;
+static gboolean autosave_manager_get_boolean (AutosaveManager* self, GKeyFile* file, const gchar* group_name, const gchar* key, gboolean _default_);
+Page* page_new_from_data (gint scan_width, gint scan_height, gint rowstride, gint n_channels, gint depth, gint dpi, ScanDirection scan_direction, const gchar* color_profile, guchar* pixels, int pixels_length1, gboolean has_crop, const gchar* crop_name, gint crop_x, gint crop_y, gint crop_width, gint crop_height);
+Page* page_construct_from_data (GType object_type, gint scan_width, gint scan_height, gint rowstride, gint n_channels, gint depth, gint dpi, ScanDirection scan_direction, const gchar* color_profile, guchar* pixels, int pixels_length1, gboolean has_crop, const gchar* crop_name, gint crop_x, gint crop_y, gint crop_width, gint crop_height);
+void book_append_page (Book* self, Page* page);
void autosave_manager_cleanup (AutosaveManager* self);
-static void autosave_manager_insert_page (AutosaveManager* self, Page* page);
-void autosave_manager_on_page_changed (AutosaveManager* self, Page* page);
-static void _autosave_manager_on_page_changed_page_size_changed (Page* _sender, gpointer self);
-static void _autosave_manager_on_page_changed_page_scan_direction_changed (Page* _sender, gpointer self);
-static void _autosave_manager_on_page_changed_page_crop_changed (Page* _sender, gpointer self);
-static void _autosave_manager_on_page_changed_page_scan_finished (Page* _sender, gpointer self);
+void autosave_manager_on_page_added (AutosaveManager* self, Page* page);
+void autosave_manager_on_scan_finished (AutosaveManager* self, Page* page);
+static void _autosave_manager_on_scan_finished_page_scan_finished (Page* _sender, gpointer self);
+void autosave_manager_on_changed (AutosaveManager* self);
+static void _autosave_manager_on_changed_page_crop_changed (Page* _sender, gpointer self);
void autosave_manager_on_page_removed (AutosaveManager* self, Page* page);
-static void _autosave_manager_on_page_changed_page_pixels_changed (Page* _sender, gpointer self);
-Book* autosave_manager_get_book (AutosaveManager* self);
-void autosave_manager_on_reordered (AutosaveManager* self);
-static void autosave_manager_update_page (AutosaveManager* self, Page* page);
-void autosave_manager_on_needs_saving_changed (AutosaveManager* self, Book* book);
+static void autosave_manager_save_pixels (AutosaveManager* self, Page* page);
+static void autosave_manager_save (AutosaveManager* self, gboolean do_timeout);
void autosave_manager_on_cleared (AutosaveManager* self);
-static gboolean __lambda2_ (AutosaveManager* self);
-static void autosave_manager_real_update_page (AutosaveManager* self, Page* page);
-static gboolean ___lambda2__gsource_func (gpointer self);
-void page_get_crop (Page* self, gint* x, gint* y, gint* width, gint* height);
-guint book_get_page_index (Book* self, Page* page);
-gint page_get_dpi (Page* self);
-gint page_get_width (Page* self);
-gint page_get_height (Page* self);
-gint page_get_depth (Page* self);
-gint page_get_n_channels (Page* self);
+static gboolean ___lambda2_ (AutosaveManager* self);
+static void autosave_manager_real_save (AutosaveManager* self);
+static gboolean ____lambda2__gsource_func (gpointer self);
+guint book_get_n_pages (Book* self);
+Page* book_get_page (Book* self, gint page_number);
+gboolean page_get_has_data (Page* self);
+gint page_get_scan_width (Page* self);
+gint page_get_scan_height (Page* self);
gint page_get_rowstride (Page* self);
-GType scan_direction_get_type (void) G_GNUC_CONST;
+gint page_get_n_channels (Page* self);
+gint page_get_depth (Page* self);
+gint page_get_dpi (Page* self);
ScanDirection page_get_scan_direction (Page* self);
-gchar* page_get_color_profile (Page* self);
+const gchar* page_get_color_profile (Page* self);
+gboolean page_get_has_crop (Page* self);
+const gchar* page_get_crop_name (Page* self);
+gint page_get_crop_x (Page* self);
+gint page_get_crop_y (Page* self);
+gint page_get_crop_width (Page* self);
+gint page_get_crop_height (Page* self);
guchar* page_get_pixels (Page* self, int* result_length1);
-void book_clear (Book* self);
-Page* book_append_page (Book* self, gint width, gint height, gint dpi, ScanDirection scan_direction);
-ScanPageInfo* scan_page_info_new (void);
-ScanPageInfo* scan_page_info_construct (GType object_type);
-gpointer scan_page_info_ref (gpointer instance);
-void scan_page_info_unref (gpointer instance);
-GParamSpec* param_spec_scan_page_info (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-void value_set_scan_page_info (GValue* value, gpointer v_object);
-void value_take_scan_page_info (GValue* value, gpointer v_object);
-gpointer value_get_scan_page_info (const GValue* value);
-GType scan_page_info_get_type (void) G_GNUC_CONST;
-void page_set_page_info (Page* self, ScanPageInfo* info);
-void page_set_color_profile (Page* self, const gchar* color_profile);
-void page_set_custom_crop (Page* self, gint width, gint height);
-void page_move_crop (Page* self, gint x, gint y);
-void page_set_pixels (Page* self, guchar* new_pixels, int new_pixels_length1);
+void autosave_manager_set_book (AutosaveManager* self, Book* value);
static void _autosave_manager_on_page_added_book_page_added (Book* _sender, Page* page, gpointer self);
static void _autosave_manager_on_page_removed_book_page_removed (Book* _sender, Page* page, gpointer self);
-static void _autosave_manager_on_reordered_book_reordered (Book* _sender, gpointer self);
+static void _autosave_manager_on_changed_book_reordered (Book* _sender, gpointer self);
static void _autosave_manager_on_cleared_book_cleared (Book* _sender, gpointer self);
static void autosave_manager_finalize (AutosaveManager* obj);
+static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
+static gint _vala_array_length (gpointer array);
-static gchar* string_strip (const gchar* self) {
- gchar* result = NULL;
- gchar* _tmp0_ = NULL;
- gchar* _result_;
- const gchar* _tmp1_;
-#line 1085 "/usr/share/vala-0.20/vapi/glib-2.0.vapi"
- g_return_val_if_fail (self != NULL, NULL);
-#line 1086 "/usr/share/vala-0.20/vapi/glib-2.0.vapi"
- _tmp0_ = g_strdup (self);
-#line 1086 "/usr/share/vala-0.20/vapi/glib-2.0.vapi"
- _result_ = _tmp0_;
-#line 1087 "/usr/share/vala-0.20/vapi/glib-2.0.vapi"
- _tmp1_ = _result_;
-#line 1087 "/usr/share/vala-0.20/vapi/glib-2.0.vapi"
- g_strstrip (_tmp1_);
-#line 1088 "/usr/share/vala-0.20/vapi/glib-2.0.vapi"
- result = _result_;
-#line 1088 "/usr/share/vala-0.20/vapi/glib-2.0.vapi"
- return result;
-#line 274 "autosave-manager.c"
+static void _page_unref0_ (gpointer var) {
+#line 59 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ (var == NULL) ? NULL : (var = (page_unref (var), NULL));
+#line 189 "autosave-manager.c"
}
-static const gchar* string_to_string (const gchar* self) {
- const gchar* result = NULL;
-#line 1274 "/usr/share/vala-0.20/vapi/glib-2.0.vapi"
- g_return_val_if_fail (self != NULL, NULL);
-#line 1275 "/usr/share/vala-0.20/vapi/glib-2.0.vapi"
- result = self;
-#line 1275 "/usr/share/vala-0.20/vapi/glib-2.0.vapi"
- return result;
-#line 286 "autosave-manager.c"
+static void _g_free0_ (gpointer var) {
+#line 59 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ var = (g_free (var), NULL);
+#line 196 "autosave-manager.c"
+}
+
+
+AutosaveManager* autosave_manager_construct (GType object_type) {
+ AutosaveManager* self = NULL;
+ GHashFunc _tmp0_ = NULL;
+ GEqualFunc _tmp1_ = NULL;
+ GHashTable* _tmp2_ = NULL;
+#line 57 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ self = (AutosaveManager*) g_type_create_instance (object_type);
+#line 59 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp0_ = g_direct_hash;
+#line 59 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp1_ = g_direct_equal;
+#line 59 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _page_unref0_, _g_free0_);
+#line 59 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_hash_table_unref0 (self->priv->page_filenames);
+#line 59 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ self->priv->page_filenames = _tmp2_;
+#line 57 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ return self;
+#line 219 "autosave-manager.c"
+}
+
+
+AutosaveManager* autosave_manager_new (void) {
+#line 57 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ return autosave_manager_construct (TYPE_AUTOSAVE_MANAGER);
+#line 226 "autosave-manager.c"
+}
+
+
+static gpointer _page_ref0 (gpointer self) {
+#line 151 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ return self ? page_ref (self) : NULL;
+#line 233 "autosave-manager.c"
}
-AutosaveManager* autosave_manager_create (Book** book) {
- AutosaveManager* result = NULL;
- gint _tmp0_;
- AutosaveManager* _tmp1_;
- AutosaveManager* man;
- gint _tmp2_;
- gboolean any_pages_recovered;
- AutosaveManager* _tmp51_;
- Book* _tmp52_;
- gboolean _tmp53_;
+void autosave_manager_load (AutosaveManager* self) {
+ Book* _tmp0_ = NULL;
+ Book* _tmp1_ = NULL;
+ GHashTable* _tmp2_ = NULL;
+ GKeyFile* file = NULL;
+ GKeyFile* _tmp3_ = NULL;
+ gchar* pages = NULL;
+ GKeyFile* _tmp6_ = NULL;
+ gchar* _tmp7_ = NULL;
+ const gchar* _tmp8_ = NULL;
+ gchar** _tmp9_ = NULL;
+ gchar** _tmp10_ = NULL;
GError * _inner_error_ = NULL;
-#line 85 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_return_val_if_fail (*book != NULL, NULL);
-#line 92 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp0_ = autosave_manager_number_of_instances;
-#line 92 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp0_ > 0) {
-#line 93 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_assert_not_reached ();
-#line 309 "autosave-manager.c"
- }
-#line 95 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp1_ = autosave_manager_new ();
-#line 95 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- man = _tmp1_;
-#line 96 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp2_ = autosave_manager_number_of_instances;
-#line 96 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- autosave_manager_number_of_instances = _tmp2_ + 1;
-#line 319 "autosave-manager.c"
+#line 62 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_return_if_fail (self != NULL);
+#line 64 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_debug ("autosave-manager.vala:64: Loading autosave information");
+#line 66 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp0_ = autosave_manager_get_book (self);
+#line 66 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp1_ = _tmp0_;
+#line 66 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ book_clear (_tmp1_);
+#line 67 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp2_ = self->priv->page_filenames;
+#line 67 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_hash_table_remove_all (_tmp2_);
+#line 69 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp3_ = g_key_file_new ();
+#line 69 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ file = _tmp3_;
+#line 268 "autosave-manager.c"
{
- sqlite3* _tmp3_ = NULL;
- sqlite3* _tmp4_;
- AutosaveManager* _tmp5_;
-#line 100 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp3_ = autosave_manager_open_database_connection (&_inner_error_);
-#line 100 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp4_ = _tmp3_;
-#line 100 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ GKeyFile* _tmp4_ = NULL;
+ const gchar* _tmp5_ = NULL;
+#line 72 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp4_ = file;
+#line 72 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp5_ = autosave_manager_AUTOSAVE_PATH;
+#line 72 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_key_file_load_from_file (_tmp4_, _tmp5_, G_KEY_FILE_NONE, &_inner_error_);
+#line 72 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (_inner_error_ != NULL) {
-#line 330 "autosave-manager.c"
- goto __catch23_g_error;
+#line 280 "autosave-manager.c"
+ goto __catch28_g_error;
}
-#line 100 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp5_ = man;
-#line 100 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _sqlite3_close0 (_tmp5_->priv->database_connection);
-#line 100 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp5_->priv->database_connection = _tmp4_;
-#line 339 "autosave-manager.c"
}
- goto __finally23;
- __catch23_g_error:
+ goto __finally28;
+ __catch28_g_error:
{
-#line 98 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_clear_error (&_inner_error_);
-#line 98 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ GError* e = NULL;
+#line 70 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ e = _inner_error_;
+#line 70 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_inner_error_ = NULL;
-#line 104 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_warning ("autosave-manager.vala:104: Could not connect to the autosave database;" \
-" no autosaves will be kept.");
-#line 105 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- result = NULL;
-#line 105 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _autosave_manager_unref0 (man);
-#line 105 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- return result;
-#line 356 "autosave-manager.c"
+#line 76 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_warning ("autosave-manager.vala:76: Could not load autosave infomation; not rest" \
+"oring any autosaves");
+#line 77 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_error_free0 (e);
+#line 77 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_key_file_unref0 (file);
+#line 77 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ return;
+#line 300 "autosave-manager.c"
}
- __finally23:
-#line 98 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ __finally28:
+#line 70 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (_inner_error_ != NULL) {
-#line 98 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _autosave_manager_unref0 (man);
-#line 98 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 70 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_key_file_unref0 (file);
+#line 70 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-#line 98 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 70 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_clear_error (&_inner_error_);
-#line 98 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- return NULL;
-#line 369 "autosave-manager.c"
+#line 70 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ return;
+#line 313 "autosave-manager.c"
}
-#line 108 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- any_pages_recovered = FALSE;
-#line 373 "autosave-manager.c"
+#line 79 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp6_ = file;
+#line 79 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp7_ = autosave_manager_get_value (self, _tmp6_, "simple-scan", "pages", "");
+#line 79 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ pages = _tmp7_;
+#line 80 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp8_ = pages;
+#line 80 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp10_ = _tmp9_ = g_strsplit (_tmp8_, " ", 0);
+#line 325 "autosave-manager.c"
{
- gchar* current_pids = NULL;
- gchar* _tmp6_ = NULL;
- const gchar* _tmp7_;
- gchar* _tmp8_ = NULL;
- sqlite3_stmt* stmt = NULL;
- const gchar* _tmp9_;
- const gchar* _tmp10_ = NULL;
- gchar* _tmp11_ = NULL;
- gchar* query;
- AutosaveManager* _tmp12_;
- sqlite3* _tmp13_;
- const gchar* _tmp14_;
- sqlite3_stmt* _tmp15_ = NULL;
- gint _tmp16_ = 0;
- gint _result_;
- gint _tmp17_;
-#line 113 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_spawn_command_line_sync ("pidof simple-scan | sed \"s/ /,/g\"", &_tmp6_, NULL, NULL, &_inner_error_);
-#line 113 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (current_pids);
-#line 113 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- current_pids = _tmp6_;
-#line 113 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_inner_error_ != NULL) {
-#line 113 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (current_pids);
-#line 113 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_inner_error_->domain == G_SPAWN_ERROR) {
-#line 403 "autosave-manager.c"
- goto __catch24_g_spawn_error;
- }
-#line 113 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (current_pids);
-#line 113 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _autosave_manager_unref0 (man);
-#line 113 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+ gchar** page_name_collection = NULL;
+ gint page_name_collection_length1 = 0;
+ gint _page_name_collection_size_ = 0;
+ gint page_name_it = 0;
+#line 80 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ page_name_collection = _tmp10_;
+#line 80 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ page_name_collection_length1 = _vala_array_length (_tmp9_);
+#line 80 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ for (page_name_it = 0; page_name_it < _vala_array_length (_tmp9_); page_name_it = page_name_it + 1) {
+#line 337 "autosave-manager.c"
+ gchar* _tmp11_ = NULL;
+ gchar* page_name = NULL;
+#line 80 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp11_ = g_strdup (page_name_collection[page_name_it]);
+#line 80 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ page_name = _tmp11_;
+#line 344 "autosave-manager.c"
+ {
+ const gchar* _tmp12_ = NULL;
+ gint scan_width = 0;
+ GKeyFile* _tmp13_ = NULL;
+ const gchar* _tmp14_ = NULL;
+ gint _tmp15_ = 0;
+ gint scan_height = 0;
+ GKeyFile* _tmp16_ = NULL;
+ const gchar* _tmp17_ = NULL;
+ gint _tmp18_ = 0;
+ gint rowstride = 0;
+ GKeyFile* _tmp19_ = NULL;
+ const gchar* _tmp20_ = NULL;
+ gint _tmp21_ = 0;
+ gint n_channels = 0;
+ GKeyFile* _tmp22_ = NULL;
+ const gchar* _tmp23_ = NULL;
+ gint _tmp24_ = 0;
+ gint depth = 0;
+ GKeyFile* _tmp25_ = NULL;
+ const gchar* _tmp26_ = NULL;
+ gint _tmp27_ = 0;
+ gint dpi = 0;
+ GKeyFile* _tmp28_ = NULL;
+ const gchar* _tmp29_ = NULL;
+ gint _tmp30_ = 0;
+ gchar* scan_direction_name = NULL;
+ GKeyFile* _tmp31_ = NULL;
+ const gchar* _tmp32_ = NULL;
+ gchar* _tmp33_ = NULL;
+ ScanDirection scan_direction = 0;
+ const gchar* _tmp34_ = NULL;
+ const gchar* _tmp35_ = NULL;
+ GQuark _tmp37_ = 0U;
+#line 92 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ static GQuark _tmp36_label0 = 0;
+#line 92 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ static GQuark _tmp36_label1 = 0;
+#line 92 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ static GQuark _tmp36_label2 = 0;
+#line 92 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ static GQuark _tmp36_label3 = 0;
+#line 387 "autosave-manager.c"
+ gchar* color_profile = NULL;
+ GKeyFile* _tmp38_ = NULL;
+ const gchar* _tmp39_ = NULL;
+ gchar* _tmp40_ = NULL;
+ const gchar* _tmp41_ = NULL;
+ gchar* pixels_filename = NULL;
+ GKeyFile* _tmp42_ = NULL;
+ const gchar* _tmp43_ = NULL;
+ gchar* _tmp44_ = NULL;
+ gboolean has_crop = FALSE;
+ GKeyFile* _tmp45_ = NULL;
+ const gchar* _tmp46_ = NULL;
+ gboolean _tmp47_ = FALSE;
+ gchar* crop_name = NULL;
+ GKeyFile* _tmp48_ = NULL;
+ const gchar* _tmp49_ = NULL;
+ gchar* _tmp50_ = NULL;
+ const gchar* _tmp51_ = NULL;
+ gint crop_x = 0;
+ GKeyFile* _tmp52_ = NULL;
+ const gchar* _tmp53_ = NULL;
+ gint _tmp54_ = 0;
+ gint crop_y = 0;
+ GKeyFile* _tmp55_ = NULL;
+ const gchar* _tmp56_ = NULL;
+ gint _tmp57_ = 0;
+ gint crop_width = 0;
+ GKeyFile* _tmp58_ = NULL;
+ const gchar* _tmp59_ = NULL;
+ gint _tmp60_ = 0;
+ gint crop_height = 0;
+ GKeyFile* _tmp61_ = NULL;
+ const gchar* _tmp62_ = NULL;
+ gint _tmp63_ = 0;
+ guchar* pixels = NULL;
+ gint pixels_length1 = 0;
+ gint _pixels_size_ = 0;
+ const gchar* _tmp64_ = NULL;
+ Page* page = NULL;
+ gint _tmp73_ = 0;
+ gint _tmp74_ = 0;
+ gint _tmp75_ = 0;
+ gint _tmp76_ = 0;
+ gint _tmp77_ = 0;
+ gint _tmp78_ = 0;
+ ScanDirection _tmp79_ = 0;
+ const gchar* _tmp80_ = NULL;
+ guchar* _tmp81_ = NULL;
+ gint _tmp81__length1 = 0;
+ gboolean _tmp82_ = FALSE;
+ const gchar* _tmp83_ = NULL;
+ gint _tmp84_ = 0;
+ gint _tmp85_ = 0;
+ gint _tmp86_ = 0;
+ gint _tmp87_ = 0;
+ Page* _tmp88_ = NULL;
+ GHashTable* _tmp89_ = NULL;
+ Page* _tmp90_ = NULL;
+ Page* _tmp91_ = NULL;
+ const gchar* _tmp92_ = NULL;
+ gchar* _tmp93_ = NULL;
+ Book* _tmp94_ = NULL;
+ Book* _tmp95_ = NULL;
+ Page* _tmp96_ = NULL;
+#line 82 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp12_ = page_name;
+#line 82 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_debug ("autosave-manager.vala:82: Loading automatically saved page %s", _tmp12_);
+#line 84 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp13_ = file;
+#line 84 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp14_ = page_name;
+#line 84 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp15_ = autosave_manager_get_integer (self, _tmp13_, _tmp14_, "scan-width", 0);
+#line 84 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ scan_width = _tmp15_;
+#line 85 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp16_ = file;
+#line 85 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp17_ = page_name;
+#line 85 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp18_ = autosave_manager_get_integer (self, _tmp16_, _tmp17_, "scan-height", 0);
+#line 85 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ scan_height = _tmp18_;
+#line 86 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp19_ = file;
+#line 86 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp20_ = page_name;
+#line 86 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp21_ = autosave_manager_get_integer (self, _tmp19_, _tmp20_, "rowstride", 0);
+#line 86 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ rowstride = _tmp21_;
+#line 87 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp22_ = file;
+#line 87 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp23_ = page_name;
+#line 87 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp24_ = autosave_manager_get_integer (self, _tmp22_, _tmp23_, "n-channels", 0);
+#line 87 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ n_channels = _tmp24_;
+#line 88 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp25_ = file;
+#line 88 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp26_ = page_name;
+#line 88 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp27_ = autosave_manager_get_integer (self, _tmp25_, _tmp26_, "depth", 0);
+#line 88 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ depth = _tmp27_;
+#line 89 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp28_ = file;
+#line 89 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp29_ = page_name;
+#line 89 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp30_ = autosave_manager_get_integer (self, _tmp28_, _tmp29_, "dpi", 0);
+#line 89 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ dpi = _tmp30_;
+#line 90 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp31_ = file;
+#line 90 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp32_ = page_name;
+#line 90 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp33_ = autosave_manager_get_value (self, _tmp31_, _tmp32_, "scan-direction", "");
+#line 90 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ scan_direction_name = _tmp33_;
+#line 91 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ scan_direction = SCAN_DIRECTION_TOP_TO_BOTTOM;
+#line 92 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp34_ = scan_direction_name;
+#line 92 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp35_ = _tmp34_;
+#line 92 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp37_ = (NULL == _tmp35_) ? 0 : g_quark_from_string (_tmp35_);
+#line 92 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ if (_tmp37_ == ((0 != _tmp36_label0) ? _tmp36_label0 : (_tmp36_label0 = g_quark_from_static_string ("TOP_TO_BOTTOM")))) {
+#line 92 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ switch (0) {
+#line 524 "autosave-manager.c"
+ default:
+ {
+#line 95 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ scan_direction = SCAN_DIRECTION_TOP_TO_BOTTOM;
+#line 96 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ break;
+#line 531 "autosave-manager.c"
+ }
+ }
+ } else if (_tmp37_ == ((0 != _tmp36_label1) ? _tmp36_label1 : (_tmp36_label1 = g_quark_from_static_string ("LEFT_TO_RIGHT")))) {
+#line 92 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ switch (0) {
+#line 537 "autosave-manager.c"
+ default:
+ {
+#line 98 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ scan_direction = SCAN_DIRECTION_LEFT_TO_RIGHT;
+#line 99 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ break;
+#line 544 "autosave-manager.c"
+ }
+ }
+ } else if (_tmp37_ == ((0 != _tmp36_label2) ? _tmp36_label2 : (_tmp36_label2 = g_quark_from_static_string ("BOTTOM_TO_TOP")))) {
+#line 92 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ switch (0) {
+#line 550 "autosave-manager.c"
+ default:
+ {
+#line 101 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ scan_direction = SCAN_DIRECTION_BOTTOM_TO_TOP;
+#line 102 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ break;
+#line 557 "autosave-manager.c"
+ }
+ }
+ } else if (_tmp37_ == ((0 != _tmp36_label3) ? _tmp36_label3 : (_tmp36_label3 = g_quark_from_static_string ("RIGHT_TO_LEFT")))) {
+#line 92 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ switch (0) {
+#line 563 "autosave-manager.c"
+ default:
+ {
+#line 104 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ scan_direction = SCAN_DIRECTION_RIGHT_TO_LEFT;
+#line 105 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ break;
+#line 570 "autosave-manager.c"
+ }
+ }
+ }
+#line 107 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp38_ = file;
+#line 107 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp39_ = page_name;
+#line 107 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp40_ = autosave_manager_get_value (self, _tmp38_, _tmp39_, "color-profile", "");
+#line 107 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ color_profile = _tmp40_;
+#line 108 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp41_ = color_profile;
+#line 108 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ if (g_strcmp0 (_tmp41_, "") == 0) {
+#line 109 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (color_profile);
+#line 109 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ color_profile = NULL;
+#line 590 "autosave-manager.c"
+ }
+#line 110 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp42_ = file;
+#line 110 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp43_ = page_name;
+#line 110 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp44_ = autosave_manager_get_value (self, _tmp42_, _tmp43_, "pixels-filename", "");
+#line 110 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ pixels_filename = _tmp44_;
+#line 111 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp45_ = file;
+#line 111 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp46_ = page_name;
+#line 111 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp47_ = autosave_manager_get_boolean (self, _tmp45_, _tmp46_, "has-crop", FALSE);
+#line 111 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ has_crop = _tmp47_;
+#line 112 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp48_ = file;
+#line 112 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp49_ = page_name;
+#line 112 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp50_ = autosave_manager_get_value (self, _tmp48_, _tmp49_, "crop-name", "");
+#line 112 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ crop_name = _tmp50_;
#line 113 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_clear_error (&_inner_error_);
+ _tmp51_ = crop_name;
#line 113 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- return NULL;
-#line 416 "autosave-manager.c"
- }
-#line 114 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp7_ = current_pids;
+ if (g_strcmp0 (_tmp51_, "") == 0) {
#line 114 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp8_ = string_strip (_tmp7_);
+ _g_free0 (crop_name);
#line 114 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (current_pids);
-#line 114 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- current_pids = _tmp8_;
+ crop_name = NULL;
+#line 624 "autosave-manager.c"
+ }
+#line 115 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp52_ = file;
+#line 115 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp53_ = page_name;
+#line 115 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp54_ = autosave_manager_get_integer (self, _tmp52_, _tmp53_, "crop-x", 0);
+#line 115 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ crop_x = _tmp54_;
#line 116 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp9_ = current_pids;
+ _tmp55_ = file;
#line 116 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp10_ = string_to_string (_tmp9_);
+ _tmp56_ = page_name;
#line 116 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp11_ = g_strconcat ("\n" \
-" SELECT process_id, book_hash, book_revision FROM pa" \
-"ges\n" \
-" WHERE NOT process_id IN (", _tmp10_, ")\n LIMIT 1\n ", NULL);
+ _tmp57_ = autosave_manager_get_integer (self, _tmp55_, _tmp56_, "crop-y", 0);
#line 116 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- query = _tmp11_;
-#line 122 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp12_ = man;
-#line 122 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp13_ = _tmp12_->priv->database_connection;
-#line 122 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp14_ = query;
-#line 122 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp16_ = sqlite3_prepare_v2 (_tmp13_, _tmp14_, -1, &_tmp15_, NULL);
-#line 122 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _sqlite3_finalize0 (stmt);
-#line 122 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- stmt = _tmp15_;
-#line 122 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _result_ = _tmp16_;
+ crop_y = _tmp57_;
+#line 117 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp58_ = file;
+#line 117 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp59_ = page_name;
+#line 117 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp60_ = autosave_manager_get_integer (self, _tmp58_, _tmp59_, "crop-width", 0);
+#line 117 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ crop_width = _tmp60_;
+#line 118 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp61_ = file;
+#line 118 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp62_ = page_name;
+#line 118 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp63_ = autosave_manager_get_integer (self, _tmp61_, _tmp62_, "crop-height", 0);
+#line 118 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ crop_height = _tmp63_;
+#line 120 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ pixels = NULL;
+#line 120 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ pixels_length1 = 0;
+#line 120 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _pixels_size_ = pixels_length1;
+#line 121 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp64_ = pixels_filename;
+#line 121 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ if (g_strcmp0 (_tmp64_, "") != 0) {
+#line 668 "autosave-manager.c"
+ gchar* path = NULL;
+ const gchar* _tmp65_ = NULL;
+ const gchar* _tmp66_ = NULL;
+ gchar* _tmp67_ = NULL;
+ GFile* f = NULL;
+ const gchar* _tmp68_ = NULL;
+ GFile* _tmp69_ = NULL;
+#line 123 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp65_ = autosave_manager_AUTOSAVE_DIR;
#line 123 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp17_ = _result_;
+ _tmp66_ = pixels_filename;
#line 123 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp17_ == SQLITE_OK) {
+ _tmp67_ = g_build_filename (_tmp65_, _tmp66_, NULL);
+#line 123 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ path = _tmp67_;
+#line 124 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp68_ = path;
+#line 124 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp69_ = g_file_new_for_path (_tmp68_);
+#line 124 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ f = _tmp69_;
+#line 690 "autosave-manager.c"
+ {
+ GFile* _tmp70_ = NULL;
+ guint8* _tmp71_ = NULL;
+ gsize _tmp72_;
+#line 127 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp70_ = f;
+#line 127 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_file_load_contents (_tmp70_, NULL, &_tmp71_, &_tmp72_, NULL, &_inner_error_);
+#line 127 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ pixels = (g_free (pixels), NULL);
+#line 127 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ pixels = _tmp71_;
+#line 127 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ pixels_length1 = _tmp72_;
+#line 127 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _pixels_size_ = pixels_length1;
+#line 127 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ if (_inner_error_ != NULL) {
+#line 709 "autosave-manager.c"
+ goto __catch29_g_error;
+ }
+ }
+ goto __finally29;
+ __catch29_g_error:
+ {
+ GError* e = NULL;
#line 125 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- while (TRUE) {
-#line 454 "autosave-manager.c"
- sqlite3_stmt* _tmp18_;
- gint _tmp19_ = 0;
- sqlite3_stmt* _tmp20_;
- gint _tmp21_ = 0;
- gint unowned_pid;
- sqlite3_stmt* _tmp22_;
- gint _tmp23_ = 0;
- gint book_hash;
- sqlite3_stmt* _tmp24_;
- gint _tmp25_ = 0;
- gint book_revision;
- const gchar* _tmp26_;
- const gchar* _tmp27_ = NULL;
- gchar* _tmp28_ = NULL;
- sqlite3_stmt* stmt2 = NULL;
- AutosaveManager* _tmp29_;
- sqlite3* _tmp30_;
- const gchar* _tmp31_;
- sqlite3_stmt* _tmp32_ = NULL;
- gint _tmp33_ = 0;
- gint _tmp34_;
- sqlite3_stmt* _tmp39_;
- gint _tmp40_;
- sqlite3_stmt* _tmp41_;
- gint _tmp42_;
- sqlite3_stmt* _tmp43_;
- gint _tmp44_;
- sqlite3_stmt* _tmp45_;
- gint _tmp46_ = 0;
- gint _tmp47_;
+ e = _inner_error_;
#line 125 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp18_ = stmt;
+ _inner_error_ = NULL;
+#line 131 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_warning ("autosave-manager.vala:131: Failed to load pixel information");
+#line 132 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_error_free0 (e);
+#line 132 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_object_unref0 (f);
+#line 132 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (path);
+#line 132 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ pixels = (g_free (pixels), NULL);
+#line 132 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (crop_name);
+#line 132 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (pixels_filename);
+#line 132 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (color_profile);
+#line 132 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (scan_direction_name);
+#line 132 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (page_name);
+#line 132 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ continue;
+#line 743 "autosave-manager.c"
+ }
+ __finally29:
#line 125 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp19_ = sqlite3_step (_tmp18_);
+ if (_inner_error_ != NULL) {
#line 125 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (!(_tmp19_ == SQLITE_ROW)) {
+ _g_object_unref0 (f);
#line 125 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- break;
-#line 493 "autosave-manager.c"
- }
-#line 127 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_debug ("autosave-manager.vala:127: Found at least one autosave page, taking ow" \
-"nership");
-#line 128 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp20_ = stmt;
-#line 128 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp21_ = sqlite3_column_int (_tmp20_, 0);
-#line 128 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- unowned_pid = _tmp21_;
-#line 129 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp22_ = stmt;
-#line 129 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp23_ = sqlite3_column_int (_tmp22_, 1);
-#line 129 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- book_hash = _tmp23_;
-#line 130 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp24_ = stmt;
-#line 130 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp25_ = sqlite3_column_int (_tmp24_, 2);
-#line 130 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- book_revision = _tmp25_;
-#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp26_ = autosave_manager_PID;
-#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp27_ = string_to_string (_tmp26_);
-#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp28_ = g_strconcat ("\n" \
-" UPDATE pages\n" \
-" SET process_id = ", _tmp27_, "\n" \
-" WHERE process_id = ?2\n" \
-" AND book_hash = ?3\n" \
-" AND book_revision = ?4", NULL);
-#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (query);
-#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- query = _tmp28_;
-#line 144 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp29_ = man;
-#line 144 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp30_ = _tmp29_->priv->database_connection;
-#line 144 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp31_ = query;
-#line 144 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp33_ = sqlite3_prepare_v2 (_tmp30_, _tmp31_, -1, &_tmp32_, NULL);
-#line 144 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _sqlite3_finalize0 (stmt2);
-#line 144 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- stmt2 = _tmp32_;
-#line 144 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _result_ = _tmp33_;
-#line 145 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp34_ = _result_;
-#line 145 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp34_ != SQLITE_OK) {
-#line 543 "autosave-manager.c"
- const gchar* _tmp35_;
- const gchar* _tmp36_ = NULL;
- gchar* _tmp37_ = NULL;
- gchar* _tmp38_;
-#line 146 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp35_ = query;
-#line 146 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp36_ = string_to_string (_tmp35_);
-#line 146 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp37_ = g_strconcat ("Error preparing statement: ", _tmp36_, NULL);
-#line 146 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp38_ = _tmp37_;
-#line 146 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_warning ("autosave-manager.vala:146: %s", _tmp38_);
-#line 146 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp38_);
-#line 560 "autosave-manager.c"
+ _g_free0 (path);
+#line 125 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ pixels = (g_free (pixels), NULL);
+#line 125 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (crop_name);
+#line 125 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (pixels_filename);
+#line 125 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (color_profile);
+#line 125 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (scan_direction_name);
+#line 125 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (page_name);
+#line 125 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ page_name_collection = (_vala_array_free (page_name_collection, page_name_collection_length1, (GDestroyNotify) g_free), NULL);
+#line 125 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (pages);
+#line 125 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_key_file_unref0 (file);
+#line 125 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+#line 125 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_clear_error (&_inner_error_);
+#line 125 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ return;
+#line 776 "autosave-manager.c"
+ }
+#line 121 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_object_unref0 (f);
+#line 121 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (path);
+#line 782 "autosave-manager.c"
}
-#line 148 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp39_ = stmt2;
-#line 148 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp40_ = unowned_pid;
-#line 148 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- sqlite3_bind_int64 (_tmp39_, 2, (gint64) _tmp40_);
-#line 149 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp41_ = stmt2;
-#line 149 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp42_ = book_hash;
-#line 149 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- sqlite3_bind_int64 (_tmp41_, 3, (gint64) _tmp42_);
-#line 150 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp43_ = stmt2;
-#line 150 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp44_ = book_revision;
-#line 150 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- sqlite3_bind_int64 (_tmp43_, 4, (gint64) _tmp44_);
+#line 136 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp73_ = scan_width;
+#line 136 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp74_ = scan_height;
+#line 136 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp75_ = rowstride;
+#line 136 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp76_ = n_channels;
+#line 136 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp77_ = depth;
+#line 136 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp78_ = dpi;
+#line 136 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp79_ = scan_direction;
+#line 136 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp80_ = color_profile;
+#line 136 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp81_ = pixels;
+#line 136 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp81__length1 = pixels_length1;
+#line 136 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp82_ = has_crop;
+#line 136 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp83_ = crop_name;
+#line 136 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp84_ = crop_x;
+#line 136 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp85_ = crop_y;
+#line 136 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp86_ = crop_width;
+#line 136 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp87_ = crop_height;
+#line 136 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp88_ = page_new_from_data (_tmp73_, _tmp74_, _tmp75_, _tmp76_, _tmp77_, _tmp78_, _tmp79_, _tmp80_, _tmp81_, _tmp81__length1, _tmp82_, _tmp83_, _tmp84_, _tmp85_, _tmp86_, _tmp87_);
+#line 136 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ page = _tmp88_;
#line 151 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp45_ = stmt2;
+ _tmp89_ = self->priv->page_filenames;
#line 151 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp46_ = sqlite3_step (_tmp45_);
+ _tmp90_ = page;
#line 151 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _result_ = _tmp46_;
+ _tmp91_ = _page_ref0 (_tmp90_);
+#line 151 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp92_ = pixels_filename;
+#line 151 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp93_ = g_strdup (_tmp92_);
+#line 151 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_hash_table_insert (_tmp89_, _tmp91_, _tmp93_);
#line 152 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp47_ = _result_;
+ _tmp94_ = autosave_manager_get_book (self);
#line 152 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp47_ == SQLITE_DONE) {
-#line 590 "autosave-manager.c"
- AutosaveManager* _tmp48_;
-#line 154 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- any_pages_recovered = TRUE;
-#line 155 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp48_ = man;
-#line 155 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- autosave_manager_recover_book (_tmp48_, book);
-#line 598 "autosave-manager.c"
- } else {
- gint _tmp49_;
-#line 158 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp49_ = _result_;
-#line 158 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_warning ("autosave-manager.vala:158: Error %d while executing query", _tmp49_);
-#line 605 "autosave-manager.c"
- }
-#line 125 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _sqlite3_finalize0 (stmt2);
-#line 609 "autosave-manager.c"
+ _tmp95_ = _tmp94_;
+#line 152 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp96_ = page;
+#line 152 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ book_append_page (_tmp95_, _tmp96_);
+#line 80 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _page_unref0 (page);
+#line 80 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ pixels = (g_free (pixels), NULL);
+#line 80 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (crop_name);
+#line 80 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (pixels_filename);
+#line 80 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (color_profile);
+#line 80 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (scan_direction_name);
+#line 80 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (page_name);
+#line 854 "autosave-manager.c"
}
- } else {
- gint _tmp50_;
-#line 162 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp50_ = _result_;
-#line 162 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_warning ("autosave-manager.vala:162: Error %d while preparing statement", _tmp50_);
-#line 617 "autosave-manager.c"
}
-#line 109 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (query);
-#line 109 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _sqlite3_finalize0 (stmt);
-#line 109 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (current_pids);
-#line 625 "autosave-manager.c"
+#line 80 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ page_name_collection = (_vala_array_free (page_name_collection, page_name_collection_length1, (GDestroyNotify) g_free), NULL);
+#line 859 "autosave-manager.c"
+ }
+#line 62 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (pages);
+#line 62 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_key_file_unref0 (file);
+#line 865 "autosave-manager.c"
+}
+
+
+static gchar* autosave_manager_get_value (AutosaveManager* self, GKeyFile* file, const gchar* group_name, const gchar* key, const gchar* _default_) {
+ gchar* result = NULL;
+ GError * _inner_error_ = NULL;
+#line 156 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_return_val_if_fail (self != NULL, NULL);
+#line 156 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_return_val_if_fail (file != NULL, NULL);
+#line 156 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_return_val_if_fail (group_name != NULL, NULL);
+#line 156 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_return_val_if_fail (key != NULL, NULL);
+#line 156 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_return_val_if_fail (_default_ != NULL, NULL);
+#line 882 "autosave-manager.c"
+ {
+ gchar* _tmp0_ = NULL;
+ GKeyFile* _tmp1_ = NULL;
+ const gchar* _tmp2_ = NULL;
+ const gchar* _tmp3_ = NULL;
+ gchar* _tmp4_ = NULL;
+#line 160 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp1_ = file;
+#line 160 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp2_ = group_name;
+#line 160 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp3_ = key;
+#line 160 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp4_ = g_key_file_get_value (_tmp1_, _tmp2_, _tmp3_, &_inner_error_);
+#line 160 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp0_ = _tmp4_;
+#line 160 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ if (_inner_error_ != NULL) {
+#line 901 "autosave-manager.c"
+ goto __catch30_g_error;
+ }
+#line 160 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ result = _tmp0_;
+#line 160 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ return result;
+#line 908 "autosave-manager.c"
}
- goto __finally24;
- __catch24_g_spawn_error:
+ goto __finally30;
+ __catch30_g_error:
{
GError* e = NULL;
-#line 109 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ const gchar* _tmp5_ = NULL;
+ gchar* _tmp6_ = NULL;
+#line 158 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
e = _inner_error_;
-#line 109 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 158 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_inner_error_ = NULL;
-#line 166 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_warning ("autosave-manager.vala:166: Could not obtain current process ids; not r" \
-"estoring any autosaves");
-#line 109 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 164 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp5_ = _default_;
+#line 164 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp6_ = g_strdup (_tmp5_);
+#line 164 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ result = _tmp6_;
+#line 164 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_error_free0 (e);
-#line 639 "autosave-manager.c"
- }
- __finally24:
-#line 109 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_inner_error_ != NULL) {
-#line 109 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _autosave_manager_unref0 (man);
-#line 109 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-#line 109 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_clear_error (&_inner_error_);
-#line 109 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- return NULL;
-#line 652 "autosave-manager.c"
+#line 164 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ return result;
+#line 930 "autosave-manager.c"
}
-#line 169 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp51_ = man;
-#line 169 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp52_ = *book;
-#line 169 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- autosave_manager_set_book (_tmp51_, _tmp52_);
-#line 170 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp53_ = any_pages_recovered;
-#line 170 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (!_tmp53_) {
-#line 664 "autosave-manager.c"
- {
- gint i;
-#line 172 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- i = 0;
-#line 669 "autosave-manager.c"
- {
- gboolean _tmp54_;
-#line 172 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp54_ = TRUE;
-#line 172 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- while (TRUE) {
-#line 676 "autosave-manager.c"
- gboolean _tmp55_;
- gint _tmp57_;
- Book* _tmp58_;
- guint _tmp59_ = 0U;
- Book* _tmp60_;
- gint _tmp61_;
- Page* _tmp62_ = NULL;
- Page* page;
- AutosaveManager* _tmp63_;
- Page* _tmp64_;
-#line 172 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp55_ = _tmp54_;
-#line 172 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (!_tmp55_) {
-#line 691 "autosave-manager.c"
- gint _tmp56_;
-#line 172 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp56_ = i;
+ __finally30:
+#line 158 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+#line 158 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_clear_error (&_inner_error_);
+#line 158 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ return NULL;
+#line 939 "autosave-manager.c"
+}
+
+
+static gint autosave_manager_get_integer (AutosaveManager* self, GKeyFile* file, const gchar* group_name, const gchar* key, gint _default_) {
+ gint result = 0;
+ GError * _inner_error_ = NULL;
+#line 168 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_return_val_if_fail (self != NULL, 0);
+#line 168 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_return_val_if_fail (file != NULL, 0);
+#line 168 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_return_val_if_fail (group_name != NULL, 0);
+#line 168 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_return_val_if_fail (key != NULL, 0);
+#line 954 "autosave-manager.c"
+ {
+ gint _tmp0_ = 0;
+ GKeyFile* _tmp1_ = NULL;
+ const gchar* _tmp2_ = NULL;
+ const gchar* _tmp3_ = NULL;
+ gint _tmp4_ = 0;
#line 172 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- i = _tmp56_ + 1;
-#line 697 "autosave-manager.c"
- }
+ _tmp1_ = file;
#line 172 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp54_ = FALSE;
+ _tmp2_ = group_name;
#line 172 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp57_ = i;
+ _tmp3_ = key;
#line 172 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp58_ = *book;
+ _tmp4_ = g_key_file_get_integer (_tmp1_, _tmp2_, _tmp3_, &_inner_error_);
#line 172 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp59_ = book_get_n_pages (_tmp58_);
+ _tmp0_ = _tmp4_;
#line 172 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (!(((guint) _tmp57_) < _tmp59_)) {
+ if (_inner_error_ != NULL) {
+#line 973 "autosave-manager.c"
+ goto __catch31_g_error;
+ }
#line 172 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- break;
-#line 711 "autosave-manager.c"
- }
-#line 174 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp60_ = *book;
-#line 174 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp61_ = i;
-#line 174 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp62_ = book_get_page (_tmp60_, _tmp61_);
-#line 174 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- page = _tmp62_;
-#line 175 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp63_ = man;
-#line 175 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp64_ = page;
-#line 175 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- autosave_manager_on_page_added (_tmp63_, _tmp64_);
+ result = _tmp0_;
#line 172 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _page_unref0 (page);
-#line 729 "autosave-manager.c"
- }
- }
- }
+ return result;
+#line 980 "autosave-manager.c"
}
-#line 179 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- result = man;
-#line 179 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- return result;
-#line 738 "autosave-manager.c"
+ goto __finally31;
+ __catch31_g_error:
+ {
+ GError* e = NULL;
+ gint _tmp5_ = 0;
+#line 170 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ e = _inner_error_;
+#line 170 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _inner_error_ = NULL;
+#line 176 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp5_ = _default_;
+#line 176 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ result = _tmp5_;
+#line 176 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_error_free0 (e);
+#line 176 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ return result;
+#line 999 "autosave-manager.c"
+ }
+ __finally31:
+#line 170 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+#line 170 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_clear_error (&_inner_error_);
+#line 170 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ return 0;
+#line 1008 "autosave-manager.c"
}
-static void _page_unref0_ (gpointer var) {
+static gboolean autosave_manager_get_boolean (AutosaveManager* self, GKeyFile* file, const gchar* group_name, const gchar* key, gboolean _default_) {
+ gboolean result = FALSE;
+ GError * _inner_error_ = NULL;
+#line 180 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_return_val_if_fail (self != NULL, FALSE);
+#line 180 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_return_val_if_fail (file != NULL, FALSE);
+#line 180 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_return_val_if_fail (group_name != NULL, FALSE);
+#line 180 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_return_val_if_fail (key != NULL, FALSE);
+#line 1023 "autosave-manager.c"
+ {
+ gboolean _tmp0_ = FALSE;
+ GKeyFile* _tmp1_ = NULL;
+ const gchar* _tmp2_ = NULL;
+ const gchar* _tmp3_ = NULL;
+ gboolean _tmp4_ = FALSE;
#line 184 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- (var == NULL) ? NULL : (var = (page_unref (var), NULL));
-#line 745 "autosave-manager.c"
-}
-
-
-static AutosaveManager* autosave_manager_construct (GType object_type) {
- AutosaveManager* self = NULL;
- GHashFunc _tmp0_;
- GEqualFunc _tmp1_;
- GHashTable* _tmp2_;
-#line 182 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- self = (AutosaveManager*) g_type_create_instance (object_type);
+ _tmp1_ = file;
#line 184 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp0_ = g_direct_hash;
+ _tmp2_ = group_name;
#line 184 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp1_ = g_direct_equal;
+ _tmp3_ = key;
#line 184 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _page_unref0_, NULL);
+ _tmp4_ = g_key_file_get_boolean (_tmp1_, _tmp2_, _tmp3_, &_inner_error_);
#line 184 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_hash_table_unref0 (self->priv->dirty_pages);
+ _tmp0_ = _tmp4_;
#line 184 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- self->priv->dirty_pages = _tmp2_;
+ if (_inner_error_ != NULL) {
+#line 1042 "autosave-manager.c"
+ goto __catch32_g_error;
+ }
+#line 184 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ result = _tmp0_;
+#line 184 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ return result;
+#line 1049 "autosave-manager.c"
+ }
+ goto __finally32;
+ __catch32_g_error:
+ {
+ GError* e = NULL;
+ gboolean _tmp5_ = FALSE;
#line 182 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- return self;
-#line 768 "autosave-manager.c"
-}
-
-
-static AutosaveManager* autosave_manager_new (void) {
+ e = _inner_error_;
#line 182 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- return autosave_manager_construct (TYPE_AUTOSAVE_MANAGER);
-#line 775 "autosave-manager.c"
-}
-
-
-static gint _sqlite3_exec (sqlite3* self, const gchar* sql, sqlite3_callback callback, void* callback_target, gchar** errmsg) {
- gchar* _vala_errmsg = NULL;
- gint result = 0;
- const gchar* sqlite_errmsg = NULL;
- const gchar* _tmp0_;
- sqlite3_callback _tmp1_;
- void* _tmp1__target;
- const gchar* _tmp2_ = NULL;
- gint _tmp3_ = 0;
- gint ec;
- const gchar* _tmp6_;
-#line 34 "/usr/share/vala-0.20/vapi/sqlite3.vapi"
- g_return_val_if_fail (self != NULL, 0);
-#line 34 "/usr/share/vala-0.20/vapi/sqlite3.vapi"
- g_return_val_if_fail (sql != NULL, 0);
-#line 36 "/usr/share/vala-0.20/vapi/sqlite3.vapi"
- _tmp0_ = sql;
-#line 36 "/usr/share/vala-0.20/vapi/sqlite3.vapi"
- _tmp1_ = callback;
-#line 36 "/usr/share/vala-0.20/vapi/sqlite3.vapi"
- _tmp1__target = callback_target;
-#line 36 "/usr/share/vala-0.20/vapi/sqlite3.vapi"
- _tmp3_ = sqlite3_exec (self, _tmp0_, _tmp1_, _tmp1__target, (char**) (&_tmp2_));
-#line 36 "/usr/share/vala-0.20/vapi/sqlite3.vapi"
- sqlite_errmsg = _tmp2_;
-#line 36 "/usr/share/vala-0.20/vapi/sqlite3.vapi"
- ec = _tmp3_;
-#line 37 "/usr/share/vala-0.20/vapi/sqlite3.vapi"
- if ((&_vala_errmsg) != NULL) {
-#line 808 "autosave-manager.c"
- const gchar* _tmp4_;
- gchar* _tmp5_;
-#line 38 "/usr/share/vala-0.20/vapi/sqlite3.vapi"
- _tmp4_ = sqlite_errmsg;
-#line 38 "/usr/share/vala-0.20/vapi/sqlite3.vapi"
- _tmp5_ = g_strdup (_tmp4_);
-#line 38 "/usr/share/vala-0.20/vapi/sqlite3.vapi"
- _g_free0 (_vala_errmsg);
-#line 38 "/usr/share/vala-0.20/vapi/sqlite3.vapi"
- _vala_errmsg = _tmp5_;
-#line 819 "autosave-manager.c"
- }
-#line 40 "/usr/share/vala-0.20/vapi/sqlite3.vapi"
- _tmp6_ = sqlite_errmsg;
-#line 40 "/usr/share/vala-0.20/vapi/sqlite3.vapi"
- sqlite3_free ((void*) _tmp6_);
-#line 41 "/usr/share/vala-0.20/vapi/sqlite3.vapi"
- result = ec;
-#line 41 "/usr/share/vala-0.20/vapi/sqlite3.vapi"
- if (errmsg) {
-#line 41 "/usr/share/vala-0.20/vapi/sqlite3.vapi"
- *errmsg = _vala_errmsg;
-#line 831 "autosave-manager.c"
- } else {
-#line 41 "/usr/share/vala-0.20/vapi/sqlite3.vapi"
- _g_free0 (_vala_errmsg);
-#line 835 "autosave-manager.c"
+ _inner_error_ = NULL;
+#line 188 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp5_ = _default_;
+#line 188 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ result = _tmp5_;
+#line 188 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_error_free0 (e);
+#line 188 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ return result;
+#line 1068 "autosave-manager.c"
}
-#line 41 "/usr/share/vala-0.20/vapi/sqlite3.vapi"
- return result;
-#line 839 "autosave-manager.c"
+ __finally32:
+#line 182 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+#line 182 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_clear_error (&_inner_error_);
+#line 182 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ return FALSE;
+#line 1077 "autosave-manager.c"
}
void autosave_manager_cleanup (AutosaveManager* self) {
- guint _tmp0_;
- sqlite3* _tmp2_;
- const gchar* _tmp3_;
- const gchar* _tmp4_ = NULL;
- gchar* _tmp5_ = NULL;
- gchar* _tmp6_;
- gint _tmp7_ = 0;
-#line 187 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ guint _tmp0_ = 0U;
+ GDir* dir = NULL;
+ GError * _inner_error_ = NULL;
+#line 192 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (self != NULL);
-#line 189 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_debug ("autosave-manager.vala:189: Clean exit; deleting autosave records");
-#line 191 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 194 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_debug ("autosave-manager.vala:194: Deleting autosave records");
+#line 196 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp0_ = self->priv->update_timeout;
-#line 191 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 196 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (_tmp0_ > ((guint) 0)) {
-#line 859 "autosave-manager.c"
- guint _tmp1_;
-#line 192 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 1093 "autosave-manager.c"
+ guint _tmp1_ = 0U;
+#line 197 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp1_ = self->priv->update_timeout;
-#line 192 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 197 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_source_remove (_tmp1_);
-#line 865 "autosave-manager.c"
+#line 1099 "autosave-manager.c"
}
-#line 193 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 198 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
self->priv->update_timeout = (guint) 0;
-#line 195 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp2_ = self->priv->database_connection;
-#line 195 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp3_ = autosave_manager_PID;
-#line 195 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp4_ = string_to_string (_tmp3_);
-#line 195 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp5_ = g_strconcat ("\n DELETE FROM pages\n WHERE process_id = ", _tmp4_, "\n ", NULL);
-#line 195 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp6_ = _tmp5_;
-#line 195 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp7_ = _sqlite3_exec (_tmp2_, _tmp6_, NULL, NULL, NULL);
-#line 195 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_warn_if_fail (_tmp7_ == SQLITE_OK);
-#line 195 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp6_);
-#line 885 "autosave-manager.c"
-}
-
-
-static sqlite3* autosave_manager_open_database_connection (GError** error) {
- sqlite3* result = NULL;
- const gchar* _tmp0_;
- GFile* _tmp1_ = NULL;
- GFile* autosaves_dir;
- sqlite3* connection = NULL;
- const gchar* _tmp3_;
- sqlite3* _tmp4_ = NULL;
- gint _tmp5_ = 0;
- gchar* _tmp7_;
- gchar* query;
- sqlite3* _tmp8_;
- const gchar* _tmp9_;
- gint _tmp10_ = 0;
- gint _result_;
- gint _tmp11_;
- GError * _inner_error_ = NULL;
+#line 1103 "autosave-manager.c"
+ {
+ GDir* _tmp2_ = NULL;
+ const gchar* _tmp3_ = NULL;
+ GDir* _tmp4_ = NULL;
#line 203 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp0_ = autosave_manager_AUTOSAVE_DIR;
+ _tmp3_ = autosave_manager_AUTOSAVE_DIR;
#line 203 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp1_ = g_file_new_for_path (_tmp0_);
+ _tmp4_ = g_dir_open (_tmp3_, (guint) 0, &_inner_error_);
+#line 203 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp2_ = _tmp4_;
#line 203 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- autosaves_dir = _tmp1_;
-#line 912 "autosave-manager.c"
- {
- GFile* _tmp2_;
-#line 206 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp2_ = autosaves_dir;
-#line 206 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_file_make_directory_with_parents (_tmp2_, NULL, &_inner_error_);
-#line 206 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (_inner_error_ != NULL) {
-#line 921 "autosave-manager.c"
- goto __catch25_g_error;
+#line 1116 "autosave-manager.c"
+ goto __catch33_g_error;
}
+#line 203 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_dir_close0 (dir);
+#line 203 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ dir = _tmp2_;
+#line 1123 "autosave-manager.c"
}
- goto __finally25;
- __catch25_g_error:
+ goto __finally33;
+ __catch33_g_error:
{
-#line 204 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_clear_error (&_inner_error_);
-#line 204 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ GError* e = NULL;
+ GError* _tmp5_ = NULL;
+ const gchar* _tmp6_ = NULL;
+#line 201 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ e = _inner_error_;
+#line 201 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_inner_error_ = NULL;
-#line 932 "autosave-manager.c"
+#line 207 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp5_ = e;
+#line 207 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp6_ = _tmp5_->message;
+#line 207 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_warning ("autosave-manager.vala:207: Failed to delete autosaves: %s", _tmp6_);
+#line 208 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_error_free0 (e);
+#line 208 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_dir_close0 (dir);
+#line 208 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ return;
+#line 1147 "autosave-manager.c"
}
- __finally25:
-#line 204 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ __finally33:
+#line 201 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (_inner_error_ != NULL) {
-#line 204 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_propagate_error (error, _inner_error_);
-#line 204 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_object_unref0 (autosaves_dir);
-#line 204 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- return NULL;
-#line 943 "autosave-manager.c"
+#line 201 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_dir_close0 (dir);
+#line 201 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+#line 201 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_clear_error (&_inner_error_);
+#line 201 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ return;
+#line 1160 "autosave-manager.c"
}
+#line 211 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ while (TRUE) {
+#line 1164 "autosave-manager.c"
+ gchar* filename = NULL;
+ GDir* _tmp7_ = NULL;
+ const gchar* _tmp8_ = NULL;
+ gchar* _tmp9_ = NULL;
+ const gchar* _tmp10_ = NULL;
+ gchar* path = NULL;
+ const gchar* _tmp11_ = NULL;
+ const gchar* _tmp12_ = NULL;
+ gchar* _tmp13_ = NULL;
+ const gchar* _tmp14_ = NULL;
#line 213 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp3_ = autosave_manager_AUTOSAVE_FILENAME;
-#line 213 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp5_ = sqlite3_open (_tmp3_, &_tmp4_);
+ _tmp7_ = dir;
#line 213 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _sqlite3_close0 (connection);
+ _tmp8_ = g_dir_read_name (_tmp7_);
#line 213 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- connection = _tmp4_;
+ _tmp9_ = g_strdup (_tmp8_);
#line 213 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp5_ != SQLITE_OK) {
-#line 955 "autosave-manager.c"
- GError* _tmp6_;
-#line 214 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp6_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, "Could not connect to autosave database");
-#line 214 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _inner_error_ = _tmp6_;
-#line 214 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_propagate_error (error, _inner_error_);
+ filename = _tmp9_;
#line 214 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _sqlite3_close0 (connection);
+ _tmp10_ = filename;
#line 214 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_object_unref0 (autosaves_dir);
-#line 214 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- return NULL;
-#line 969 "autosave-manager.c"
- }
+ if (_tmp10_ == NULL) {
#line 215 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp7_ = g_strdup ("\n" \
-" CREATE TABLE IF NOT EXISTS pages (\n" \
-" id integer PRIMARY KEY,\n" \
-" process_id integer,\n" \
-" page_hash integer,\n" \
-" book_hash integer,\n" \
-" book_revision integer,\n" \
-" page_number integer,\n" \
-" dpi integer,\n" \
-" width integer,\n" \
-" height integer,\n" \
-" depth integer,\n" \
-" n_channels integer,\n" \
-" rowstride integer,\n" \
-" color_profile string,\n" \
-" crop_x integer,\n" \
-" crop_y integer,\n" \
-" crop_width integer,\n" \
-" crop_height integer,\n" \
-" scan_direction integer,\n" \
-" pixels binary\n" \
-" )");
+ _g_free0 (filename);
#line 215 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- query = _tmp7_;
-#line 237 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp8_ = connection;
-#line 237 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp9_ = query;
-#line 237 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp10_ = _sqlite3_exec (_tmp8_, _tmp9_, NULL, NULL, NULL);
-#line 237 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _result_ = _tmp10_;
-#line 238 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp11_ = _result_;
-#line 238 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp11_ != SQLITE_OK) {
-#line 987 "autosave-manager.c"
- gint _tmp12_;
-#line 239 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp12_ = _result_;
-#line 239 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_warning ("autosave-manager.vala:239: Error %d while executing query", _tmp12_);
-#line 993 "autosave-manager.c"
+ break;
+#line 1191 "autosave-manager.c"
+ }
+#line 216 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp11_ = autosave_manager_AUTOSAVE_DIR;
+#line 216 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp12_ = filename;
+#line 216 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp13_ = g_build_filename (_tmp11_, _tmp12_, NULL);
+#line 216 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ path = _tmp13_;
+#line 217 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp14_ = path;
+#line 217 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_unlink (_tmp14_);
+#line 211 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (path);
+#line 211 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (filename);
+#line 1209 "autosave-manager.c"
}
-#line 240 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- result = connection;
-#line 240 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (query);
-#line 240 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_object_unref0 (autosaves_dir);
-#line 240 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- return result;
-#line 1003 "autosave-manager.c"
+#line 192 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_dir_close0 (dir);
+#line 1213 "autosave-manager.c"
}
-static void _autosave_manager_on_page_changed_page_size_changed (Page* _sender, gpointer self) {
-#line 247 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- autosave_manager_on_page_changed (self, _sender);
-#line 1010 "autosave-manager.c"
+static void _autosave_manager_on_scan_finished_page_scan_finished (Page* _sender, gpointer self) {
+#line 223 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ autosave_manager_on_scan_finished (self, _sender);
+#line 1220 "autosave-manager.c"
}
-static void _autosave_manager_on_page_changed_page_scan_direction_changed (Page* _sender, gpointer self) {
-#line 248 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- autosave_manager_on_page_changed (self, _sender);
-#line 1017 "autosave-manager.c"
+static void _autosave_manager_on_changed_page_crop_changed (Page* _sender, gpointer self) {
+#line 224 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ autosave_manager_on_changed (self);
+#line 1227 "autosave-manager.c"
}
-static void _autosave_manager_on_page_changed_page_crop_changed (Page* _sender, gpointer self) {
-#line 249 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- autosave_manager_on_page_changed (self, _sender);
-#line 1024 "autosave-manager.c"
+void autosave_manager_on_page_added (AutosaveManager* self, Page* page) {
+ Page* _tmp0_ = NULL;
+ Page* _tmp1_ = NULL;
+#line 221 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_return_if_fail (self != NULL);
+#line 221 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_return_if_fail (page != NULL);
+#line 223 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp0_ = page;
+#line 223 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_signal_connect (_tmp0_, "scan-finished", (GCallback) _autosave_manager_on_scan_finished_page_scan_finished, self);
+#line 224 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp1_ = page;
+#line 224 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_signal_connect (_tmp1_, "crop-changed", (GCallback) _autosave_manager_on_changed_page_crop_changed, self);
+#line 1246 "autosave-manager.c"
}
-static void _autosave_manager_on_page_changed_page_scan_finished (Page* _sender, gpointer self) {
-#line 250 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- autosave_manager_on_page_changed (self, _sender);
-#line 1031 "autosave-manager.c"
+void autosave_manager_on_page_removed (AutosaveManager* self, Page* page) {
+ Page* _tmp0_ = NULL;
+ guint _tmp1_ = 0U;
+ Page* _tmp2_ = NULL;
+ guint _tmp3_ = 0U;
+ gchar* filename = NULL;
+ GHashTable* _tmp4_ = NULL;
+ Page* _tmp5_ = NULL;
+ gconstpointer _tmp6_ = NULL;
+ gchar* _tmp7_ = NULL;
+ const gchar* _tmp8_ = NULL;
+ GHashTable* _tmp10_ = NULL;
+ Page* _tmp11_ = NULL;
+#line 227 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_return_if_fail (self != NULL);
+#line 227 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_return_if_fail (page != NULL);
+#line 229 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp0_ = page;
+#line 229 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_signal_parse_name ("scan-finished", TYPE_PAGE, &_tmp1_, NULL, FALSE);
+#line 229 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_signal_handlers_disconnect_matched (_tmp0_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _autosave_manager_on_scan_finished_page_scan_finished, self);
+#line 230 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp2_ = page;
+#line 230 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_signal_parse_name ("crop-changed", TYPE_PAGE, &_tmp3_, NULL, FALSE);
+#line 230 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_signal_handlers_disconnect_matched (_tmp2_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, 0, NULL, (GCallback) _autosave_manager_on_changed_page_crop_changed, self);
+#line 232 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp4_ = self->priv->page_filenames;
+#line 232 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp5_ = page;
+#line 232 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp6_ = g_hash_table_lookup (_tmp4_, _tmp5_);
+#line 232 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp7_ = g_strdup ((const gchar*) _tmp6_);
+#line 232 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ filename = _tmp7_;
+#line 233 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp8_ = filename;
+#line 233 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ if (_tmp8_ != NULL) {
+#line 1293 "autosave-manager.c"
+ const gchar* _tmp9_ = NULL;
+#line 234 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp9_ = filename;
+#line 234 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_unlink (_tmp9_);
+#line 1299 "autosave-manager.c"
+ }
+#line 235 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp10_ = self->priv->page_filenames;
+#line 235 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp11_ = page;
+#line 235 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_hash_table_remove (_tmp10_, _tmp11_);
+#line 227 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (filename);
+#line 1309 "autosave-manager.c"
}
-static void autosave_manager_on_page_added (AutosaveManager* self, Page* page) {
- Page* _tmp0_;
- Page* _tmp1_;
- Page* _tmp2_;
- Page* _tmp3_;
- Page* _tmp4_;
-#line 243 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+void autosave_manager_on_scan_finished (AutosaveManager* self, Page* page) {
+ Page* _tmp0_ = NULL;
+#line 238 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (self != NULL);
-#line 243 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 238 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (page != NULL);
-#line 245 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 240 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp0_ = page;
-#line 245 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- autosave_manager_insert_page (self, _tmp0_);
-#line 247 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp1_ = page;
-#line 247 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_connect (_tmp1_, "size-changed", (GCallback) _autosave_manager_on_page_changed_page_size_changed, self);
-#line 248 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp2_ = page;
-#line 248 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_connect (_tmp2_, "scan-direction-changed", (GCallback) _autosave_manager_on_page_changed_page_scan_direction_changed, self);
-#line 249 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp3_ = page;
+#line 240 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ autosave_manager_save_pixels (self, _tmp0_);
+#line 241 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ autosave_manager_save (self, FALSE);
+#line 1325 "autosave-manager.c"
+}
+
+
+void autosave_manager_on_changed (AutosaveManager* self) {
+#line 244 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_return_if_fail (self != NULL);
+#line 246 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ autosave_manager_save (self, TRUE);
+#line 1334 "autosave-manager.c"
+}
+
+
+void autosave_manager_on_cleared (AutosaveManager* self) {
+ GHashTable* _tmp0_ = NULL;
#line 249 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_connect (_tmp3_, "crop-changed", (GCallback) _autosave_manager_on_page_changed_page_crop_changed, self);
-#line 250 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp4_ = page;
-#line 250 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_connect (_tmp4_, "scan-finished", (GCallback) _autosave_manager_on_page_changed_page_scan_finished, self);
-#line 1065 "autosave-manager.c"
+ g_return_if_fail (self != NULL);
+#line 251 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp0_ = self->priv->page_filenames;
+#line 251 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_hash_table_remove_all (_tmp0_);
+#line 252 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ autosave_manager_save (self, TRUE);
+#line 1348 "autosave-manager.c"
}
-static void _autosave_manager_on_page_changed_page_pixels_changed (Page* _sender, gpointer self) {
-#line 255 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- autosave_manager_on_page_changed (self, _sender);
-#line 1072 "autosave-manager.c"
+static gboolean ___lambda2_ (AutosaveManager* self) {
+ gboolean result = FALSE;
+#line 269 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ autosave_manager_real_save (self);
+#line 270 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ self->priv->update_timeout = (guint) 0;
+#line 271 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ result = FALSE;
+#line 271 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ return result;
+#line 1362 "autosave-manager.c"
}
-void autosave_manager_on_page_removed (AutosaveManager* self, Page* page) {
- Page* _tmp0_;
+static gboolean ____lambda2__gsource_func (gpointer self) {
+ gboolean result;
+ result = ___lambda2_ (self);
+#line 267 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ return result;
+#line 1371 "autosave-manager.c"
+}
+
+
+static void autosave_manager_save (AutosaveManager* self, gboolean do_timeout) {
+ gboolean _tmp0_ = FALSE;
guint _tmp1_ = 0U;
- Page* _tmp2_;
- guint _tmp3_ = 0U;
- Page* _tmp4_;
- guint _tmp5_ = 0U;
- Page* _tmp6_;
- guint _tmp7_ = 0U;
- Page* _tmp8_;
- const gchar* _tmp9_;
- const gchar* _tmp10_ = NULL;
- gchar* _tmp11_ = NULL;
- gchar* query;
- sqlite3_stmt* stmt = NULL;
- sqlite3* _tmp12_;
- const gchar* _tmp13_;
- sqlite3_stmt* _tmp14_ = NULL;
- gint _tmp15_ = 0;
- gint _result_;
- gint _tmp16_;
- sqlite3_stmt* _tmp22_;
- GHashFunc _tmp23_;
- Page* _tmp24_;
- guint _tmp25_ = 0U;
- sqlite3_stmt* _tmp26_;
- GHashFunc _tmp27_;
- Book* _tmp28_;
- Book* _tmp29_;
- guint _tmp30_ = 0U;
- sqlite3_stmt* _tmp31_;
- gint _tmp32_;
- sqlite3_stmt* _tmp33_;
- gint _tmp34_ = 0;
- gint _tmp35_;
-#line 253 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_return_if_fail (self != NULL);
-#line 253 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_return_if_fail (page != NULL);
-#line 255 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp0_ = page;
-#line 255 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_parse_name ("pixels-changed", TYPE_PAGE, &_tmp1_, NULL, FALSE);
+ gboolean _tmp3_ = FALSE;
+ guint _tmp4_ = 0U;
+ gboolean _tmp6_ = FALSE;
#line 255 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_handlers_disconnect_matched (_tmp0_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _autosave_manager_on_page_changed_page_pixels_changed, self);
-#line 256 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp2_ = page;
-#line 256 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_parse_name ("size-changed", TYPE_PAGE, &_tmp3_, NULL, FALSE);
-#line 256 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_handlers_disconnect_matched (_tmp2_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, 0, NULL, (GCallback) _autosave_manager_on_page_changed_page_size_changed, self);
+ g_return_if_fail (self != NULL);
#line 257 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp4_ = page;
+ _tmp1_ = self->priv->update_timeout;
#line 257 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_parse_name ("scan-direction-changed", TYPE_PAGE, &_tmp5_, NULL, FALSE);
+ if (_tmp1_ == ((guint) 0)) {
+#line 1387 "autosave-manager.c"
+ gboolean _tmp2_ = FALSE;
#line 257 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_handlers_disconnect_matched (_tmp4_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp5_, 0, NULL, (GCallback) _autosave_manager_on_page_changed_page_scan_direction_changed, self);
-#line 258 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp6_ = page;
-#line 258 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_parse_name ("crop-changed", TYPE_PAGE, &_tmp7_, NULL, FALSE);
+ _tmp2_ = do_timeout;
+#line 257 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp0_ = _tmp2_;
+#line 1393 "autosave-manager.c"
+ } else {
+#line 257 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp0_ = FALSE;
+#line 1397 "autosave-manager.c"
+ }
+#line 257 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp3_ = _tmp0_;
+#line 257 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ if (_tmp3_) {
#line 258 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_handlers_disconnect_matched (_tmp6_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp7_, 0, NULL, (GCallback) _autosave_manager_on_page_changed_page_crop_changed, self);
-#line 259 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp8_ = page;
-#line 259 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_connect (_tmp8_, "scan-finished", (GCallback) _autosave_manager_on_page_changed_page_scan_finished, self);
-#line 261 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp9_ = autosave_manager_PID;
-#line 261 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp10_ = string_to_string (_tmp9_);
+ g_debug ("autosave-manager.vala:258: Waiting to autosave...");
+#line 1405 "autosave-manager.c"
+ }
#line 261 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp11_ = g_strconcat ("\n DELETE FROM pages\n WHERE process_id = ", _tmp10_, "\n" \
-" AND page_hash = ?2\n" \
-" AND book_hash = ?3\n" \
-" AND book_revision = ?4\n" \
-" ", NULL);
+ _tmp4_ = self->priv->update_timeout;
#line 261 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- query = _tmp11_;
-#line 269 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp12_ = self->priv->database_connection;
-#line 269 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp13_ = query;
-#line 269 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp15_ = sqlite3_prepare_v2 (_tmp12_, _tmp13_, -1, &_tmp14_, NULL);
-#line 269 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _sqlite3_finalize0 (stmt);
-#line 269 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- stmt = _tmp14_;
-#line 269 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _result_ = _tmp15_;
-#line 270 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp16_ = _result_;
-#line 270 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp16_ != SQLITE_OK) {
-#line 1167 "autosave-manager.c"
- gint _tmp17_;
- gchar* _tmp18_ = NULL;
- gchar* _tmp19_;
- gchar* _tmp20_ = NULL;
- gchar* _tmp21_;
-#line 271 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp17_ = _result_;
-#line 271 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp18_ = g_strdup_printf ("%i", _tmp17_);
-#line 271 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp19_ = _tmp18_;
-#line 271 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp20_ = g_strconcat ("Error ", _tmp19_, " while preparing query", NULL);
-#line 271 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp21_ = _tmp20_;
-#line 271 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_warning ("autosave-manager.vala:271: %s", _tmp21_);
-#line 271 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp21_);
-#line 271 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp19_);
-#line 1189 "autosave-manager.c"
+ if (_tmp4_ > ((guint) 0)) {
+#line 1411 "autosave-manager.c"
+ guint _tmp5_ = 0U;
+#line 262 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp5_ = self->priv->update_timeout;
+#line 262 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_source_remove (_tmp5_);
+#line 1417 "autosave-manager.c"
}
-#line 272 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp22_ = stmt;
-#line 272 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp23_ = g_direct_hash;
-#line 272 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp24_ = page;
-#line 272 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp25_ = _tmp23_ (_tmp24_);
-#line 272 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- sqlite3_bind_int64 (_tmp22_, 2, (gint64) _tmp25_);
-#line 273 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp26_ = stmt;
-#line 273 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp27_ = g_direct_hash;
-#line 273 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp28_ = autosave_manager_get_book (self);
-#line 273 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp29_ = _tmp28_;
-#line 273 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp30_ = _tmp27_ (_tmp29_);
-#line 273 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- sqlite3_bind_int64 (_tmp26_, 3, (gint64) _tmp30_);
-#line 274 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp31_ = stmt;
-#line 274 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp32_ = self->priv->cur_book_revision;
-#line 274 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- sqlite3_bind_int64 (_tmp31_, 4, (gint64) _tmp32_);
-#line 276 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp33_ = stmt;
-#line 276 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp34_ = sqlite3_step (_tmp33_);
-#line 276 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _result_ = _tmp34_;
-#line 277 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp35_ = _result_;
-#line 277 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp35_ != SQLITE_DONE) {
-#line 1229 "autosave-manager.c"
- gint _tmp36_;
-#line 278 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp36_ = _result_;
-#line 278 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_warning ("autosave-manager.vala:278: Error %d while executing query", _tmp36_);
-#line 1235 "autosave-manager.c"
+#line 263 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ self->priv->update_timeout = (guint) 0;
+#line 265 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp6_ = do_timeout;
+#line 265 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ if (_tmp6_) {
+#line 1425 "autosave-manager.c"
+ guint _tmp7_ = 0U;
+#line 267 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp7_ = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 100, ____lambda2__gsource_func, autosave_manager_ref (self), autosave_manager_unref);
+#line 267 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ self->priv->update_timeout = _tmp7_;
+#line 1431 "autosave-manager.c"
+ } else {
+#line 275 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ autosave_manager_real_save (self);
+#line 1435 "autosave-manager.c"
}
-#line 253 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _sqlite3_finalize0 (stmt);
-#line 253 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (query);
-#line 1241 "autosave-manager.c"
}
-void autosave_manager_on_reordered (AutosaveManager* self) {
-#line 281 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+static void autosave_manager_real_save (AutosaveManager* self) {
+ GKeyFile* file = NULL;
+ GKeyFile* _tmp0_ = NULL;
+ gchar* page_names = NULL;
+ gchar* _tmp1_ = NULL;
+ GKeyFile* _tmp122_ = NULL;
+ const gchar* _tmp123_ = NULL;
+ GError * _inner_error_ = NULL;
+#line 278 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (self != NULL);
-#line 1248 "autosave-manager.c"
- {
- gint i;
+#line 280 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_debug ("autosave-manager.vala:280: Autosaving book information");
+#line 282 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp0_ = g_key_file_new ();
+#line 282 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ file = _tmp0_;
#line 283 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp1_ = g_strdup ("");
+#line 283 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ page_names = _tmp1_;
+#line 1460 "autosave-manager.c"
+ {
+ gint i = 0;
+#line 284 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
i = 0;
-#line 1253 "autosave-manager.c"
+#line 1465 "autosave-manager.c"
{
- gboolean _tmp0_;
-#line 283 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp0_ = TRUE;
-#line 283 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ gboolean _tmp2_ = FALSE;
+#line 284 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp2_ = TRUE;
+#line 284 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
while (TRUE) {
-#line 1260 "autosave-manager.c"
- gboolean _tmp1_;
- gint _tmp3_;
- Book* _tmp4_;
- Book* _tmp5_;
- guint _tmp6_ = 0U;
- Book* _tmp7_;
- Book* _tmp8_;
- gint _tmp9_;
- Page* _tmp10_ = NULL;
- Page* page;
- const gchar* _tmp11_;
- const gchar* _tmp12_ = NULL;
- gchar* _tmp13_ = NULL;
- gchar* query;
- sqlite3_stmt* stmt = NULL;
- sqlite3* _tmp14_;
- const gchar* _tmp15_;
- sqlite3_stmt* _tmp16_ = NULL;
+#line 1472 "autosave-manager.c"
+ gboolean _tmp3_ = FALSE;
+ gint _tmp5_ = 0;
+ Book* _tmp6_ = NULL;
+ Book* _tmp7_ = NULL;
+ guint _tmp8_ = 0U;
+ guint _tmp9_ = 0U;
+ Page* page = NULL;
+ Book* _tmp10_ = NULL;
+ Book* _tmp11_ = NULL;
+ gint _tmp12_ = 0;
+ Page* _tmp13_ = NULL;
+ Page* _tmp14_ = NULL;
+ gboolean _tmp15_ = FALSE;
+ gboolean _tmp16_ = FALSE;
+ gchar* page_name = NULL;
gint _tmp17_ = 0;
- gint _result_;
- gint _tmp18_;
- sqlite3_stmt* _tmp24_;
- gint _tmp25_;
- sqlite3_stmt* _tmp26_;
- GHashFunc _tmp27_;
- Page* _tmp28_;
- guint _tmp29_ = 0U;
- sqlite3_stmt* _tmp30_;
- GHashFunc _tmp31_;
- Book* _tmp32_;
- Book* _tmp33_;
- guint _tmp34_ = 0U;
- sqlite3_stmt* _tmp35_;
- gint _tmp36_;
- sqlite3_stmt* _tmp37_;
- gint _tmp38_ = 0;
- gint _tmp39_;
-#line 283 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp1_ = _tmp0_;
-#line 283 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (!_tmp1_) {
-#line 1302 "autosave-manager.c"
- gint _tmp2_;
-#line 283 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp2_ = i;
-#line 283 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- i = _tmp2_ + 1;
-#line 1308 "autosave-manager.c"
+ gchar* _tmp18_ = NULL;
+ const gchar* _tmp19_ = NULL;
+ const gchar* _tmp22_ = NULL;
+ const gchar* _tmp23_ = NULL;
+ gchar* _tmp24_ = NULL;
+ const gchar* _tmp25_ = NULL;
+ GKeyFile* _tmp26_ = NULL;
+ const gchar* _tmp27_ = NULL;
+ Page* _tmp28_ = NULL;
+ gint _tmp29_ = 0;
+ gint _tmp30_ = 0;
+ GKeyFile* _tmp31_ = NULL;
+ const gchar* _tmp32_ = NULL;
+ Page* _tmp33_ = NULL;
+ gint _tmp34_ = 0;
+ gint _tmp35_ = 0;
+ GKeyFile* _tmp36_ = NULL;
+ const gchar* _tmp37_ = NULL;
+ Page* _tmp38_ = NULL;
+ gint _tmp39_ = 0;
+ gint _tmp40_ = 0;
+ GKeyFile* _tmp41_ = NULL;
+ const gchar* _tmp42_ = NULL;
+ Page* _tmp43_ = NULL;
+ gint _tmp44_ = 0;
+ gint _tmp45_ = 0;
+ GKeyFile* _tmp46_ = NULL;
+ const gchar* _tmp47_ = NULL;
+ Page* _tmp48_ = NULL;
+ gint _tmp49_ = 0;
+ gint _tmp50_ = 0;
+ GKeyFile* _tmp51_ = NULL;
+ const gchar* _tmp52_ = NULL;
+ Page* _tmp53_ = NULL;
+ gint _tmp54_ = 0;
+ gint _tmp55_ = 0;
+ Page* _tmp56_ = NULL;
+ ScanDirection _tmp57_ = 0;
+ ScanDirection _tmp58_ = 0;
+ gchar* _tmp67_ = NULL;
+ Page* _tmp68_ = NULL;
+ const gchar* _tmp69_ = NULL;
+ const gchar* _tmp70_ = NULL;
+ gchar* _tmp71_ = NULL;
+ const gchar* _tmp72_ = NULL;
+ GKeyFile* _tmp74_ = NULL;
+ const gchar* _tmp75_ = NULL;
+ const gchar* _tmp76_ = NULL;
+ gchar* _tmp77_ = NULL;
+ GHashTable* _tmp78_ = NULL;
+ Page* _tmp79_ = NULL;
+ gconstpointer _tmp80_ = NULL;
+ gchar* _tmp81_ = NULL;
+ const gchar* _tmp82_ = NULL;
+ GKeyFile* _tmp84_ = NULL;
+ const gchar* _tmp85_ = NULL;
+ const gchar* _tmp86_ = NULL;
+ GKeyFile* _tmp87_ = NULL;
+ const gchar* _tmp88_ = NULL;
+ Page* _tmp89_ = NULL;
+ gboolean _tmp90_ = FALSE;
+ gboolean _tmp91_ = FALSE;
+ gchar* _tmp92_ = NULL;
+ Page* _tmp93_ = NULL;
+ const gchar* _tmp94_ = NULL;
+ const gchar* _tmp95_ = NULL;
+ gchar* _tmp96_ = NULL;
+ const gchar* _tmp97_ = NULL;
+ GKeyFile* _tmp99_ = NULL;
+ const gchar* _tmp100_ = NULL;
+ const gchar* _tmp101_ = NULL;
+ GKeyFile* _tmp102_ = NULL;
+ const gchar* _tmp103_ = NULL;
+ Page* _tmp104_ = NULL;
+ gint _tmp105_ = 0;
+ gint _tmp106_ = 0;
+ GKeyFile* _tmp107_ = NULL;
+ const gchar* _tmp108_ = NULL;
+ Page* _tmp109_ = NULL;
+ gint _tmp110_ = 0;
+ gint _tmp111_ = 0;
+ GKeyFile* _tmp112_ = NULL;
+ const gchar* _tmp113_ = NULL;
+ Page* _tmp114_ = NULL;
+ gint _tmp115_ = 0;
+ gint _tmp116_ = 0;
+ GKeyFile* _tmp117_ = NULL;
+ const gchar* _tmp118_ = NULL;
+ Page* _tmp119_ = NULL;
+ gint _tmp120_ = 0;
+ gint _tmp121_ = 0;
+#line 284 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp3_ = _tmp2_;
+#line 284 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ if (!_tmp3_) {
+#line 1584 "autosave-manager.c"
+ gint _tmp4_ = 0;
+#line 284 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp4_ = i;
+#line 284 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ i = _tmp4_ + 1;
+#line 1590 "autosave-manager.c"
}
-#line 283 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp0_ = FALSE;
-#line 283 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp3_ = i;
-#line 283 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp4_ = autosave_manager_get_book (self);
-#line 283 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp5_ = _tmp4_;
-#line 283 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp6_ = book_get_n_pages (_tmp5_);
-#line 283 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (!(((guint) _tmp3_) < _tmp6_)) {
-#line 283 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 284 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp2_ = FALSE;
+#line 284 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp5_ = i;
+#line 284 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp6_ = autosave_manager_get_book (self);
+#line 284 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp7_ = _tmp6_;
+#line 284 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp8_ = book_get_n_pages (_tmp7_);
+#line 284 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp9_ = _tmp8_;
+#line 284 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ if (!(((guint) _tmp5_) < _tmp9_)) {
+#line 284 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
break;
-#line 1324 "autosave-manager.c"
+#line 1608 "autosave-manager.c"
}
-#line 285 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp7_ = autosave_manager_get_book (self);
-#line 285 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp8_ = _tmp7_;
-#line 285 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp9_ = i;
-#line 285 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp10_ = book_get_page (_tmp8_, _tmp9_);
-#line 285 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- page = _tmp10_;
#line 286 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp11_ = autosave_manager_PID;
+ _tmp10_ = autosave_manager_get_book (self);
#line 286 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp12_ = string_to_string (_tmp11_);
+ _tmp11_ = _tmp10_;
#line 286 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp13_ = g_strconcat ("\n" \
-" UPDATE pages SET page_number = ?5\n" \
-" WHERE process_id = ", _tmp12_, "\n" \
-" AND page_hash = ?2\n" \
-" AND book_hash = ?3\n" \
-" AND book_revision = ?4\n" \
-" ", NULL);
+ _tmp12_ = i;
#line 286 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- query = _tmp13_;
-#line 294 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp14_ = self->priv->database_connection;
-#line 294 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp15_ = query;
+ _tmp13_ = book_get_page (_tmp11_, _tmp12_);
+#line 286 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ page = _tmp13_;
+#line 289 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp14_ = page;
+#line 289 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp15_ = page_get_has_data (_tmp14_);
+#line 289 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp16_ = _tmp15_;
+#line 289 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ if (!_tmp16_) {
+#line 290 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _page_unref0 (page);
+#line 290 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ continue;
+#line 1632 "autosave-manager.c"
+ }
+#line 292 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp17_ = i;
+#line 292 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp18_ = g_strdup_printf ("page-%d", _tmp17_);
+#line 292 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ page_name = _tmp18_;
+#line 293 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp19_ = page_names;
+#line 293 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ if (g_strcmp0 (_tmp19_, "") != 0) {
+#line 1644 "autosave-manager.c"
+ const gchar* _tmp20_ = NULL;
+ gchar* _tmp21_ = NULL;
#line 294 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp17_ = sqlite3_prepare_v2 (_tmp14_, _tmp15_, -1, &_tmp16_, NULL);
+ _tmp20_ = page_names;
#line 294 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _sqlite3_finalize0 (stmt);
+ _tmp21_ = g_strconcat (_tmp20_, " ", NULL);
#line 294 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- stmt = _tmp16_;
+ _g_free0 (page_names);
#line 294 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _result_ = _tmp17_;
+ page_names = _tmp21_;
+#line 1655 "autosave-manager.c"
+ }
#line 295 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp18_ = _result_;
+ _tmp22_ = page_names;
#line 295 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp18_ != SQLITE_OK) {
-#line 1360 "autosave-manager.c"
- gint _tmp19_;
- gchar* _tmp20_ = NULL;
- gchar* _tmp21_;
- gchar* _tmp22_ = NULL;
- gchar* _tmp23_;
-#line 296 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp19_ = _result_;
-#line 296 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp20_ = g_strdup_printf ("%i", _tmp19_);
-#line 296 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp21_ = _tmp20_;
-#line 296 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp22_ = g_strconcat ("Error ", _tmp21_, " while preparing query", NULL);
-#line 296 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp23_ = _tmp22_;
-#line 296 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_warning ("autosave-manager.vala:296: %s", _tmp23_);
-#line 296 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp23_);
-#line 296 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp21_);
-#line 1382 "autosave-manager.c"
- }
-#line 298 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp24_ = stmt;
-#line 298 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp25_ = i;
-#line 298 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- sqlite3_bind_int64 (_tmp24_, 5, (gint64) _tmp25_);
+ _tmp23_ = page_name;
+#line 295 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp24_ = g_strconcat (_tmp22_, _tmp23_, NULL);
+#line 295 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (page_names);
+#line 295 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ page_names = _tmp24_;
+#line 297 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp25_ = page_name;
+#line 297 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_debug ("autosave-manager.vala:297: Autosaving page %s", _tmp25_);
#line 299 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp26_ = stmt;
+ _tmp26_ = file;
#line 299 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp27_ = g_direct_hash;
+ _tmp27_ = page_name;
#line 299 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp28_ = page;
#line 299 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp29_ = _tmp27_ (_tmp28_);
+ _tmp29_ = page_get_scan_width (_tmp28_);
#line 299 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- sqlite3_bind_int64 (_tmp26_, 2, (gint64) _tmp29_);
+ _tmp30_ = _tmp29_;
+#line 299 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_key_file_set_integer (_tmp26_, _tmp27_, "scan-width", _tmp30_);
#line 300 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp30_ = stmt;
+ _tmp31_ = file;
#line 300 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp31_ = g_direct_hash;
+ _tmp32_ = page_name;
#line 300 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp32_ = autosave_manager_get_book (self);
+ _tmp33_ = page;
#line 300 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp33_ = _tmp32_;
+ _tmp34_ = page_get_scan_height (_tmp33_);
#line 300 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp34_ = _tmp31_ (_tmp33_);
+ _tmp35_ = _tmp34_;
#line 300 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- sqlite3_bind_int64 (_tmp30_, 3, (gint64) _tmp34_);
+ g_key_file_set_integer (_tmp31_, _tmp32_, "scan-height", _tmp35_);
+#line 301 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp36_ = file;
#line 301 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp35_ = stmt;
+ _tmp37_ = page_name;
#line 301 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp36_ = self->priv->cur_book_revision;
+ _tmp38_ = page;
#line 301 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- sqlite3_bind_int64 (_tmp35_, 4, (gint64) _tmp36_);
+ _tmp39_ = page_get_rowstride (_tmp38_);
+#line 301 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp40_ = _tmp39_;
+#line 301 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_key_file_set_integer (_tmp36_, _tmp37_, "rowstride", _tmp40_);
+#line 302 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp41_ = file;
+#line 302 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp42_ = page_name;
+#line 302 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp43_ = page;
+#line 302 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp44_ = page_get_n_channels (_tmp43_);
+#line 302 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp45_ = _tmp44_;
+#line 302 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_key_file_set_integer (_tmp41_, _tmp42_, "n-channels", _tmp45_);
+#line 303 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp46_ = file;
+#line 303 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp47_ = page_name;
#line 303 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp37_ = stmt;
+ _tmp48_ = page;
#line 303 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp38_ = sqlite3_step (_tmp37_);
+ _tmp49_ = page_get_depth (_tmp48_);
#line 303 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _result_ = _tmp38_;
+ _tmp50_ = _tmp49_;
+#line 303 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_key_file_set_integer (_tmp46_, _tmp47_, "depth", _tmp50_);
+#line 304 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp51_ = file;
+#line 304 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp52_ = page_name;
+#line 304 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp53_ = page;
#line 304 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp39_ = _result_;
+ _tmp54_ = page_get_dpi (_tmp53_);
#line 304 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp39_ != SQLITE_DONE) {
-#line 1428 "autosave-manager.c"
- gint _tmp40_;
+ _tmp55_ = _tmp54_;
+#line 304 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_key_file_set_integer (_tmp51_, _tmp52_, "dpi", _tmp55_);
#line 305 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp40_ = _result_;
+ _tmp56_ = page;
#line 305 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_warning ("autosave-manager.vala:305: Error %d while executing query", _tmp40_);
-#line 1434 "autosave-manager.c"
- }
-#line 283 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _sqlite3_finalize0 (stmt);
-#line 283 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (query);
-#line 283 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _page_unref0 (page);
-#line 1442 "autosave-manager.c"
- }
- }
- }
-}
-
-
-void autosave_manager_on_page_changed (AutosaveManager* self, Page* page) {
- Page* _tmp0_;
-#line 309 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_return_if_fail (self != NULL);
+ _tmp57_ = page_get_scan_direction (_tmp56_);
+#line 305 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp58_ = _tmp57_;
+#line 305 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ switch (_tmp58_) {
+#line 305 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ case SCAN_DIRECTION_TOP_TO_BOTTOM:
+#line 1753 "autosave-manager.c"
+ {
+ GKeyFile* _tmp59_ = NULL;
+ const gchar* _tmp60_ = NULL;
+#line 308 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp59_ = file;
+#line 308 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp60_ = page_name;
+#line 308 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_key_file_set_value (_tmp59_, _tmp60_, "scan-direction", "TOP_TO_BOTTOM");
#line 309 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_return_if_fail (page != NULL);
+ break;
+#line 1765 "autosave-manager.c"
+ }
+#line 305 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ case SCAN_DIRECTION_LEFT_TO_RIGHT:
+#line 1769 "autosave-manager.c"
+ {
+ GKeyFile* _tmp61_ = NULL;
+ const gchar* _tmp62_ = NULL;
#line 311 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp0_ = page;
+ _tmp61_ = file;
#line 311 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- autosave_manager_update_page (self, _tmp0_);
-#line 1459 "autosave-manager.c"
-}
-
-
-void autosave_manager_on_needs_saving_changed (AutosaveManager* self, Book* book) {
+ _tmp62_ = page_name;
+#line 311 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_key_file_set_value (_tmp61_, _tmp62_, "scan-direction", "LEFT_TO_RIGHT");
+#line 312 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ break;
+#line 1781 "autosave-manager.c"
+ }
+#line 305 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ case SCAN_DIRECTION_BOTTOM_TO_TOP:
+#line 1785 "autosave-manager.c"
+ {
+ GKeyFile* _tmp63_ = NULL;
+ const gchar* _tmp64_ = NULL;
#line 314 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_return_if_fail (self != NULL);
+ _tmp63_ = file;
#line 314 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_return_if_fail (book != NULL);
-#line 1468 "autosave-manager.c"
- {
- gint n;
-#line 316 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- n = 0;
-#line 1473 "autosave-manager.c"
- {
- gboolean _tmp0_;
-#line 316 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp0_ = TRUE;
-#line 316 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- while (TRUE) {
-#line 1480 "autosave-manager.c"
- gboolean _tmp1_;
- gint _tmp3_;
- Book* _tmp4_;
- guint _tmp5_ = 0U;
- Book* _tmp6_;
- gint _tmp7_;
- Page* _tmp8_ = NULL;
- Page* page;
- Page* _tmp9_;
-#line 316 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp1_ = _tmp0_;
-#line 316 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (!_tmp1_) {
-#line 1494 "autosave-manager.c"
- gint _tmp2_;
-#line 316 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp2_ = n;
-#line 316 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- n = _tmp2_ + 1;
-#line 1500 "autosave-manager.c"
- }
-#line 316 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp0_ = FALSE;
-#line 316 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp3_ = n;
-#line 316 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp4_ = book;
-#line 316 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp5_ = book_get_n_pages (_tmp4_);
-#line 316 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (!(((guint) _tmp3_) < _tmp5_)) {
-#line 316 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp64_ = page_name;
+#line 314 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_key_file_set_value (_tmp63_, _tmp64_, "scan-direction", "BOTTOM_TO_TOP");
+#line 315 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ break;
+#line 1797 "autosave-manager.c"
+ }
+#line 305 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ case SCAN_DIRECTION_RIGHT_TO_LEFT:
+#line 1801 "autosave-manager.c"
+ {
+ GKeyFile* _tmp65_ = NULL;
+ const gchar* _tmp66_ = NULL;
+#line 317 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp65_ = file;
+#line 317 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp66_ = page_name;
+#line 317 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_key_file_set_value (_tmp65_, _tmp66_, "scan-direction", "RIGHT_TO_LEFT");
+#line 318 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ break;
+#line 1813 "autosave-manager.c"
+ }
+ default:
+#line 305 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
break;
-#line 1514 "autosave-manager.c"
+#line 1818 "autosave-manager.c"
}
-#line 318 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp6_ = book;
-#line 318 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp7_ = n;
-#line 318 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp8_ = book_get_page (_tmp6_, _tmp7_);
-#line 318 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- page = _tmp8_;
-#line 319 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp9_ = page;
-#line 319 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- autosave_manager_update_page (self, _tmp9_);
-#line 316 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 320 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp68_ = page;
+#line 320 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp69_ = page_get_color_profile (_tmp68_);
+#line 320 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp70_ = _tmp69_;
+#line 320 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp71_ = g_strdup (_tmp70_);
+#line 320 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp67_ = _tmp71_;
+#line 320 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp72_ = _tmp67_;
+#line 320 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ if (_tmp72_ == NULL) {
+#line 1834 "autosave-manager.c"
+ gchar* _tmp73_ = NULL;
+#line 320 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp73_ = g_strdup ("");
+#line 320 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (_tmp67_);
+#line 320 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp67_ = _tmp73_;
+#line 1842 "autosave-manager.c"
+ }
+#line 320 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp74_ = file;
+#line 320 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp75_ = page_name;
+#line 320 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp76_ = _tmp67_;
+#line 320 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_key_file_set_value (_tmp74_, _tmp75_, "color-profile", _tmp76_);
+#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp78_ = self->priv->page_filenames;
+#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp79_ = page;
+#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp80_ = g_hash_table_lookup (_tmp78_, _tmp79_);
+#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp81_ = g_strdup ((const gchar*) _tmp80_);
+#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp77_ = _tmp81_;
+#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp82_ = _tmp77_;
+#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ if (_tmp82_ == NULL) {
+#line 1866 "autosave-manager.c"
+ gchar* _tmp83_ = NULL;
+#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp83_ = g_strdup ("");
+#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (_tmp77_);
+#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp77_ = _tmp83_;
+#line 1874 "autosave-manager.c"
+ }
+#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp84_ = file;
+#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp85_ = page_name;
+#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp86_ = _tmp77_;
+#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_key_file_set_value (_tmp84_, _tmp85_, "pixels-filename", _tmp86_);
+#line 322 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp87_ = file;
+#line 322 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp88_ = page_name;
+#line 322 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp89_ = page;
+#line 322 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp90_ = page_get_has_crop (_tmp89_);
+#line 322 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp91_ = _tmp90_;
+#line 322 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_key_file_set_boolean (_tmp87_, _tmp88_, "has-crop", _tmp91_);
+#line 323 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp93_ = page;
+#line 323 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp94_ = page_get_crop_name (_tmp93_);
+#line 323 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp95_ = _tmp94_;
+#line 323 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp96_ = g_strdup (_tmp95_);
+#line 323 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp92_ = _tmp96_;
+#line 323 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp97_ = _tmp92_;
+#line 323 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ if (_tmp97_ == NULL) {
+#line 1910 "autosave-manager.c"
+ gchar* _tmp98_ = NULL;
+#line 323 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp98_ = g_strdup ("");
+#line 323 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (_tmp92_);
+#line 323 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp92_ = _tmp98_;
+#line 1918 "autosave-manager.c"
+ }
+#line 323 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp99_ = file;
+#line 323 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp100_ = page_name;
+#line 323 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp101_ = _tmp92_;
+#line 323 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_key_file_set_value (_tmp99_, _tmp100_, "crop-name", _tmp101_);
+#line 324 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp102_ = file;
+#line 324 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp103_ = page_name;
+#line 324 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp104_ = page;
+#line 324 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp105_ = page_get_crop_x (_tmp104_);
+#line 324 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp106_ = _tmp105_;
+#line 324 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_key_file_set_integer (_tmp102_, _tmp103_, "crop-x", _tmp106_);
+#line 325 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp107_ = file;
+#line 325 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp108_ = page_name;
+#line 325 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp109_ = page;
+#line 325 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp110_ = page_get_crop_y (_tmp109_);
+#line 325 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp111_ = _tmp110_;
+#line 325 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_key_file_set_integer (_tmp107_, _tmp108_, "crop-y", _tmp111_);
+#line 326 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp112_ = file;
+#line 326 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp113_ = page_name;
+#line 326 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp114_ = page;
+#line 326 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp115_ = page_get_crop_width (_tmp114_);
+#line 326 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp116_ = _tmp115_;
+#line 326 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_key_file_set_integer (_tmp112_, _tmp113_, "crop-width", _tmp116_);
+#line 327 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp117_ = file;
+#line 327 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp118_ = page_name;
+#line 327 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp119_ = page;
+#line 327 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp120_ = page_get_crop_height (_tmp119_);
+#line 327 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp121_ = _tmp120_;
+#line 327 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_key_file_set_integer (_tmp117_, _tmp118_, "crop-height", _tmp121_);
+#line 284 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (_tmp92_);
+#line 284 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (_tmp77_);
+#line 284 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (_tmp67_);
+#line 284 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (page_name);
+#line 284 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_page_unref0 (page);
-#line 1530 "autosave-manager.c"
+#line 1986 "autosave-manager.c"
}
}
}
+#line 329 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp122_ = file;
+#line 329 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp123_ = page_names;
+#line 329 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_key_file_set_value (_tmp122_, "simple-scan", "pages", _tmp123_);
+#line 1996 "autosave-manager.c"
+ {
+ const gchar* _tmp124_ = NULL;
+ const gchar* _tmp125_ = NULL;
+ GKeyFile* _tmp126_ = NULL;
+ gchar* _tmp127_ = NULL;
+ gchar* _tmp128_ = NULL;
+#line 333 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp124_ = autosave_manager_AUTOSAVE_DIR;
+#line 333 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_mkdir_with_parents (_tmp124_, 0777);
+#line 334 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp125_ = autosave_manager_AUTOSAVE_PATH;
+#line 334 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp126_ = file;
+#line 334 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp127_ = g_key_file_to_data (_tmp126_, NULL, NULL);
+#line 334 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp128_ = _tmp127_;
+#line 334 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_file_set_contents (_tmp125_, _tmp128_, (gssize) (-1), &_inner_error_);
+#line 334 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (_tmp128_);
+#line 334 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ if (_inner_error_ != NULL) {
+#line 2021 "autosave-manager.c"
+ goto __catch34_g_error;
+ }
+ }
+ goto __finally34;
+ __catch34_g_error:
+ {
+ GError* e = NULL;
+ GError* _tmp129_ = NULL;
+ const gchar* _tmp130_ = NULL;
+#line 331 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ e = _inner_error_;
+#line 331 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _inner_error_ = NULL;
+#line 338 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp129_ = e;
+#line 338 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp130_ = _tmp129_->message;
+#line 338 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_warning ("autosave-manager.vala:338: Failed to write autosave: %s", _tmp130_);
+#line 331 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_error_free0 (e);
+#line 2043 "autosave-manager.c"
+ }
+ __finally34:
+#line 331 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ if (_inner_error_ != NULL) {
+#line 331 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (page_names);
+#line 331 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_key_file_unref0 (file);
+#line 331 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+#line 331 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_clear_error (&_inner_error_);
+#line 331 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ return;
+#line 2058 "autosave-manager.c"
+ }
+#line 278 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (page_names);
+#line 278 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_key_file_unref0 (file);
+#line 2064 "autosave-manager.c"
}
-void autosave_manager_on_cleared (AutosaveManager* self) {
- gint _tmp0_;
-#line 325 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_return_if_fail (self != NULL);
-#line 327 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp0_ = self->priv->cur_book_revision;
-#line 327 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- self->priv->cur_book_revision = _tmp0_ + 1;
-#line 1545 "autosave-manager.c"
-}
-
-
-static void autosave_manager_insert_page (AutosaveManager* self, Page* page) {
- const gchar* _tmp0_;
- const gchar* _tmp1_ = NULL;
- gchar* _tmp2_ = NULL;
- gchar* query;
- sqlite3_stmt* stmt = NULL;
- sqlite3* _tmp3_;
- const gchar* _tmp4_;
- sqlite3_stmt* _tmp5_ = NULL;
- gint _tmp6_ = 0;
- gint _result_;
- gint _tmp7_;
- sqlite3_stmt* _tmp13_;
- GHashFunc _tmp14_;
- Page* _tmp15_;
- guint _tmp16_ = 0U;
- sqlite3_stmt* _tmp17_;
- GHashFunc _tmp18_;
- Book* _tmp19_;
- Book* _tmp20_;
- guint _tmp21_ = 0U;
- sqlite3_stmt* _tmp22_;
- gint _tmp23_;
- sqlite3_stmt* _tmp24_;
- gint _tmp25_ = 0;
- gint _tmp26_;
- Page* _tmp28_;
-#line 330 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+static void autosave_manager_save_pixels (AutosaveManager* self, Page* page) {
+ gchar* filename = NULL;
+ GHashFunc _tmp0_ = NULL;
+ Page* _tmp1_ = NULL;
+ guint _tmp2_ = 0U;
+ gchar* _tmp3_ = NULL;
+ gchar* path = NULL;
+ const gchar* _tmp4_ = NULL;
+ gchar* _tmp5_ = NULL;
+ GHashTable* _tmp6_ = NULL;
+ Page* _tmp7_ = NULL;
+ Page* _tmp8_ = NULL;
+ gchar* _tmp9_ = NULL;
+ GFile* file = NULL;
+ GFile* _tmp10_ = NULL;
+ GError * _inner_error_ = NULL;
+#line 342 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (self != NULL);
-#line 330 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 342 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (page != NULL);
-#line 332 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_debug ("autosave-manager.vala:332: Adding an autosave for a new page");
-#line 333 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp0_ = autosave_manager_PID;
-#line 333 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp1_ = string_to_string (_tmp0_);
-#line 333 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp2_ = g_strconcat ("\n" \
-" INSERT INTO pages\n" \
-" (process_id,\n" \
-" page_hash,\n" \
-" book_hash,\n" \
-" book_revision)\n" \
-" VALUES\n" \
-" (", _tmp1_, ",\n" \
-" ?2,\n" \
-" ?3,\n" \
-" ?4)\n" \
-" ", NULL);
-#line 333 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- query = _tmp2_;
-#line 346 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp3_ = self->priv->database_connection;
+#line 344 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp0_ = g_direct_hash;
+#line 344 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp1_ = page;
+#line 344 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp2_ = _tmp0_ (_tmp1_);
+#line 344 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp3_ = g_strdup_printf ("%u.pixels", _tmp2_);
+#line 344 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ filename = _tmp3_;
+#line 345 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp4_ = autosave_manager_AUTOSAVE_DIR;
+#line 345 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp5_ = g_build_filename (_tmp4_, filename, NULL);
+#line 345 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ path = _tmp5_;
#line 346 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp4_ = query;
+ _tmp6_ = self->priv->page_filenames;
#line 346 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp6_ = sqlite3_prepare_v2 (_tmp3_, _tmp4_, -1, &_tmp5_, NULL);
+ _tmp7_ = page;
#line 346 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _sqlite3_finalize0 (stmt);
+ _tmp8_ = _page_ref0 (_tmp7_);
#line 346 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- stmt = _tmp5_;
+ _tmp9_ = g_strdup (filename);
#line 346 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _result_ = _tmp6_;
-#line 347 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp7_ = _result_;
-#line 347 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp7_ != SQLITE_OK) {
-#line 1606 "autosave-manager.c"
- gint _tmp8_;
- gchar* _tmp9_ = NULL;
- gchar* _tmp10_;
- gchar* _tmp11_ = NULL;
- gchar* _tmp12_;
-#line 348 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp8_ = _result_;
-#line 348 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp9_ = g_strdup_printf ("%i", _tmp8_);
-#line 348 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp10_ = _tmp9_;
-#line 348 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp11_ = g_strconcat ("Error ", _tmp10_, " while preparing query", NULL);
-#line 348 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp12_ = _tmp11_;
+ g_hash_table_insert (_tmp6_, _tmp8_, _tmp9_);
#line 348 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_warning ("autosave-manager.vala:348: %s", _tmp12_);
-#line 348 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp12_);
-#line 348 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp10_);
-#line 1628 "autosave-manager.c"
- }
-#line 350 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp13_ = stmt;
+ g_debug ("autosave-manager.vala:348: Autosaving page pixels to %s", path);
#line 350 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp14_ = g_direct_hash;
+ _tmp10_ = g_file_new_for_path (path);
#line 350 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp15_ = page;
-#line 350 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp16_ = _tmp14_ (_tmp15_);
-#line 350 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- sqlite3_bind_int64 (_tmp13_, 2, (gint64) _tmp16_);
+ file = _tmp10_;
+#line 2120 "autosave-manager.c"
+ {
+ Page* _tmp11_ = NULL;
+ gint _tmp12_ = 0;
+ guchar* _tmp13_ = NULL;
+#line 353 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp11_ = page;
+#line 353 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp13_ = page_get_pixels (_tmp11_, &_tmp12_);
+#line 353 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_file_replace_contents (file, _tmp13_, (gsize) _tmp12_, NULL, FALSE, G_FILE_CREATE_NONE, NULL, NULL, &_inner_error_);
+#line 353 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ if (_inner_error_ != NULL) {
+#line 2133 "autosave-manager.c"
+ goto __catch35_g_error;
+ }
+ }
+ goto __finally35;
+ __catch35_g_error:
+ {
+ GError* e = NULL;
+ GError* _tmp14_ = NULL;
+ const gchar* _tmp15_ = NULL;
#line 351 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp17_ = stmt;
+ e = _inner_error_;
#line 351 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp18_ = g_direct_hash;
+ _inner_error_ = NULL;
+#line 357 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp14_ = e;
+#line 357 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp15_ = _tmp14_->message;
+#line 357 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_warning ("autosave-manager.vala:357: Failed to autosave page contents: %s", _tmp15_);
#line 351 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp19_ = autosave_manager_get_book (self);
+ _g_error_free0 (e);
+#line 2155 "autosave-manager.c"
+ }
+ __finally35:
#line 351 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp20_ = _tmp19_;
+ if (_inner_error_ != NULL) {
#line 351 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp21_ = _tmp18_ (_tmp20_);
+ _g_object_unref0 (file);
+#line 351 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (path);
+#line 351 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (filename);
+#line 351 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+#line 351 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_clear_error (&_inner_error_);
#line 351 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- sqlite3_bind_int64 (_tmp17_, 3, (gint64) _tmp21_);
-#line 352 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp22_ = stmt;
-#line 352 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp23_ = self->priv->cur_book_revision;
-#line 352 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- sqlite3_bind_int64 (_tmp22_, 4, (gint64) _tmp23_);
-#line 354 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp24_ = stmt;
-#line 354 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp25_ = sqlite3_step (_tmp24_);
-#line 354 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _result_ = _tmp25_;
-#line 355 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp26_ = _result_;
-#line 355 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp26_ != SQLITE_DONE) {
-#line 1668 "autosave-manager.c"
- gint _tmp27_;
-#line 356 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp27_ = _result_;
-#line 356 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_warning ("autosave-manager.vala:356: Error %d while executing query", _tmp27_);
-#line 1674 "autosave-manager.c"
- }
-#line 358 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp28_ = page;
-#line 358 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- autosave_manager_update_page (self, _tmp28_);
-#line 330 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _sqlite3_finalize0 (stmt);
-#line 330 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (query);
-#line 1684 "autosave-manager.c"
-}
-
-
-static gpointer _page_ref0 (gpointer self) {
-#line 363 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- return self ? page_ref (self) : NULL;
-#line 1691 "autosave-manager.c"
-}
-
-
-static gboolean __lambda2_ (AutosaveManager* self) {
- gboolean result = FALSE;
- GHashTable* _tmp0_;
- GHashTableIter iter = {0};
- Page* p = NULL;
- gboolean is_dirty = FALSE;
- GHashTable* _tmp6_;
-#line 368 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp0_ = self->priv->dirty_pages;
-#line 368 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_hash_table_iter_init (&iter, _tmp0_);
-#line 371 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- while (TRUE) {
-#line 1708 "autosave-manager.c"
- gconstpointer _tmp1_ = NULL;
- gconstpointer _tmp2_ = NULL;
- gboolean _tmp3_ = FALSE;
- Page* _tmp4_;
- Page* _tmp5_;
-#line 371 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp3_ = g_hash_table_iter_next (&iter, &_tmp1_, &_tmp2_);
-#line 371 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _page_unref0 (p);
-#line 371 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp4_ = _page_ref0 (_tmp1_);
-#line 371 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- p = _tmp4_;
-#line 371 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- is_dirty = _tmp2_;
-#line 371 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (!_tmp3_) {
-#line 371 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- break;
-#line 1728 "autosave-manager.c"
- }
-#line 372 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp5_ = p;
-#line 372 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- autosave_manager_real_update_page (self, _tmp5_);
-#line 1734 "autosave-manager.c"
- }
-#line 374 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp6_ = self->priv->dirty_pages;
-#line 374 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_hash_table_remove_all (_tmp6_);
-#line 375 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- self->priv->update_timeout = (guint) 0;
-#line 377 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- result = FALSE;
-#line 377 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _page_unref0 (p);
-#line 377 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- return result;
-#line 1748 "autosave-manager.c"
-}
-
-
-static gboolean ___lambda2__gsource_func (gpointer self) {
- gboolean result;
- result = __lambda2_ (self);
-#line 366 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- return result;
-#line 1757 "autosave-manager.c"
-}
-
-
-static void autosave_manager_update_page (AutosaveManager* self, Page* page) {
- GHashTable* _tmp0_;
- Page* _tmp1_;
- Page* _tmp2_;
- guint _tmp3_;
- guint _tmp5_ = 0U;
-#line 361 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_return_if_fail (self != NULL);
-#line 361 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_return_if_fail (page != NULL);
-#line 363 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp0_ = self->priv->dirty_pages;
-#line 363 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp1_ = page;
-#line 363 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp2_ = _page_ref0 (_tmp1_);
-#line 363 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_hash_table_insert (_tmp0_, _tmp2_, (gpointer) ((gintptr) TRUE));
-#line 364 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp3_ = self->priv->update_timeout;
-#line 364 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp3_ > ((guint) 0)) {
-#line 1783 "autosave-manager.c"
- guint _tmp4_;
-#line 365 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp4_ = self->priv->update_timeout;
-#line 365 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_source_remove (_tmp4_);
-#line 1789 "autosave-manager.c"
- }
-#line 366 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp5_ = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 100, ___lambda2__gsource_func, autosave_manager_ref (self), autosave_manager_unref);
-#line 366 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- self->priv->update_timeout = _tmp5_;
-#line 1795 "autosave-manager.c"
-}
-
-
-static void autosave_manager_real_update_page (AutosaveManager* self, Page* page) {
- gint crop_x = 0;
- gint crop_y = 0;
- gint crop_width = 0;
- gint crop_height = 0;
- Page* _tmp0_;
- gint _tmp1_ = 0;
- gint _tmp2_ = 0;
- gint _tmp3_ = 0;
- gint _tmp4_ = 0;
- sqlite3_stmt* stmt = NULL;
- Book* _tmp5_;
- Book* _tmp6_;
- Page* _tmp7_;
- guint _tmp8_ = 0U;
- gchar* _tmp9_ = NULL;
- gchar* _tmp10_;
- Page* _tmp11_;
- gint _tmp12_ = 0;
- gchar* _tmp13_ = NULL;
- gchar* _tmp14_;
- Page* _tmp15_;
- gint _tmp16_ = 0;
- gchar* _tmp17_ = NULL;
- gchar* _tmp18_;
- Page* _tmp19_;
- gint _tmp20_ = 0;
- gchar* _tmp21_ = NULL;
- gchar* _tmp22_;
- Page* _tmp23_;
- gint _tmp24_ = 0;
- gchar* _tmp25_ = NULL;
- gchar* _tmp26_;
- Page* _tmp27_;
- gint _tmp28_ = 0;
- gchar* _tmp29_ = NULL;
- gchar* _tmp30_;
- Page* _tmp31_;
- gint _tmp32_ = 0;
- gchar* _tmp33_ = NULL;
- gchar* _tmp34_;
- gint _tmp35_;
- gchar* _tmp36_ = NULL;
- gchar* _tmp37_;
- gint _tmp38_;
- gchar* _tmp39_ = NULL;
- gchar* _tmp40_;
- gint _tmp41_;
- gchar* _tmp42_ = NULL;
- gchar* _tmp43_;
- gint _tmp44_;
- gchar* _tmp45_ = NULL;
- gchar* _tmp46_;
- Page* _tmp47_;
- ScanDirection _tmp48_ = 0;
- gchar* _tmp49_ = NULL;
- gchar* _tmp50_;
- const gchar* _tmp51_;
- const gchar* _tmp52_ = NULL;
- gchar* _tmp53_ = NULL;
- gchar* _tmp54_;
- gchar* query;
- sqlite3* _tmp55_;
- const gchar* _tmp56_;
- sqlite3_stmt* _tmp57_ = NULL;
- gint _tmp58_ = 0;
- gint _result_;
- gint _tmp59_;
- sqlite3_stmt* _tmp61_;
- GHashFunc _tmp62_;
- Page* _tmp63_;
- guint _tmp64_ = 0U;
- sqlite3_stmt* _tmp65_;
- GHashFunc _tmp66_;
- Book* _tmp67_;
- Book* _tmp68_;
- guint _tmp69_ = 0U;
- sqlite3_stmt* _tmp70_;
- gint _tmp71_;
- Page* _tmp72_;
- gchar* _tmp73_ = NULL;
- gchar* _tmp74_;
- const gchar* _tmp75_;
- sqlite3_stmt* _tmp77_;
- const gchar* _tmp78_;
- gchar* _tmp79_;
- GDestroyNotify _tmp80_;
- gint _tmp81_ = 0;
- gint _tmp82_;
- Page* _tmp84_;
- gint _tmp85_ = 0;
- guchar* _tmp86_ = NULL;
- sqlite3_stmt* _tmp99_;
- gint _tmp100_ = 0;
-#line 381 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_return_if_fail (self != NULL);
-#line 381 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_return_if_fail (page != NULL);
-#line 383 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_debug ("autosave-manager.vala:383: Updating the autosave for a page");
-#line 389 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp0_ = page;
-#line 389 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- page_get_crop (_tmp0_, &_tmp1_, &_tmp2_, &_tmp3_, &_tmp4_);
-#line 389 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- crop_x = _tmp1_;
-#line 389 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- crop_y = _tmp2_;
-#line 389 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- crop_width = _tmp3_;
-#line 389 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- crop_height = _tmp4_;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp5_ = autosave_manager_get_book (self);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp6_ = _tmp5_;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp7_ = page;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp8_ = book_get_page_index (_tmp6_, _tmp7_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp9_ = g_strdup_printf ("%u", _tmp8_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp10_ = _tmp9_;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp11_ = page;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp12_ = page_get_dpi (_tmp11_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp13_ = g_strdup_printf ("%i", _tmp12_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp14_ = _tmp13_;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp15_ = page;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp16_ = page_get_width (_tmp15_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp17_ = g_strdup_printf ("%i", _tmp16_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp18_ = _tmp17_;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp19_ = page;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp20_ = page_get_height (_tmp19_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp21_ = g_strdup_printf ("%i", _tmp20_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp22_ = _tmp21_;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp23_ = page;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp24_ = page_get_depth (_tmp23_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp25_ = g_strdup_printf ("%i", _tmp24_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp26_ = _tmp25_;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp27_ = page;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp28_ = page_get_n_channels (_tmp27_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp29_ = g_strdup_printf ("%i", _tmp28_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp30_ = _tmp29_;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp31_ = page;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp32_ = page_get_rowstride (_tmp31_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp33_ = g_strdup_printf ("%i", _tmp32_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp34_ = _tmp33_;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp35_ = crop_x;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp36_ = g_strdup_printf ("%i", _tmp35_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp37_ = _tmp36_;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp38_ = crop_y;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp39_ = g_strdup_printf ("%i", _tmp38_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp40_ = _tmp39_;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp41_ = crop_width;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp42_ = g_strdup_printf ("%i", _tmp41_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp43_ = _tmp42_;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp44_ = crop_height;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp45_ = g_strdup_printf ("%i", _tmp44_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp46_ = _tmp45_;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp47_ = page;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp48_ = page_get_scan_direction (_tmp47_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp49_ = g_strdup_printf ("%i", (gint) _tmp48_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp50_ = _tmp49_;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp51_ = autosave_manager_PID;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp52_ = string_to_string (_tmp51_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp53_ = g_strconcat ("\n" \
-" UPDATE pages\n" \
-" SET\n" \
-" page_number=", _tmp10_, ",\n dpi=", _tmp14_, ",\n width=", _tmp18_, ",\n height=", _tmp22_, ",\n depth=", _tmp26_, ",\n n_channels=", _tmp30_, ",\n rowstride=", _tmp34_, ",\n crop_x=", _tmp37_, ",\n crop_y=", _tmp40_, ",\n crop_width=", _tmp43_, ",\n crop_height=", _tmp46_, ",\n scan_direction=", _tmp50_, ",\n" \
-" color_profile=?1,\n" \
-" pixels=?2\n" \
-" WHERE process_id = ", _tmp52_, "\n" \
-" AND page_hash = ?4\n" \
-" AND book_hash = ?5\n" \
-" AND book_revision = ?6\n" \
-" ", NULL);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp54_ = _tmp53_;
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp50_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp46_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp43_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp40_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp37_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp34_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp30_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp26_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp22_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp18_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp14_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp10_);
-#line 392 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- query = _tmp54_;
-#line 415 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp55_ = self->priv->database_connection;
-#line 415 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp56_ = query;
-#line 415 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp58_ = sqlite3_prepare_v2 (_tmp55_, _tmp56_, -1, &_tmp57_, NULL);
-#line 415 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _sqlite3_finalize0 (stmt);
-#line 415 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- stmt = _tmp57_;
-#line 415 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _result_ = _tmp58_;
-#line 416 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp59_ = _result_;
-#line 416 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp59_ != SQLITE_OK) {
-#line 2053 "autosave-manager.c"
- gint _tmp60_;
-#line 418 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp60_ = _result_;
-#line 418 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_warning ("autosave-manager.vala:418: Error %d while preparing statement", _tmp60_);
-#line 419 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (query);
-#line 419 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _sqlite3_finalize0 (stmt);
-#line 419 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return;
-#line 2065 "autosave-manager.c"
- }
-#line 422 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp61_ = stmt;
-#line 422 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp62_ = g_direct_hash;
-#line 422 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp63_ = page;
-#line 422 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp64_ = _tmp62_ (_tmp63_);
-#line 422 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- sqlite3_bind_int64 (_tmp61_, 4, (gint64) _tmp64_);
-#line 423 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp65_ = stmt;
-#line 423 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp66_ = g_direct_hash;
-#line 423 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp67_ = autosave_manager_get_book (self);
-#line 423 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp68_ = _tmp67_;
-#line 423 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp69_ = _tmp66_ (_tmp68_);
-#line 423 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- sqlite3_bind_int64 (_tmp65_, 5, (gint64) _tmp69_);
-#line 424 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp70_ = stmt;
-#line 424 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp71_ = self->priv->cur_book_revision;
-#line 424 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- sqlite3_bind_int64 (_tmp70_, 6, (gint64) _tmp71_);
-#line 425 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp72_ = page;
-#line 425 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp73_ = page_get_color_profile (_tmp72_);
-#line 425 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp74_ = _tmp73_;
-#line 425 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp75_ = _tmp74_;
-#line 425 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp75_ == NULL) {
-#line 2105 "autosave-manager.c"
- gchar* _tmp76_;
-#line 425 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp76_ = g_strdup ("");
-#line 425 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp74_);
-#line 425 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp74_ = _tmp76_;
-#line 2113 "autosave-manager.c"
- }
-#line 425 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp77_ = stmt;
-#line 425 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp78_ = _tmp74_;
-#line 425 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp79_ = g_strdup (_tmp78_);
-#line 425 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp80_ = g_free;
-#line 425 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp81_ = sqlite3_bind_text (_tmp77_, 1, _tmp79_, -1, _tmp80_);
-#line 425 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _result_ = _tmp81_;
-#line 427 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp82_ = _result_;
-#line 427 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp82_ != SQLITE_OK) {
-#line 2131 "autosave-manager.c"
- gint _tmp83_;
-#line 428 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp83_ = _result_;
-#line 428 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_warning ("autosave-manager.vala:428: Error %d while binding text", _tmp83_);
-#line 2137 "autosave-manager.c"
- }
-#line 430 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp84_ = page;
-#line 430 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp86_ = page_get_pixels (_tmp84_, &_tmp85_);
-#line 430 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp86_ != NULL) {
-#line 2145 "autosave-manager.c"
- sqlite3_stmt* _tmp87_;
- Page* _tmp88_;
- gint _tmp89_ = 0;
- guchar* _tmp90_ = NULL;
- Page* _tmp91_;
- gint _tmp92_ = 0;
- guchar* _tmp93_ = NULL;
- gint _tmp94_ = 0;
- gint _tmp95_;
-#line 433 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp87_ = stmt;
-#line 433 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp88_ = page;
-#line 433 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp90_ = page_get_pixels (_tmp88_, &_tmp89_);
-#line 433 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp91_ = page;
-#line 433 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp93_ = page_get_pixels (_tmp91_, &_tmp92_);
-#line 433 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp94_ = sqlite3_bind_blob (_tmp87_, 2, _tmp90_, _tmp92_, (GDestroyNotify) (-1));
-#line 433 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _result_ = _tmp94_;
-#line 434 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp95_ = _result_;
-#line 434 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp95_ != SQLITE_OK) {
-#line 2173 "autosave-manager.c"
- gint _tmp96_;
-#line 435 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp96_ = _result_;
-#line 435 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_warning ("autosave-manager.vala:435: Error %d while binding blob", _tmp96_);
-#line 2179 "autosave-manager.c"
- }
- } else {
- sqlite3_stmt* _tmp97_;
- gint _tmp98_ = 0;
-#line 438 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp97_ = stmt;
-#line 438 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp98_ = sqlite3_bind_null (_tmp97_, 2);
-#line 438 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_warn_if_fail (_tmp98_ == SQLITE_OK);
-#line 2190 "autosave-manager.c"
- }
-#line 440 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp99_ = stmt;
-#line 440 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp100_ = sqlite3_step (_tmp99_);
-#line 440 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_warn_if_fail (_tmp100_ == SQLITE_DONE);
-#line 381 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp74_);
-#line 381 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (query);
-#line 381 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _sqlite3_finalize0 (stmt);
-#line 2204 "autosave-manager.c"
-}
-
-
-static void autosave_manager_recover_book (AutosaveManager* self, Book** book) {
- sqlite3_stmt* stmt = NULL;
- const gchar* _tmp0_;
- const gchar* _tmp1_ = NULL;
- const gchar* _tmp2_;
- const gchar* _tmp3_ = NULL;
- gchar* _tmp4_ = NULL;
- gchar* query;
- sqlite3* _tmp5_;
- const gchar* _tmp6_;
- sqlite3_stmt* _tmp7_ = NULL;
- gint _tmp8_ = 0;
- gint _result_;
- gint _tmp9_;
- gboolean first;
- gboolean _tmp125_;
-#line 443 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_return_if_fail (self != NULL);
-#line 443 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_return_if_fail (*book != NULL);
-#line 446 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp0_ = autosave_manager_PID;
-#line 446 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp1_ = string_to_string (_tmp0_);
-#line 446 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp2_ = autosave_manager_PID;
-#line 446 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp3_ = string_to_string (_tmp2_);
-#line 446 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp4_ = g_strconcat ("\n" \
-" SELECT process_id,\n" \
-" page_hash,\n" \
-" book_hash,\n" \
-" book_revision,\n" \
-" page_number,\n" \
-" dpi,\n" \
-" width,\n" \
-" height,\n" \
-" depth,\n" \
-" n_channels,\n" \
-" rowstride,\n" \
-" color_profile,\n" \
-" crop_x,\n" \
-" crop_y,\n" \
-" crop_width,\n" \
-" crop_height,\n" \
-" scan_direction,\n" \
-" pixels,\n" \
-" id\n" \
-" FROM pages\n" \
-" WHERE process_id = ", _tmp1_, "\n" \
-" AND book_revision = (\n" \
-" SELECT MAX(book_revision) FROM pages WHERE process_i" \
-"d = ", _tmp3_, "\n )\n ORDER BY page_number\n ", NULL);
-#line 446 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- query = _tmp4_;
-#line 474 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp5_ = self->priv->database_connection;
-#line 474 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp6_ = query;
-#line 474 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp8_ = sqlite3_prepare_v2 (_tmp5_, _tmp6_, -1, &_tmp7_, NULL);
-#line 474 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _sqlite3_finalize0 (stmt);
-#line 474 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- stmt = _tmp7_;
-#line 474 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _result_ = _tmp8_;
-#line 475 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp9_ = _result_;
-#line 475 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp9_ != SQLITE_OK) {
-#line 2256 "autosave-manager.c"
- gint _tmp10_;
-#line 476 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp10_ = _result_;
-#line 476 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_warning ("autosave-manager.vala:476: Error %d while preparing statement", _tmp10_);
-#line 2262 "autosave-manager.c"
- }
-#line 478 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- first = TRUE;
-#line 479 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- while (TRUE) {
-#line 2268 "autosave-manager.c"
- sqlite3_stmt* _tmp11_;
- gint _tmp12_ = 0;
- gboolean _tmp13_;
- sqlite3_stmt* _tmp15_;
- gint _tmp16_ = 0;
- gint dpi;
- sqlite3_stmt* _tmp17_;
- gint _tmp18_ = 0;
- gint width;
- sqlite3_stmt* _tmp19_;
- gint _tmp20_ = 0;
- gint height;
- sqlite3_stmt* _tmp21_;
- gint _tmp22_ = 0;
- gint depth;
- sqlite3_stmt* _tmp23_;
- gint _tmp24_ = 0;
- gint n_channels;
- sqlite3_stmt* _tmp25_;
- gint _tmp26_ = 0;
- ScanDirection scan_direction;
- gboolean _tmp27_ = FALSE;
- gint _tmp28_;
- gboolean _tmp30_;
- gint _tmp31_;
- gchar* _tmp32_ = NULL;
- gchar* _tmp33_;
- gint _tmp34_;
- gchar* _tmp35_ = NULL;
- gchar* _tmp36_;
- gchar* _tmp37_ = NULL;
- gchar* _tmp38_;
- Book* _tmp39_;
- gint _tmp40_;
- gint _tmp41_;
- gint _tmp42_;
- ScanDirection _tmp43_;
- Page* _tmp44_ = NULL;
- Page* new_page;
- gboolean _tmp45_ = FALSE;
- gint _tmp46_;
- gboolean _tmp48_;
- Page* _tmp64_;
- sqlite3_stmt* _tmp65_;
- const gchar* _tmp66_ = NULL;
- sqlite3_stmt* _tmp67_;
- gint _tmp68_ = 0;
- gint crop_x;
- sqlite3_stmt* _tmp69_;
- gint _tmp70_ = 0;
- gint crop_y;
- sqlite3_stmt* _tmp71_;
- gint _tmp72_ = 0;
- gint crop_width;
- sqlite3_stmt* _tmp73_;
- gint _tmp74_ = 0;
- gint crop_height;
- gboolean _tmp75_ = FALSE;
- gint _tmp76_;
- gboolean _tmp78_;
- sqlite3_stmt* _tmp85_;
- gint _tmp86_ = 0;
- guchar* _tmp87_ = NULL;
- guchar* new_pixels;
- gint new_pixels_length1;
- gint _new_pixels_size_;
- guchar* _tmp88_;
- gint _tmp88__length1;
- sqlite3_stmt* _tmp89_;
- void* _tmp90_ = NULL;
- sqlite3_stmt* _tmp91_;
- gint _tmp92_ = 0;
- Page* _tmp93_;
- guchar* _tmp94_;
- gint _tmp94__length1;
- sqlite3_stmt* _tmp95_;
- gint _tmp96_ = 0;
- gint id;
- gint _tmp97_;
- gchar* _tmp98_ = NULL;
- gchar* _tmp99_;
- gchar* _tmp100_ = NULL;
- sqlite3_stmt* stmt2 = NULL;
- sqlite3* _tmp101_;
- const gchar* _tmp102_;
- sqlite3_stmt* _tmp103_ = NULL;
- gint _tmp104_ = 0;
- gint result2;
- gint _tmp105_;
- sqlite3_stmt* _tmp111_;
- GHashFunc _tmp112_;
- Page* _tmp113_;
- guint _tmp114_ = 0U;
- sqlite3_stmt* _tmp115_;
- GHashFunc _tmp116_;
- Book* _tmp117_;
- guint _tmp118_ = 0U;
- sqlite3_stmt* _tmp119_;
- gint _tmp120_;
- sqlite3_stmt* _tmp121_;
- gint _tmp122_ = 0;
- gint _tmp123_;
-#line 479 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp11_ = stmt;
-#line 479 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp12_ = sqlite3_step (_tmp11_);
-#line 479 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (!(SQLITE_ROW == _tmp12_)) {
-#line 479 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- break;
-#line 2379 "autosave-manager.c"
- }
-#line 481 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_debug ("autosave-manager.vala:481: Found a page that needs to be recovered");
-#line 482 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp13_ = first;
-#line 482 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp13_) {
-#line 2387 "autosave-manager.c"
- Book* _tmp14_;
-#line 484 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp14_ = *book;
-#line 484 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- book_clear (_tmp14_);
-#line 485 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- first = FALSE;
-#line 2395 "autosave-manager.c"
- }
-#line 487 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp15_ = stmt;
-#line 487 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp16_ = sqlite3_column_int (_tmp15_, 5);
-#line 487 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- dpi = _tmp16_;
-#line 488 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp17_ = stmt;
-#line 488 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp18_ = sqlite3_column_int (_tmp17_, 6);
-#line 488 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- width = _tmp18_;
-#line 489 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp19_ = stmt;
-#line 489 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp20_ = sqlite3_column_int (_tmp19_, 7);
-#line 489 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- height = _tmp20_;
-#line 490 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp21_ = stmt;
-#line 490 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp22_ = sqlite3_column_int (_tmp21_, 8);
-#line 490 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- depth = _tmp22_;
-#line 491 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp23_ = stmt;
-#line 491 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp24_ = sqlite3_column_int (_tmp23_, 9);
-#line 491 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- n_channels = _tmp24_;
-#line 492 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp25_ = stmt;
-#line 492 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp26_ = sqlite3_column_int (_tmp25_, 16);
-#line 492 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- scan_direction = (ScanDirection) _tmp26_;
-#line 494 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp28_ = width;
-#line 494 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp28_ <= 0) {
-#line 494 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp27_ = TRUE;
-#line 2439 "autosave-manager.c"
- } else {
- gint _tmp29_;
-#line 494 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp29_ = height;
-#line 494 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp27_ = _tmp29_ <= 0;
-#line 2446 "autosave-manager.c"
- }
-#line 494 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp30_ = _tmp27_;
-#line 494 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp30_) {
-#line 495 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- continue;
-#line 2454 "autosave-manager.c"
- }
-#line 497 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp31_ = width;
-#line 497 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp32_ = g_strdup_printf ("%i", _tmp31_);
-#line 497 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp33_ = _tmp32_;
-#line 497 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp34_ = height;
-#line 497 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp35_ = g_strdup_printf ("%i", _tmp34_);
-#line 497 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp36_ = _tmp35_;
-#line 497 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp37_ = g_strconcat ("Restoring a page of size ", _tmp33_, " x ", _tmp36_, NULL);
-#line 497 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp38_ = _tmp37_;
-#line 497 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_debug ("autosave-manager.vala:497: %s", _tmp38_);
-#line 497 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp38_);
-#line 497 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp36_);
-#line 497 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp33_);
-#line 498 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp39_ = *book;
-#line 498 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp40_ = width;
-#line 498 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp41_ = height;
-#line 498 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp42_ = dpi;
-#line 498 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp43_ = scan_direction;
-#line 498 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp44_ = book_append_page (_tmp39_, _tmp40_, _tmp41_, _tmp42_, _tmp43_);
-#line 498 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- new_page = _tmp44_;
-#line 500 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp46_ = depth;
-#line 500 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp46_ > 0) {
-#line 2498 "autosave-manager.c"
- gint _tmp47_;
-#line 500 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp47_ = n_channels;
-#line 500 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp45_ = _tmp47_ > 0;
-#line 2504 "autosave-manager.c"
- } else {
-#line 500 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp45_ = FALSE;
-#line 2508 "autosave-manager.c"
- }
-#line 500 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp48_ = _tmp45_;
-#line 500 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp48_) {
-#line 2514 "autosave-manager.c"
- ScanPageInfo* _tmp49_;
- ScanPageInfo* info;
- ScanPageInfo* _tmp50_;
- gint _tmp51_;
- ScanPageInfo* _tmp52_;
- gint _tmp53_;
- ScanPageInfo* _tmp54_;
- gint _tmp55_;
- ScanPageInfo* _tmp56_;
- gint _tmp57_;
- ScanPageInfo* _tmp58_;
- gint _tmp59_;
- ScanPageInfo* _tmp60_;
- gchar* _tmp61_;
- Page* _tmp62_;
- ScanPageInfo* _tmp63_;
-#line 502 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp49_ = scan_page_info_new ();
-#line 502 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- info = _tmp49_;
-#line 503 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp50_ = info;
-#line 503 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp51_ = width;
-#line 503 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp50_->width = _tmp51_;
-#line 504 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp52_ = info;
-#line 504 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp53_ = height;
-#line 504 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp52_->height = _tmp53_;
-#line 505 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp54_ = info;
-#line 505 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp55_ = depth;
-#line 505 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp54_->depth = _tmp55_;
-#line 506 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp56_ = info;
-#line 506 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp57_ = n_channels;
-#line 506 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp56_->n_channels = _tmp57_;
-#line 507 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp58_ = info;
-#line 507 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp59_ = dpi;
-#line 507 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp58_->dpi = (gdouble) _tmp59_;
-#line 508 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp60_ = info;
-#line 508 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp61_ = g_strdup ("");
-#line 508 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp60_->device);
-#line 508 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp60_->device = _tmp61_;
-#line 509 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp62_ = new_page;
-#line 509 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp63_ = info;
-#line 509 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- page_set_page_info (_tmp62_, _tmp63_);
-#line 500 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _scan_page_info_unref0 (info);
-#line 2581 "autosave-manager.c"
- }
-#line 512 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp64_ = new_page;
-#line 512 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp65_ = stmt;
-#line 512 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp66_ = sqlite3_column_text (_tmp65_, 11);
-#line 512 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- page_set_color_profile (_tmp64_, _tmp66_);
-#line 513 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp67_ = stmt;
-#line 513 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp68_ = sqlite3_column_int (_tmp67_, 12);
-#line 513 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- crop_x = _tmp68_;
-#line 514 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp69_ = stmt;
-#line 514 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp70_ = sqlite3_column_int (_tmp69_, 13);
-#line 514 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- crop_y = _tmp70_;
-#line 515 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp71_ = stmt;
-#line 515 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp72_ = sqlite3_column_int (_tmp71_, 14);
-#line 515 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- crop_width = _tmp72_;
-#line 516 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp73_ = stmt;
-#line 516 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp74_ = sqlite3_column_int (_tmp73_, 15);
-#line 516 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- crop_height = _tmp74_;
-#line 517 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp76_ = crop_width;
-#line 517 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp76_ > 0) {
-#line 2619 "autosave-manager.c"
- gint _tmp77_;
-#line 517 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp77_ = crop_height;
-#line 517 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp75_ = _tmp77_ > 0;
-#line 2625 "autosave-manager.c"
- } else {
-#line 517 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp75_ = FALSE;
-#line 2629 "autosave-manager.c"
- }
-#line 517 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp78_ = _tmp75_;
-#line 517 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp78_) {
-#line 2635 "autosave-manager.c"
- Page* _tmp79_;
- gint _tmp80_;
- gint _tmp81_;
- Page* _tmp82_;
- gint _tmp83_;
- gint _tmp84_;
-#line 519 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp79_ = new_page;
-#line 519 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp80_ = crop_width;
-#line 519 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp81_ = crop_height;
-#line 519 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- page_set_custom_crop (_tmp79_, _tmp80_, _tmp81_);
-#line 520 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp82_ = new_page;
-#line 520 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp83_ = crop_x;
-#line 520 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp84_ = crop_y;
-#line 520 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- page_move_crop (_tmp82_, _tmp83_, _tmp84_);
-#line 2658 "autosave-manager.c"
- }
-#line 523 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp85_ = stmt;
-#line 523 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp86_ = sqlite3_column_bytes (_tmp85_, 17);
-#line 523 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp87_ = g_new0 (guchar, _tmp86_);
-#line 523 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- new_pixels = _tmp87_;
-#line 523 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- new_pixels_length1 = _tmp86_;
-#line 523 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _new_pixels_size_ = new_pixels_length1;
-#line 524 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp88_ = new_pixels;
-#line 524 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp88__length1 = new_pixels_length1;
-#line 524 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp89_ = stmt;
-#line 524 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp90_ = sqlite3_column_blob (_tmp89_, 17);
-#line 524 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp91_ = stmt;
-#line 524 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp92_ = sqlite3_column_bytes (_tmp91_, 17);
-#line 524 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- memcpy (_tmp88_, _tmp90_, (gsize) _tmp92_);
-#line 525 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp93_ = new_page;
-#line 525 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp94_ = new_pixels;
-#line 525 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp94__length1 = new_pixels_length1;
-#line 525 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- page_set_pixels (_tmp93_, _tmp94_, _tmp94__length1);
-#line 527 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp95_ = stmt;
-#line 527 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp96_ = sqlite3_column_int (_tmp95_, 18);
-#line 527 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- id = _tmp96_;
-#line 528 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_debug ("autosave-manager.vala:528: Updating autosave to point to our new copy " \
-"of the page");
-#line 529 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp97_ = id;
-#line 529 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp98_ = g_strdup_printf ("%i", _tmp97_);
-#line 529 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp99_ = _tmp98_;
-#line 529 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp100_ = g_strconcat ("\n" \
-" UPDATE pages\n" \
-" SET page_hash=?1,\n" \
-" book_hash=?2,\n" \
-" book_revision=?3\n" \
-" WHERE id = ", _tmp99_, "\n ", NULL);
-#line 529 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (query);
-#line 529 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- query = _tmp100_;
-#line 529 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp99_);
-#line 538 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp101_ = self->priv->database_connection;
-#line 538 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp102_ = query;
-#line 538 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp104_ = sqlite3_prepare_v2 (_tmp101_, _tmp102_, -1, &_tmp103_, NULL);
-#line 538 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _sqlite3_finalize0 (stmt2);
-#line 538 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- stmt2 = _tmp103_;
-#line 538 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- result2 = _tmp104_;
-#line 539 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp105_ = result2;
-#line 539 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp105_ != SQLITE_OK) {
-#line 2732 "autosave-manager.c"
- gint _tmp106_;
- gchar* _tmp107_ = NULL;
- gchar* _tmp108_;
- gchar* _tmp109_ = NULL;
- gchar* _tmp110_;
-#line 540 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp106_ = result2;
-#line 540 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp107_ = g_strdup_printf ("%i", _tmp106_);
-#line 540 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp108_ = _tmp107_;
-#line 540 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp109_ = g_strconcat ("Error ", _tmp108_, " while preparing query", NULL);
-#line 540 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp110_ = _tmp109_;
-#line 540 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_warning ("autosave-manager.vala:540: %s", _tmp110_);
-#line 540 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp110_);
-#line 540 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (_tmp108_);
-#line 2754 "autosave-manager.c"
- }
-#line 541 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp111_ = stmt2;
-#line 541 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp112_ = g_direct_hash;
-#line 541 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp113_ = new_page;
-#line 541 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp114_ = _tmp112_ (_tmp113_);
-#line 541 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- sqlite3_bind_int64 (_tmp111_, 1, (gint64) _tmp114_);
-#line 542 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp115_ = stmt2;
-#line 542 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp116_ = g_direct_hash;
-#line 542 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp117_ = *book;
-#line 542 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp118_ = _tmp116_ (_tmp117_);
-#line 542 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- sqlite3_bind_int64 (_tmp115_, 2, (gint64) _tmp118_);
-#line 543 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp119_ = stmt2;
-#line 543 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp120_ = self->priv->cur_book_revision;
-#line 543 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- sqlite3_bind_int64 (_tmp119_, 3, (gint64) _tmp120_);
-#line 545 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp121_ = stmt2;
-#line 545 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp122_ = sqlite3_step (_tmp121_);
-#line 545 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- result2 = _tmp122_;
-#line 546 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp123_ = result2;
-#line 546 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp123_ != SQLITE_DONE) {
-#line 2792 "autosave-manager.c"
- gint _tmp124_;
-#line 547 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp124_ = _result_;
-#line 547 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_warning ("autosave-manager.vala:547: Error %d while executing query", _tmp124_);
-#line 2798 "autosave-manager.c"
- }
-#line 479 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _sqlite3_finalize0 (stmt2);
-#line 479 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- new_pixels = (g_free (new_pixels), NULL);
-#line 479 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _page_unref0 (new_page);
-#line 2806 "autosave-manager.c"
- }
-#line 550 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp125_ = first;
-#line 550 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (_tmp125_) {
-#line 551 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_debug ("autosave-manager.vala:551: No pages found to recover");
-#line 2814 "autosave-manager.c"
+#line 2172 "autosave-manager.c"
}
-#line 443 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_free0 (query);
-#line 443 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _sqlite3_finalize0 (stmt);
-#line 2820 "autosave-manager.c"
+#line 342 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_object_unref0 (file);
+#line 342 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (path);
+#line 342 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_free0 (filename);
+#line 2180 "autosave-manager.c"
}
Book* autosave_manager_get_book (AutosaveManager* self) {
Book* result;
- Book* _tmp0_;
-#line 54 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ Book* _tmp0_ = NULL;
+#line 26 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_val_if_fail (self != NULL, NULL);
-#line 56 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp0_ = self->priv->_book;
-#line 56 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 28 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp0_ = self->priv->book_;
+#line 28 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
result = _tmp0_;
-#line 56 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 28 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return result;
-#line 2835 "autosave-manager.c"
+#line 2195 "autosave-manager.c"
}
static void _autosave_manager_on_page_added_book_page_added (Book* _sender, Page* page, gpointer self) {
-#line 67 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 39 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_on_page_added (self, page);
-#line 2842 "autosave-manager.c"
+#line 2202 "autosave-manager.c"
}
static void _autosave_manager_on_page_removed_book_page_removed (Book* _sender, Page* page, gpointer self) {
-#line 68 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 40 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_on_page_removed (self, page);
-#line 2849 "autosave-manager.c"
+#line 2209 "autosave-manager.c"
}
-static void _autosave_manager_on_reordered_book_reordered (Book* _sender, gpointer self) {
-#line 69 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- autosave_manager_on_reordered (self);
-#line 2856 "autosave-manager.c"
+static void _autosave_manager_on_changed_book_reordered (Book* _sender, gpointer self) {
+#line 41 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ autosave_manager_on_changed (self);
+#line 2216 "autosave-manager.c"
}
static void _autosave_manager_on_cleared_book_cleared (Book* _sender, gpointer self) {
-#line 70 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 42 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_on_cleared (self);
-#line 2863 "autosave-manager.c"
+#line 2223 "autosave-manager.c"
}
static gpointer _book_ref0 (gpointer self) {
-#line 72 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 44 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return self ? book_ref (self) : NULL;
-#line 2870 "autosave-manager.c"
+#line 2230 "autosave-manager.c"
}
void autosave_manager_set_book (AutosaveManager* self, Book* value) {
- Book* _tmp0_;
- Book* _tmp19_;
- Book* _tmp20_;
- Book* _tmp21_;
- Book* _tmp22_;
- Book* _tmp23_;
- Book* _tmp24_;
-#line 58 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ Book* _tmp0_ = NULL;
+ Book* _tmp20_ = NULL;
+ Book* _tmp21_ = NULL;
+ Book* _tmp22_ = NULL;
+ Book* _tmp23_ = NULL;
+ Book* _tmp24_ = NULL;
+ Book* _tmp25_ = NULL;
+#line 30 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (self != NULL);
-#line 60 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp0_ = self->priv->_book;
-#line 60 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 32 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp0_ = self->priv->book_;
+#line 32 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (_tmp0_ != NULL) {
-#line 2888 "autosave-manager.c"
- Book* _tmp11_;
- guint _tmp12_ = 0U;
- Book* _tmp13_;
- guint _tmp14_ = 0U;
- Book* _tmp15_;
- guint _tmp16_ = 0U;
- Book* _tmp17_;
- guint _tmp18_ = 0U;
+#line 2248 "autosave-manager.c"
+ Book* _tmp12_ = NULL;
+ guint _tmp13_ = 0U;
+ Book* _tmp14_ = NULL;
+ guint _tmp15_ = 0U;
+ Book* _tmp16_ = NULL;
+ guint _tmp17_ = 0U;
+ Book* _tmp18_ = NULL;
+ guint _tmp19_ = 0U;
{
- gint i;
-#line 62 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ gint i = 0;
+#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
i = 0;
-#line 2901 "autosave-manager.c"
+#line 2261 "autosave-manager.c"
{
- gboolean _tmp1_;
-#line 62 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ gboolean _tmp1_ = FALSE;
+#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp1_ = TRUE;
-#line 62 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
while (TRUE) {
-#line 2908 "autosave-manager.c"
- gboolean _tmp2_;
- gint _tmp4_;
- Book* _tmp5_;
+#line 2268 "autosave-manager.c"
+ gboolean _tmp2_ = FALSE;
+ gint _tmp4_ = 0;
+ Book* _tmp5_ = NULL;
guint _tmp6_ = 0U;
- Book* _tmp7_;
- gint _tmp8_;
- Page* _tmp9_ = NULL;
- Page* page;
- Page* _tmp10_;
-#line 62 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ guint _tmp7_ = 0U;
+ Page* page = NULL;
+ Book* _tmp8_ = NULL;
+ gint _tmp9_ = 0;
+ Page* _tmp10_ = NULL;
+ Page* _tmp11_ = NULL;
+#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp2_ = _tmp1_;
-#line 62 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (!_tmp2_) {
-#line 2922 "autosave-manager.c"
- gint _tmp3_;
-#line 62 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 2283 "autosave-manager.c"
+ gint _tmp3_ = 0;
+#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp3_ = i;
-#line 62 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
i = _tmp3_ + 1;
-#line 2928 "autosave-manager.c"
+#line 2289 "autosave-manager.c"
}
-#line 62 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp1_ = FALSE;
-#line 62 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp4_ = i;
-#line 62 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp5_ = self->priv->_book;
-#line 62 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp5_ = self->priv->book_;
+#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp6_ = book_get_n_pages (_tmp5_);
-#line 62 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (!(((guint) _tmp4_) < _tmp6_)) {
-#line 62 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp7_ = _tmp6_;
+#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ if (!(((guint) _tmp4_) < _tmp7_)) {
+#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
break;
-#line 2942 "autosave-manager.c"
+#line 2305 "autosave-manager.c"
}
-#line 64 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp7_ = self->priv->_book;
-#line 64 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp8_ = i;
-#line 64 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp9_ = book_get_page (_tmp7_, _tmp8_);
-#line 64 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- page = _tmp9_;
-#line 65 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp10_ = page;
-#line 65 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- autosave_manager_on_page_removed (self, _tmp10_);
-#line 62 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp8_ = self->priv->book_;
+#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp9_ = i;
+#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp10_ = book_get_page (_tmp8_, _tmp9_);
+#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ page = _tmp10_;
+#line 37 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp11_ = page;
+#line 37 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ autosave_manager_on_page_removed (self, _tmp11_);
+#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_page_unref0 (page);
-#line 2958 "autosave-manager.c"
+#line 2321 "autosave-manager.c"
}
}
}
-#line 67 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp11_ = self->priv->_book;
-#line 67 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_parse_name ("page-added", TYPE_BOOK, &_tmp12_, NULL, FALSE);
-#line 67 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_handlers_disconnect_matched (_tmp11_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp12_, 0, NULL, (GCallback) _autosave_manager_on_page_added_book_page_added, self);
-#line 68 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp13_ = self->priv->_book;
-#line 68 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_parse_name ("page-removed", TYPE_BOOK, &_tmp14_, NULL, FALSE);
-#line 68 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_handlers_disconnect_matched (_tmp13_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp14_, 0, NULL, (GCallback) _autosave_manager_on_page_removed_book_page_removed, self);
-#line 69 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp15_ = self->priv->_book;
-#line 69 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_parse_name ("reordered", TYPE_BOOK, &_tmp16_, NULL, FALSE);
-#line 69 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_handlers_disconnect_matched (_tmp15_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp16_, 0, NULL, (GCallback) _autosave_manager_on_reordered_book_reordered, self);
-#line 70 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp17_ = self->priv->_book;
-#line 70 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_parse_name ("cleared", TYPE_BOOK, &_tmp18_, NULL, FALSE);
-#line 70 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_handlers_disconnect_matched (_tmp17_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp18_, 0, NULL, (GCallback) _autosave_manager_on_cleared_book_cleared, self);
-#line 2986 "autosave-manager.c"
+#line 39 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp12_ = self->priv->book_;
+#line 39 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_signal_parse_name ("page-added", TYPE_BOOK, &_tmp13_, NULL, FALSE);
+#line 39 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_signal_handlers_disconnect_matched (_tmp12_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp13_, 0, NULL, (GCallback) _autosave_manager_on_page_added_book_page_added, self);
+#line 40 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp14_ = self->priv->book_;
+#line 40 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_signal_parse_name ("page-removed", TYPE_BOOK, &_tmp15_, NULL, FALSE);
+#line 40 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_signal_handlers_disconnect_matched (_tmp14_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp15_, 0, NULL, (GCallback) _autosave_manager_on_page_removed_book_page_removed, self);
+#line 41 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp16_ = self->priv->book_;
+#line 41 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_signal_parse_name ("reordered", TYPE_BOOK, &_tmp17_, NULL, FALSE);
+#line 41 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_signal_handlers_disconnect_matched (_tmp16_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp17_, 0, NULL, (GCallback) _autosave_manager_on_changed_book_reordered, self);
+#line 42 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp18_ = self->priv->book_;
+#line 42 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_signal_parse_name ("cleared", TYPE_BOOK, &_tmp19_, NULL, FALSE);
+#line 42 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_signal_handlers_disconnect_matched (_tmp18_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp19_, 0, NULL, (GCallback) _autosave_manager_on_cleared_book_cleared, self);
+#line 2349 "autosave-manager.c"
}
-#line 72 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp19_ = value;
-#line 72 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp20_ = _book_ref0 (_tmp19_);
-#line 72 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _book_unref0 (self->priv->_book);
-#line 72 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- self->priv->_book = _tmp20_;
-#line 73 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp21_ = self->priv->_book;
-#line 73 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_connect (_tmp21_, "page-added", (GCallback) _autosave_manager_on_page_added_book_page_added, self);
-#line 74 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp22_ = self->priv->_book;
-#line 74 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_connect (_tmp22_, "page-removed", (GCallback) _autosave_manager_on_page_removed_book_page_removed, self);
-#line 75 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp23_ = self->priv->_book;
-#line 75 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_connect (_tmp23_, "reordered", (GCallback) _autosave_manager_on_reordered_book_reordered, self);
-#line 76 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp24_ = self->priv->_book;
-#line 76 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- g_signal_connect (_tmp24_, "cleared", (GCallback) _autosave_manager_on_cleared_book_cleared, self);
-#line 3012 "autosave-manager.c"
+#line 44 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp20_ = value;
+#line 44 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp21_ = _book_ref0 (_tmp20_);
+#line 44 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _book_unref0 (self->priv->book_);
+#line 44 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ self->priv->book_ = _tmp21_;
+#line 45 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp22_ = self->priv->book_;
+#line 45 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_signal_connect (_tmp22_, "page-added", (GCallback) _autosave_manager_on_page_added_book_page_added, self);
+#line 46 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp23_ = self->priv->book_;
+#line 46 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_signal_connect (_tmp23_, "page-removed", (GCallback) _autosave_manager_on_page_removed_book_page_removed, self);
+#line 47 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp24_ = self->priv->book_;
+#line 47 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_signal_connect (_tmp24_, "reordered", (GCallback) _autosave_manager_on_changed_book_reordered, self);
+#line 48 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp25_ = self->priv->book_;
+#line 48 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ g_signal_connect (_tmp25_, "cleared", (GCallback) _autosave_manager_on_cleared_book_cleared, self);
+#line 2375 "autosave-manager.c"
{
- gint i;
-#line 77 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ gint i = 0;
+#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
i = 0;
-#line 3017 "autosave-manager.c"
+#line 2380 "autosave-manager.c"
{
- gboolean _tmp25_;
-#line 77 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp25_ = TRUE;
-#line 77 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ gboolean _tmp26_ = FALSE;
+#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp26_ = TRUE;
+#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
while (TRUE) {
-#line 3024 "autosave-manager.c"
- gboolean _tmp26_;
- gint _tmp28_;
- Book* _tmp29_;
- guint _tmp30_ = 0U;
- Book* _tmp31_;
- Book* _tmp32_;
- gint _tmp33_;
- Page* _tmp34_ = NULL;
- Page* page;
- Page* _tmp35_;
-#line 77 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp26_ = _tmp25_;
-#line 77 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (!_tmp26_) {
-#line 3039 "autosave-manager.c"
- gint _tmp27_;
-#line 77 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp27_ = i;
-#line 77 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- i = _tmp27_ + 1;
-#line 3045 "autosave-manager.c"
+#line 2387 "autosave-manager.c"
+ gboolean _tmp27_ = FALSE;
+ gint _tmp29_ = 0;
+ Book* _tmp30_ = NULL;
+ guint _tmp31_ = 0U;
+ guint _tmp32_ = 0U;
+ Page* page = NULL;
+ Book* _tmp33_ = NULL;
+ gint _tmp34_ = 0;
+ Page* _tmp35_ = NULL;
+ Page* _tmp36_ = NULL;
+#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp27_ = _tmp26_;
+#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ if (!_tmp27_) {
+#line 2402 "autosave-manager.c"
+ gint _tmp28_ = 0;
+#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp28_ = i;
+#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ i = _tmp28_ + 1;
+#line 2408 "autosave-manager.c"
}
-#line 77 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp25_ = FALSE;
-#line 77 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp28_ = i;
-#line 77 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp29_ = self->priv->_book;
-#line 77 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp30_ = book_get_n_pages (_tmp29_);
-#line 77 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- if (!(((guint) _tmp28_) < _tmp30_)) {
-#line 77 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp26_ = FALSE;
+#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp29_ = i;
+#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp30_ = self->priv->book_;
+#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp31_ = book_get_n_pages (_tmp30_);
+#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp32_ = _tmp31_;
+#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ if (!(((guint) _tmp29_) < _tmp32_)) {
+#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
break;
-#line 3059 "autosave-manager.c"
+#line 2424 "autosave-manager.c"
}
-#line 79 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp31_ = autosave_manager_get_book (self);
-#line 79 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp32_ = _tmp31_;
-#line 79 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp33_ = i;
-#line 79 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp34_ = book_get_page (_tmp32_, _tmp33_);
-#line 79 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- page = _tmp34_;
-#line 80 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp35_ = page;
-#line 80 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- autosave_manager_on_page_added (self, _tmp35_);
-#line 77 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 51 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp33_ = self->priv->book_;
+#line 51 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp34_ = i;
+#line 51 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp35_ = book_get_page (_tmp33_, _tmp34_);
+#line 51 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ page = _tmp35_;
+#line 52 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp36_ = page;
+#line 52 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ autosave_manager_on_page_added (self, _tmp36_);
+#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_page_unref0 (page);
-#line 3077 "autosave-manager.c"
+#line 2440 "autosave-manager.c"
}
}
}
@@ -3174,181 +2445,181 @@ void autosave_manager_set_book (AutosaveManager* self, Book* value) {
static void value_autosave_manager_init (GValue* value) {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
value->data[0].v_pointer = NULL;
-#line 3087 "autosave-manager.c"
+#line 2450 "autosave-manager.c"
}
static void value_autosave_manager_free_value (GValue* value) {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (value->data[0].v_pointer) {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_unref (value->data[0].v_pointer);
-#line 3096 "autosave-manager.c"
+#line 2459 "autosave-manager.c"
}
}
static void value_autosave_manager_copy_value (const GValue* src_value, GValue* dest_value) {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (src_value->data[0].v_pointer) {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
dest_value->data[0].v_pointer = autosave_manager_ref (src_value->data[0].v_pointer);
-#line 3106 "autosave-manager.c"
+#line 2469 "autosave-manager.c"
} else {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
dest_value->data[0].v_pointer = NULL;
-#line 3110 "autosave-manager.c"
+#line 2473 "autosave-manager.c"
}
}
static gpointer value_autosave_manager_peek_pointer (const GValue* value) {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return value->data[0].v_pointer;
-#line 3118 "autosave-manager.c"
+#line 2481 "autosave-manager.c"
}
static gchar* value_autosave_manager_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (collect_values[0].v_pointer) {
-#line 3125 "autosave-manager.c"
+#line 2488 "autosave-manager.c"
AutosaveManager* object;
object = collect_values[0].v_pointer;
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (object->parent_instance.g_class == NULL) {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
-#line 3132 "autosave-manager.c"
+#line 2495 "autosave-manager.c"
} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
-#line 3136 "autosave-manager.c"
+#line 2499 "autosave-manager.c"
}
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
value->data[0].v_pointer = autosave_manager_ref (object);
-#line 3140 "autosave-manager.c"
+#line 2503 "autosave-manager.c"
} else {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
value->data[0].v_pointer = NULL;
-#line 3144 "autosave-manager.c"
+#line 2507 "autosave-manager.c"
}
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return NULL;
-#line 3148 "autosave-manager.c"
+#line 2511 "autosave-manager.c"
}
static gchar* value_autosave_manager_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
AutosaveManager** object_p;
object_p = collect_values[0].v_pointer;
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (!object_p) {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
-#line 3159 "autosave-manager.c"
+#line 2522 "autosave-manager.c"
}
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (!value->data[0].v_pointer) {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
*object_p = NULL;
-#line 3165 "autosave-manager.c"
+#line 2528 "autosave-manager.c"
} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
*object_p = value->data[0].v_pointer;
-#line 3169 "autosave-manager.c"
+#line 2532 "autosave-manager.c"
} else {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
*object_p = autosave_manager_ref (value->data[0].v_pointer);
-#line 3173 "autosave-manager.c"
+#line 2536 "autosave-manager.c"
}
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return NULL;
-#line 3177 "autosave-manager.c"
+#line 2540 "autosave-manager.c"
}
GParamSpec* param_spec_autosave_manager (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
ParamSpecAutosaveManager* spec;
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_val_if_fail (g_type_is_a (object_type, TYPE_AUTOSAVE_MANAGER), NULL);
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
G_PARAM_SPEC (spec)->value_type = object_type;
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return G_PARAM_SPEC (spec);
-#line 3191 "autosave-manager.c"
+#line 2554 "autosave-manager.c"
}
gpointer value_get_autosave_manager (const GValue* value) {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_AUTOSAVE_MANAGER), NULL);
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return value->data[0].v_pointer;
-#line 3200 "autosave-manager.c"
+#line 2563 "autosave-manager.c"
}
void value_set_autosave_manager (GValue* value, gpointer v_object) {
AutosaveManager* old;
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_AUTOSAVE_MANAGER));
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
old = value->data[0].v_pointer;
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (v_object) {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_AUTOSAVE_MANAGER));
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
value->data[0].v_pointer = v_object;
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_ref (value->data[0].v_pointer);
-#line 3220 "autosave-manager.c"
+#line 2583 "autosave-manager.c"
} else {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
value->data[0].v_pointer = NULL;
-#line 3224 "autosave-manager.c"
+#line 2587 "autosave-manager.c"
}
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (old) {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_unref (old);
-#line 3230 "autosave-manager.c"
+#line 2593 "autosave-manager.c"
}
}
void value_take_autosave_manager (GValue* value, gpointer v_object) {
AutosaveManager* old;
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_AUTOSAVE_MANAGER));
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
old = value->data[0].v_pointer;
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (v_object) {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_AUTOSAVE_MANAGER));
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
value->data[0].v_pointer = v_object;
-#line 3249 "autosave-manager.c"
+#line 2612 "autosave-manager.c"
} else {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
value->data[0].v_pointer = NULL;
-#line 3253 "autosave-manager.c"
+#line 2616 "autosave-manager.c"
}
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (old) {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_unref (old);
-#line 3259 "autosave-manager.c"
+#line 2622 "autosave-manager.c"
}
}
@@ -3356,86 +2627,60 @@ void value_take_autosave_manager (GValue* value, gpointer v_object) {
static void autosave_manager_class_init (AutosaveManagerClass * klass) {
const gchar* _tmp0_ = NULL;
gchar* _tmp1_ = NULL;
- gchar* _tmp2_;
- gchar* _tmp3_;
- const gchar* _tmp4_;
- const gchar* _tmp5_;
- const gchar* _tmp6_;
- gchar* _tmp7_;
- gchar* _tmp8_;
- gchar* _tmp9_ = NULL;
- pid_t _tmp10_ = 0;
- gchar* _tmp11_ = NULL;
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ gchar* _tmp2_ = NULL;
+ const gchar* _tmp3_ = NULL;
+ const gchar* _tmp4_ = NULL;
+ gchar* _tmp5_ = NULL;
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_parent_class = g_type_class_peek_parent (klass);
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
AUTOSAVE_MANAGER_CLASS (klass)->finalize = autosave_manager_finalize;
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_type_class_add_private (klass, sizeof (AutosaveManagerPrivate));
-#line 38 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 15 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp0_ = g_get_user_cache_dir ();
-#line 38 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 15 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp1_ = g_build_filename (_tmp0_, "simple-scan", "autosaves", NULL);
-#line 38 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 15 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_AUTOSAVE_DIR = _tmp1_;
-#line 39 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp2_ = g_strdup ("autosaves");
-#line 39 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- autosave_manager_AUTOSAVE_NAME = _tmp2_;
-#line 40 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp3_ = g_strdup (".db");
-#line 40 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- autosave_manager_AUTOSAVE_EXT = _tmp3_;
-#line 41 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp4_ = autosave_manager_AUTOSAVE_DIR;
-#line 41 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp5_ = autosave_manager_AUTOSAVE_NAME;
-#line 41 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp6_ = autosave_manager_AUTOSAVE_EXT;
-#line 41 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp7_ = g_strconcat (_tmp5_, _tmp6_, NULL);
-#line 41 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp8_ = _tmp7_;
-#line 41 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp9_ = g_build_filename (_tmp4_, _tmp8_, NULL);
-#line 41 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- autosave_manager_AUTOSAVE_FILENAME = _tmp9_;
-#line 43 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp10_ = getpid ();
-#line 43 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _tmp11_ = g_strdup_printf ("%i", (gint) _tmp10_);
-#line 43 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- autosave_manager_PID = _tmp11_;
-#line 3317 "autosave-manager.c"
+#line 16 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp2_ = g_strdup ("autosave.book");
+#line 16 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ autosave_manager_AUTOSAVE_FILENAME = _tmp2_;
+#line 17 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp3_ = autosave_manager_AUTOSAVE_DIR;
+#line 17 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp4_ = autosave_manager_AUTOSAVE_FILENAME;
+#line 17 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _tmp5_ = g_build_filename (_tmp3_, _tmp4_, NULL);
+#line 17 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ autosave_manager_AUTOSAVE_PATH = _tmp5_;
+#line 2658 "autosave-manager.c"
}
static void autosave_manager_instance_init (AutosaveManager * self) {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
self->priv = AUTOSAVE_MANAGER_GET_PRIVATE (self);
-#line 47 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- self->priv->_book = NULL;
-#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 19 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
self->priv->update_timeout = (guint) 0;
-#line 323 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- self->priv->cur_book_revision = 0;
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 23 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ self->priv->book_ = NULL;
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
self->ref_count = 1;
-#line 3332 "autosave-manager.c"
+#line 2671 "autosave-manager.c"
}
static void autosave_manager_finalize (AutosaveManager* obj) {
AutosaveManager * self;
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_AUTOSAVE_MANAGER, AutosaveManager);
-#line 46 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _sqlite3_close0 (self->priv->database_connection);
-#line 47 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _book_unref0 (self->priv->_book);
-#line 50 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
- _g_hash_table_unref0 (self->priv->dirty_pages);
-#line 3346 "autosave-manager.c"
+#line 21 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _g_hash_table_unref0 (self->priv->page_filenames);
+#line 23 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+ _book_unref0 (self->priv->book_);
+#line 2683 "autosave-manager.c"
}
@@ -3456,25 +2701,55 @@ GType autosave_manager_get_type (void) {
gpointer autosave_manager_ref (gpointer instance) {
AutosaveManager* self;
self = instance;
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_atomic_int_inc (&self->ref_count);
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return instance;
-#line 3371 "autosave-manager.c"
+#line 2708 "autosave-manager.c"
}
void autosave_manager_unref (gpointer instance) {
AutosaveManager* self;
self = instance;
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (g_atomic_int_dec_and_test (&self->ref_count)) {
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
AUTOSAVE_MANAGER_GET_CLASS (self)->finalize (self);
-#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
+#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_type_free_instance ((GTypeInstance *) self);
-#line 3384 "autosave-manager.c"
+#line 2721 "autosave-manager.c"
+ }
+}
+
+
+static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
+ if ((array != NULL) && (destroy_func != NULL)) {
+ int i;
+ for (i = 0; i < array_length; i = i + 1) {
+ if (((gpointer*) array)[i] != NULL) {
+ destroy_func (((gpointer*) array)[i]);
+ }
+ }
+ }
+}
+
+
+static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
+ _vala_array_destroy (array, array_length, destroy_func);
+ g_free (array);
+}
+
+
+static gint _vala_array_length (gpointer array) {
+ int length;
+ length = 0;
+ if (array) {
+ while (((gpointer*) array)[length]) {
+ length++;
+ }
}
+ return length;
}