summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlessio Treglia <alessio@debian.org>2012-08-07 18:56:05 +0200
committerAlessio Treglia <alessio@debian.org>2012-08-07 18:56:05 +0200
commit026e231507aa5dae486255b6450b410f37e3abb0 (patch)
tree6625869d3e4624b7fb872661390d131054338543 /src
parentf61940ebd00dbbcfccf408fd93fb1ab2ec5c78d5 (diff)
Imported Upstream version 3.5.3upstream/3.5.3
Diffstat (limited to 'src')
-rw-r--r--src/book-view.c15
-rw-r--r--src/book-view.vala5
-rw-r--r--src/book.c550
-rw-r--r--src/book.vala33
-rw-r--r--src/page-view.c2
-rw-r--r--src/page.c2
-rw-r--r--src/scanner.c2
-rw-r--r--src/simple-scan.c1016
-rw-r--r--src/simple-scan.vala53
-rw-r--r--src/ui.c2617
-rw-r--r--src/ui.vala206
11 files changed, 2641 insertions, 1860 deletions
diff --git a/src/book-view.c b/src/book-view.c
index 3be88c2..f418d37 100644
--- a/src/book-view.c
+++ b/src/book-view.c
@@ -1,4 +1,4 @@
-/* book-view.c generated by valac 0.16.0, the Vala compiler
+/* book-view.c generated by valac 0.16.1, the Vala compiler
* generated from book-view.vala, do not modify */
/*
@@ -193,6 +193,7 @@ void page_view_motion (PageView* self, gint x, gint y);
GdkCursorType page_view_get_cursor (PageView* self);
void book_view_select_next_page (BookView* self);
void book_view_select_prev_page (BookView* self);
+GtkWidget* book_view_get_event_source (BookView* self);
static void g_cclosure_user_marshal_VOID__PAGE (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
static void book_view_finalize (GObject* obj);
@@ -2215,6 +2216,18 @@ Page* book_view_get_selected (BookView* self) {
}
+GtkWidget* book_view_get_event_source (BookView* self) {
+ GtkWidget* result = NULL;
+ GtkWidget* _tmp0_;
+ GtkWidget* _tmp1_;
+ g_return_val_if_fail (self != NULL, NULL);
+ _tmp0_ = self->priv->drawing_area;
+ _tmp1_ = _g_object_ref0 (_tmp0_);
+ result = _tmp1_;
+ return result;
+}
+
+
static void g_cclosure_user_marshal_VOID__PAGE (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
typedef void (*GMarshalFunc_VOID__PAGE) (gpointer data1, gpointer arg_1, gpointer data2);
register GMarshalFunc_VOID__PAGE callback;
diff --git a/src/book-view.vala b/src/book-view.vala
index 3acd14e..faf1199 100644
--- a/src/book-view.vala
+++ b/src/book-view.vala
@@ -588,4 +588,9 @@ public class BookView : Gtk.VBox
else
return null;
}
+
+ public Gtk.Widget get_event_source ()
+ {
+ return drawing_area;
+ }
}
diff --git a/src/book.c b/src/book.c
index 711aa1c..c59870c 100644
--- a/src/book.c
+++ b/src/book.c
@@ -1,4 +1,4 @@
-/* book.c generated by valac 0.16.0, the Vala compiler
+/* book.c generated by valac 0.16.1, the Vala compiler
* generated from book.vala, do not modify */
/*
@@ -622,51 +622,65 @@ static GFile* book_make_indexed_file (Book* self, const gchar* uri, gint i) {
static void book_save_multi_file (Book* self, const gchar* type, GFile* file, GError** error) {
- gint i;
- GList* _tmp0_;
GError * _inner_error_ = NULL;
g_return_if_fail (self != NULL);
g_return_if_fail (type != NULL);
g_return_if_fail (file != NULL);
- i = 0;
- _tmp0_ = self->priv->pages;
{
- GList* page_collection = NULL;
- GList* page_it = NULL;
- page_collection = _tmp0_;
- for (page_it = page_collection; page_it != NULL; page_it = page_it->next) {
- Page* _tmp1_;
- Page* page = NULL;
- _tmp1_ = _page_ref0 ((Page*) page_it->data);
- page = _tmp1_;
- {
- Page* _tmp2_;
- const gchar* _tmp3_;
- GFile* _tmp4_;
- gchar* _tmp5_ = NULL;
- gchar* _tmp6_;
- gint _tmp7_;
- GFile* _tmp8_ = NULL;
+ gint i;
+ i = 0;
+ {
+ gboolean _tmp0_;
+ _tmp0_ = TRUE;
+ while (TRUE) {
+ gboolean _tmp1_;
+ gint _tmp3_;
+ guint _tmp4_ = 0U;
+ gint _tmp5_;
+ Page* _tmp6_ = NULL;
+ Page* page;
+ Page* _tmp7_;
+ const gchar* _tmp8_;
GFile* _tmp9_;
- gint _tmp10_;
- _tmp2_ = page;
- _tmp3_ = type;
- _tmp4_ = file;
- _tmp5_ = g_file_get_uri (_tmp4_);
- _tmp6_ = _tmp5_;
- _tmp7_ = i;
- _tmp8_ = book_make_indexed_file (self, _tmp6_, _tmp7_);
- _tmp9_ = _tmp8_;
- page_save (_tmp2_, _tmp3_, _tmp9_, &_inner_error_);
- _g_object_unref0 (_tmp9_);
- _g_free0 (_tmp6_);
+ gchar* _tmp10_ = NULL;
+ gchar* _tmp11_;
+ gint _tmp12_;
+ GFile* _tmp13_ = NULL;
+ GFile* _tmp14_;
+ gint _tmp15_;
+ _tmp1_ = _tmp0_;
+ if (!_tmp1_) {
+ gint _tmp2_;
+ _tmp2_ = i;
+ i = _tmp2_ + 1;
+ }
+ _tmp0_ = FALSE;
+ _tmp3_ = i;
+ _tmp4_ = book_get_n_pages (self);
+ if (!(((guint) _tmp3_) < _tmp4_)) {
+ break;
+ }
+ _tmp5_ = i;
+ _tmp6_ = book_get_page (self, _tmp5_);
+ page = _tmp6_;
+ _tmp7_ = page;
+ _tmp8_ = type;
+ _tmp9_ = file;
+ _tmp10_ = g_file_get_uri (_tmp9_);
+ _tmp11_ = _tmp10_;
+ _tmp12_ = i;
+ _tmp13_ = book_make_indexed_file (self, _tmp11_, _tmp12_);
+ _tmp14_ = _tmp13_;
+ page_save (_tmp7_, _tmp8_, _tmp14_, &_inner_error_);
+ _g_object_unref0 (_tmp14_);
+ _g_free0 (_tmp11_);
if (_inner_error_ != NULL) {
g_propagate_error (error, _inner_error_);
_page_unref0 (page);
return;
}
- _tmp10_ = i;
- i = _tmp10_ + 1;
+ _tmp15_ = i;
+ g_signal_emit_by_name (self, "saving", _tmp15_);
_page_unref0 (page);
}
}
@@ -715,7 +729,6 @@ static void book_save_ps (Book* self, GFile* file, GError** error) {
cairo_surface_t* _tmp4_;
cairo_surface_t* _tmp5_;
cairo_surface_t* surface;
- GList* _tmp6_;
GError * _inner_error_ = NULL;
g_return_if_fail (self != NULL);
g_return_if_fail (file != NULL);
@@ -732,62 +745,82 @@ static void book_save_ps (Book* self, GFile* file, GError** error) {
_tmp4_ = _tmp3_->surface;
_tmp5_ = _cairo_surface_reference0 (_tmp4_);
surface = _tmp5_;
- _tmp6_ = self->priv->pages;
{
- GList* page_collection = NULL;
- GList* page_it = NULL;
- page_collection = _tmp6_;
- for (page_it = page_collection; page_it != NULL; page_it = page_it->next) {
- Page* _tmp7_;
- Page* page = NULL;
- _tmp7_ = _page_ref0 ((Page*) page_it->data);
- page = _tmp7_;
- {
- Page* _tmp8_;
- GdkPixbuf* _tmp9_ = NULL;
+ gint i;
+ i = 0;
+ {
+ gboolean _tmp6_;
+ _tmp6_ = TRUE;
+ while (TRUE) {
+ gboolean _tmp7_;
+ gint _tmp9_;
+ guint _tmp10_ = 0U;
+ gint _tmp11_;
+ Page* _tmp12_ = NULL;
+ Page* page;
+ Page* _tmp13_;
+ GdkPixbuf* _tmp14_ = NULL;
GdkPixbuf* image;
- GdkPixbuf* _tmp10_;
- gint _tmp11_ = 0;
- Page* _tmp12_;
- gint _tmp13_ = 0;
+ GdkPixbuf* _tmp15_;
+ gint _tmp16_ = 0;
+ Page* _tmp17_;
+ gint _tmp18_ = 0;
gdouble width;
- GdkPixbuf* _tmp14_;
- gint _tmp15_ = 0;
- Page* _tmp16_;
- gint _tmp17_ = 0;
+ GdkPixbuf* _tmp19_;
+ gint _tmp20_ = 0;
+ Page* _tmp21_;
+ gint _tmp22_ = 0;
gdouble height;
- cairo_surface_t* _tmp18_;
- gdouble _tmp19_;
- gdouble _tmp20_;
- cairo_surface_t* _tmp21_;
- GdkPixbuf* _tmp22_;
- Page* _tmp23_;
- gint _tmp24_ = 0;
- cairo_surface_t* _tmp25_;
- _tmp8_ = page;
- _tmp9_ = page_get_image (_tmp8_, TRUE);
- image = _tmp9_;
- _tmp10_ = image;
- _tmp11_ = gdk_pixbuf_get_width (_tmp10_);
- _tmp12_ = page;
- _tmp13_ = page_get_dpi (_tmp12_);
- width = (_tmp11_ * 72.0) / _tmp13_;
- _tmp14_ = image;
- _tmp15_ = gdk_pixbuf_get_height (_tmp14_);
- _tmp16_ = page;
- _tmp17_ = page_get_dpi (_tmp16_);
- height = (_tmp15_ * 72.0) / _tmp17_;
- _tmp18_ = surface;
- _tmp19_ = width;
- _tmp20_ = height;
- cairo_ps_surface_set_size (_tmp18_, _tmp19_, _tmp20_);
- _tmp21_ = surface;
- _tmp22_ = image;
- _tmp23_ = page;
- _tmp24_ = page_get_dpi (_tmp23_);
- book_save_ps_pdf_surface (self, _tmp21_, _tmp22_, (gdouble) _tmp24_);
- _tmp25_ = surface;
- cairo_surface_show_page (_tmp25_);
+ cairo_surface_t* _tmp23_;
+ gdouble _tmp24_;
+ gdouble _tmp25_;
+ cairo_surface_t* _tmp26_;
+ GdkPixbuf* _tmp27_;
+ Page* _tmp28_;
+ gint _tmp29_ = 0;
+ cairo_surface_t* _tmp30_;
+ gint _tmp31_;
+ _tmp7_ = _tmp6_;
+ if (!_tmp7_) {
+ gint _tmp8_;
+ _tmp8_ = i;
+ i = _tmp8_ + 1;
+ }
+ _tmp6_ = FALSE;
+ _tmp9_ = i;
+ _tmp10_ = book_get_n_pages (self);
+ if (!(((guint) _tmp9_) < _tmp10_)) {
+ break;
+ }
+ _tmp11_ = i;
+ _tmp12_ = book_get_page (self, _tmp11_);
+ page = _tmp12_;
+ _tmp13_ = page;
+ _tmp14_ = page_get_image (_tmp13_, TRUE);
+ image = _tmp14_;
+ _tmp15_ = image;
+ _tmp16_ = gdk_pixbuf_get_width (_tmp15_);
+ _tmp17_ = page;
+ _tmp18_ = page_get_dpi (_tmp17_);
+ width = (_tmp16_ * 72.0) / _tmp18_;
+ _tmp19_ = image;
+ _tmp20_ = gdk_pixbuf_get_height (_tmp19_);
+ _tmp21_ = page;
+ _tmp22_ = page_get_dpi (_tmp21_);
+ height = (_tmp20_ * 72.0) / _tmp22_;
+ _tmp23_ = surface;
+ _tmp24_ = width;
+ _tmp25_ = height;
+ cairo_ps_surface_set_size (_tmp23_, _tmp24_, _tmp25_);
+ _tmp26_ = surface;
+ _tmp27_ = image;
+ _tmp28_ = page;
+ _tmp29_ = page_get_dpi (_tmp28_);
+ book_save_ps_pdf_surface (self, _tmp26_, _tmp27_, (gdouble) _tmp29_);
+ _tmp30_ = surface;
+ cairo_surface_show_page (_tmp30_);
+ _tmp31_ = i;
+ g_signal_emit_by_name (self, "saving", _tmp31_);
_g_object_unref0 (image);
_page_unref0 (page);
}
@@ -1123,55 +1156,55 @@ static void book_save_pdf (Book* self, GFile* file, GError** error) {
gchar* _tmp43_;
PDFWriter* _tmp44_;
PDFWriter* _tmp45_;
- PDFWriter* _tmp349_;
PDFWriter* _tmp350_;
- guint _tmp351_ = 0U;
+ PDFWriter* _tmp351_;
+ guint _tmp352_ = 0U;
guint info_number;
- PDFWriter* _tmp352_;
- guint _tmp353_;
- gchar* _tmp354_ = NULL;
- gchar* _tmp355_;
- PDFWriter* _tmp356_;
+ PDFWriter* _tmp353_;
+ guint _tmp354_;
+ gchar* _tmp355_ = NULL;
+ gchar* _tmp356_;
PDFWriter* _tmp357_;
- gchar* _tmp358_ = NULL;
- gchar* _tmp359_;
- PDFWriter* _tmp360_;
+ PDFWriter* _tmp358_;
+ gchar* _tmp359_ = NULL;
+ gchar* _tmp360_;
PDFWriter* _tmp361_;
PDFWriter* _tmp362_;
- gsize _tmp363_;
+ PDFWriter* _tmp363_;
+ gsize _tmp364_;
gsize xref_offset;
- PDFWriter* _tmp364_;
PDFWriter* _tmp365_;
PDFWriter* _tmp366_;
- GList* _tmp367_;
- guint _tmp368_ = 0U;
- gchar* _tmp369_ = NULL;
- gchar* _tmp370_;
- PDFWriter* _tmp371_;
- GList* _tmp372_;
- PDFWriter* _tmp377_;
+ PDFWriter* _tmp367_;
+ GList* _tmp368_;
+ guint _tmp369_ = 0U;
+ gchar* _tmp370_ = NULL;
+ gchar* _tmp371_;
+ PDFWriter* _tmp372_;
+ GList* _tmp373_;
PDFWriter* _tmp378_;
PDFWriter* _tmp379_;
PDFWriter* _tmp380_;
- GList* _tmp381_;
- guint _tmp382_ = 0U;
- gchar* _tmp383_ = NULL;
- gchar* _tmp384_;
- PDFWriter* _tmp385_;
- guint _tmp386_;
- gchar* _tmp387_ = NULL;
- gchar* _tmp388_;
- PDFWriter* _tmp389_;
- guint _tmp390_;
- gchar* _tmp391_ = NULL;
- gchar* _tmp392_;
- PDFWriter* _tmp393_;
+ PDFWriter* _tmp381_;
+ GList* _tmp382_;
+ guint _tmp383_ = 0U;
+ gchar* _tmp384_ = NULL;
+ gchar* _tmp385_;
+ PDFWriter* _tmp386_;
+ guint _tmp387_;
+ gchar* _tmp388_ = NULL;
+ gchar* _tmp389_;
+ PDFWriter* _tmp390_;
+ guint _tmp391_;
+ gchar* _tmp392_ = NULL;
+ gchar* _tmp393_;
PDFWriter* _tmp394_;
PDFWriter* _tmp395_;
- gsize _tmp396_;
- gchar* _tmp397_ = NULL;
- gchar* _tmp398_;
- PDFWriter* _tmp399_;
+ PDFWriter* _tmp396_;
+ gsize _tmp397_;
+ gchar* _tmp398_ = NULL;
+ gchar* _tmp399_;
+ PDFWriter* _tmp400_;
GError * _inner_error_ = NULL;
g_return_if_fail (self != NULL);
g_return_if_fail (file != NULL);
@@ -1446,6 +1479,7 @@ static void book_save_pdf (Book* self, GFile* file, GError** error) {
PDFWriter* _tmp346_;
PDFWriter* _tmp347_;
PDFWriter* _tmp348_;
+ gint _tmp349_;
_tmp47_ = _tmp46_;
if (!_tmp47_) {
gint _tmp48_;
@@ -2317,6 +2351,8 @@ static void book_save_pdf (Book* self, GFile* file, GError** error) {
pdf_writer_write_string (_tmp347_, "endstream\n");
_tmp348_ = writer;
pdf_writer_write_string (_tmp348_, "endobj\n");
+ _tmp349_ = i;
+ g_signal_emit_by_name (self, "saving", _tmp349_);
_g_free0 (command);
compressed_data = (g_free (compressed_data), NULL);
data = (g_free (data), NULL);
@@ -2329,186 +2365,163 @@ static void book_save_pdf (Book* self, GFile* file, GError** error) {
}
}
}
- _tmp349_ = writer;
- pdf_writer_write_string (_tmp349_, "\n");
_tmp350_ = writer;
- _tmp351_ = pdf_writer_start_object (_tmp350_);
- info_number = _tmp351_;
- _tmp352_ = writer;
- _tmp353_ = info_number;
- _tmp354_ = g_strdup_printf ("%u 0 obj\n", _tmp353_);
- _tmp355_ = _tmp354_;
- pdf_writer_write_string (_tmp352_, _tmp355_);
- _g_free0 (_tmp355_);
- _tmp356_ = writer;
- pdf_writer_write_string (_tmp356_, "<<\n");
+ pdf_writer_write_string (_tmp350_, "\n");
+ _tmp351_ = writer;
+ _tmp352_ = pdf_writer_start_object (_tmp351_);
+ info_number = _tmp352_;
+ _tmp353_ = writer;
+ _tmp354_ = info_number;
+ _tmp355_ = g_strdup_printf ("%u 0 obj\n", _tmp354_);
+ _tmp356_ = _tmp355_;
+ pdf_writer_write_string (_tmp353_, _tmp356_);
+ _g_free0 (_tmp356_);
_tmp357_ = writer;
- _tmp358_ = g_strdup_printf ("/Creator (Simple Scan %s)\n", VERSION);
- _tmp359_ = _tmp358_;
- pdf_writer_write_string (_tmp357_, _tmp359_);
- _g_free0 (_tmp359_);
- _tmp360_ = writer;
- pdf_writer_write_string (_tmp360_, ">>\n");
+ pdf_writer_write_string (_tmp357_, "<<\n");
+ _tmp358_ = writer;
+ _tmp359_ = g_strdup_printf ("/Creator (Simple Scan %s)\n", VERSION);
+ _tmp360_ = _tmp359_;
+ pdf_writer_write_string (_tmp358_, _tmp360_);
+ _g_free0 (_tmp360_);
_tmp361_ = writer;
- pdf_writer_write_string (_tmp361_, "endobj\n");
+ pdf_writer_write_string (_tmp361_, ">>\n");
_tmp362_ = writer;
- _tmp363_ = _tmp362_->offset;
- xref_offset = _tmp363_;
- _tmp364_ = writer;
- pdf_writer_write_string (_tmp364_, "xref\n");
+ pdf_writer_write_string (_tmp362_, "endobj\n");
+ _tmp363_ = writer;
+ _tmp364_ = _tmp363_->offset;
+ xref_offset = _tmp364_;
_tmp365_ = writer;
+ pdf_writer_write_string (_tmp365_, "xref\n");
_tmp366_ = writer;
- _tmp367_ = _tmp366_->object_offsets;
- _tmp368_ = g_list_length (_tmp367_);
- _tmp369_ = g_strdup_printf ("1 %zu\n", (gsize) _tmp368_);
- _tmp370_ = _tmp369_;
- pdf_writer_write_string (_tmp365_, _tmp370_);
- _g_free0 (_tmp370_);
- _tmp371_ = writer;
- _tmp372_ = _tmp371_->object_offsets;
+ _tmp367_ = writer;
+ _tmp368_ = _tmp367_->object_offsets;
+ _tmp369_ = g_list_length (_tmp368_);
+ _tmp370_ = g_strdup_printf ("1 %zu\n", (gsize) _tmp369_);
+ _tmp371_ = _tmp370_;
+ pdf_writer_write_string (_tmp366_, _tmp371_);
+ _g_free0 (_tmp371_);
+ _tmp372_ = writer;
+ _tmp373_ = _tmp372_->object_offsets;
{
GList* offset_collection = NULL;
GList* offset_it = NULL;
- offset_collection = _tmp372_;
+ offset_collection = _tmp373_;
for (offset_it = offset_collection; offset_it != NULL; offset_it = offset_it->next) {
guint offset = 0U;
offset = GPOINTER_TO_UINT (offset_it->data);
{
- PDFWriter* _tmp373_;
- guint _tmp374_;
- gchar* _tmp375_ = NULL;
- gchar* _tmp376_;
- _tmp373_ = writer;
- _tmp374_ = offset;
- _tmp375_ = g_strdup_printf ("%010zu 00000 n \n", (gsize) _tmp374_);
- _tmp376_ = _tmp375_;
- pdf_writer_write_string (_tmp373_, _tmp376_);
- _g_free0 (_tmp376_);
+ PDFWriter* _tmp374_;
+ guint _tmp375_;
+ gchar* _tmp376_ = NULL;
+ gchar* _tmp377_;
+ _tmp374_ = writer;
+ _tmp375_ = offset;
+ _tmp376_ = g_strdup_printf ("%010zu 00000 n \n", (gsize) _tmp375_);
+ _tmp377_ = _tmp376_;
+ pdf_writer_write_string (_tmp374_, _tmp377_);
+ _g_free0 (_tmp377_);
}
}
}
- _tmp377_ = writer;
- pdf_writer_write_string (_tmp377_, "trailer\n");
_tmp378_ = writer;
- pdf_writer_write_string (_tmp378_, "<<\n");
+ pdf_writer_write_string (_tmp378_, "trailer\n");
_tmp379_ = writer;
+ pdf_writer_write_string (_tmp379_, "<<\n");
_tmp380_ = writer;
- _tmp381_ = _tmp380_->object_offsets;
- _tmp382_ = g_list_length (_tmp381_);
- _tmp383_ = g_strdup_printf ("/Size %zu\n", (gsize) _tmp382_);
- _tmp384_ = _tmp383_;
- pdf_writer_write_string (_tmp379_, _tmp384_);
- _g_free0 (_tmp384_);
- _tmp385_ = writer;
- _tmp386_ = info_number;
- _tmp387_ = g_strdup_printf ("/Info %u 0 R\n", _tmp386_);
- _tmp388_ = _tmp387_;
- pdf_writer_write_string (_tmp385_, _tmp388_);
- _g_free0 (_tmp388_);
- _tmp389_ = writer;
- _tmp390_ = catalog_number;
- _tmp391_ = g_strdup_printf ("/Root %u 0 R\n", _tmp390_);
- _tmp392_ = _tmp391_;
- pdf_writer_write_string (_tmp389_, _tmp392_);
- _g_free0 (_tmp392_);
- _tmp393_ = writer;
- pdf_writer_write_string (_tmp393_, ">>\n");
+ _tmp381_ = writer;
+ _tmp382_ = _tmp381_->object_offsets;
+ _tmp383_ = g_list_length (_tmp382_);
+ _tmp384_ = g_strdup_printf ("/Size %zu\n", (gsize) _tmp383_);
+ _tmp385_ = _tmp384_;
+ pdf_writer_write_string (_tmp380_, _tmp385_);
+ _g_free0 (_tmp385_);
+ _tmp386_ = writer;
+ _tmp387_ = info_number;
+ _tmp388_ = g_strdup_printf ("/Info %u 0 R\n", _tmp387_);
+ _tmp389_ = _tmp388_;
+ pdf_writer_write_string (_tmp386_, _tmp389_);
+ _g_free0 (_tmp389_);
+ _tmp390_ = writer;
+ _tmp391_ = catalog_number;
+ _tmp392_ = g_strdup_printf ("/Root %u 0 R\n", _tmp391_);
+ _tmp393_ = _tmp392_;
+ pdf_writer_write_string (_tmp390_, _tmp393_);
+ _g_free0 (_tmp393_);
_tmp394_ = writer;
- pdf_writer_write_string (_tmp394_, "startxref\n");
+ pdf_writer_write_string (_tmp394_, ">>\n");
_tmp395_ = writer;
- _tmp396_ = xref_offset;
- _tmp397_ = g_strdup_printf ("%zu\n", _tmp396_);
- _tmp398_ = _tmp397_;
- pdf_writer_write_string (_tmp395_, _tmp398_);
- _g_free0 (_tmp398_);
- _tmp399_ = writer;
- pdf_writer_write_string (_tmp399_, "%%EOF\n");
+ pdf_writer_write_string (_tmp395_, "startxref\n");
+ _tmp396_ = writer;
+ _tmp397_ = xref_offset;
+ _tmp398_ = g_strdup_printf ("%zu\n", _tmp397_);
+ _tmp399_ = _tmp398_;
+ pdf_writer_write_string (_tmp396_, _tmp399_);
+ _g_free0 (_tmp399_);
+ _tmp400_ = writer;
+ pdf_writer_write_string (_tmp400_, "%%EOF\n");
_pdf_writer_unref0 (writer);
_g_object_unref0 (stream);
}
void book_save (Book* self, const gchar* type, GFile* file, GError** error) {
- GCompareFunc _tmp0_;
+ const gchar* _tmp0_;
const gchar* _tmp1_;
- gint _tmp2_ = 0;
+ GQuark _tmp3_ = 0U;
+ static GQuark _tmp2_label0 = 0;
+ static GQuark _tmp2_label1 = 0;
+ static GQuark _tmp2_label2 = 0;
+ static GQuark _tmp2_label3 = 0;
+ static GQuark _tmp2_label4 = 0;
GError * _inner_error_ = NULL;
g_return_if_fail (self != NULL);
g_return_if_fail (type != NULL);
g_return_if_fail (file != NULL);
- _tmp0_ = g_strcmp0;
- _tmp1_ = type;
- _tmp2_ = _tmp0_ (_tmp1_, "jpeg");
- if (_tmp2_ == 0) {
- GFile* _tmp3_;
- _tmp3_ = file;
- book_save_multi_file (self, "jpeg", _tmp3_, &_inner_error_);
- if (_inner_error_ != NULL) {
- g_propagate_error (error, _inner_error_);
- return;
- }
- } else {
- GCompareFunc _tmp4_;
- const gchar* _tmp5_;
- gint _tmp6_ = 0;
- _tmp4_ = g_strcmp0;
- _tmp5_ = type;
- _tmp6_ = _tmp4_ (_tmp5_, "png");
- if (_tmp6_ == 0) {
- GFile* _tmp7_;
- _tmp7_ = file;
- book_save_multi_file (self, "png", _tmp7_, &_inner_error_);
- if (_inner_error_ != NULL) {
- g_propagate_error (error, _inner_error_);
- return;
+ _tmp0_ = type;
+ _tmp1_ = _tmp0_;
+ _tmp3_ = (NULL == _tmp1_) ? 0 : g_quark_from_string (_tmp1_);
+ if (((_tmp3_ == ((0 != _tmp2_label0) ? _tmp2_label0 : (_tmp2_label0 = g_quark_from_static_string ("jpeg")))) || (_tmp3_ == ((0 != _tmp2_label1) ? _tmp2_label1 : (_tmp2_label1 = g_quark_from_static_string ("png"))))) || (_tmp3_ == ((0 != _tmp2_label2) ? _tmp2_label2 : (_tmp2_label2 = g_quark_from_static_string ("tiff"))))) {
+ switch (0) {
+ default:
+ {
+ const gchar* _tmp4_;
+ GFile* _tmp5_;
+ _tmp4_ = type;
+ _tmp5_ = file;
+ book_save_multi_file (self, _tmp4_, _tmp5_, &_inner_error_);
+ if (_inner_error_ != NULL) {
+ g_propagate_error (error, _inner_error_);
+ return;
+ }
+ break;
}
- } else {
- GCompareFunc _tmp8_;
- const gchar* _tmp9_;
- gint _tmp10_ = 0;
- _tmp8_ = g_strcmp0;
- _tmp9_ = type;
- _tmp10_ = _tmp8_ (_tmp9_, "tiff");
- if (_tmp10_ == 0) {
- GFile* _tmp11_;
- _tmp11_ = file;
- book_save_multi_file (self, "tiff", _tmp11_, &_inner_error_);
+ }
+ } else if (_tmp3_ == ((0 != _tmp2_label3) ? _tmp2_label3 : (_tmp2_label3 = g_quark_from_static_string ("ps")))) {
+ switch (0) {
+ default:
+ {
+ GFile* _tmp6_;
+ _tmp6_ = file;
+ book_save_ps (self, _tmp6_, &_inner_error_);
if (_inner_error_ != NULL) {
g_propagate_error (error, _inner_error_);
return;
}
- } else {
- GCompareFunc _tmp12_;
- const gchar* _tmp13_;
- gint _tmp14_ = 0;
- _tmp12_ = g_strcmp0;
- _tmp13_ = type;
- _tmp14_ = _tmp12_ (_tmp13_, "ps");
- if (_tmp14_ == 0) {
- GFile* _tmp15_;
- _tmp15_ = file;
- book_save_ps (self, _tmp15_, &_inner_error_);
- if (_inner_error_ != NULL) {
- g_propagate_error (error, _inner_error_);
- return;
- }
- } else {
- GCompareFunc _tmp16_;
- const gchar* _tmp17_;
- gint _tmp18_ = 0;
- _tmp16_ = g_strcmp0;
- _tmp17_ = type;
- _tmp18_ = _tmp16_ (_tmp17_, "pdf");
- if (_tmp18_ == 0) {
- GFile* _tmp19_;
- _tmp19_ = file;
- book_save_pdf (self, _tmp19_, &_inner_error_);
- if (_inner_error_ != NULL) {
- g_propagate_error (error, _inner_error_);
- return;
- }
- }
+ break;
+ }
+ }
+ } else if (_tmp3_ == ((0 != _tmp2_label4) ? _tmp2_label4 : (_tmp2_label4 = g_quark_from_static_string ("pdf")))) {
+ switch (0) {
+ default:
+ {
+ GFile* _tmp7_;
+ _tmp7_ = file;
+ book_save_pdf (self, _tmp7_, &_inner_error_);
+ if (_inner_error_ != NULL) {
+ g_propagate_error (error, _inner_error_);
+ return;
}
+ break;
}
}
}
@@ -2683,6 +2696,7 @@ static void book_class_init (BookClass * klass) {
g_signal_new ("reordered", TYPE_BOOK, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
g_signal_new ("cleared", TYPE_BOOK, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
g_signal_new ("needs_saving_changed", TYPE_BOOK, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+ g_signal_new ("saving", TYPE_BOOK, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
}
@@ -2783,7 +2797,7 @@ void pdf_writer_write (PDFWriter* self, guint8* data, int data_length1) {
_inner_error_ = NULL;
_tmp2_ = e;
_tmp3_ = _tmp2_->message;
- g_warning ("book.vala:538: Error writing PDF: %s", _tmp3_);
+ g_warning ("book.vala:547: Error writing PDF: %s", _tmp3_);
_g_error_free0 (e);
}
__finally0:
@@ -3090,7 +3104,7 @@ static cairo_status_t ps_writer_write_cairo_data (PsWriter* self, guint8* data,
_inner_error_ = NULL;
_tmp2_ = e;
_tmp3_ = _tmp2_->message;
- g_warning ("book.vala:574: Error writing data: %s", _tmp3_);
+ g_warning ("book.vala:583: Error writing data: %s", _tmp3_);
result = CAIRO_STATUS_WRITE_ERROR;
_g_error_free0 (e);
return result;
diff --git a/src/book.vala b/src/book.vala
index 76a1901..15e79c6 100644
--- a/src/book.vala
+++ b/src/book.vala
@@ -20,6 +20,7 @@ public class Book
public signal void reordered ();
public signal void cleared ();
public signal void needs_saving_changed ();
+ public signal void saving (int i);
public Book ()
{
@@ -103,11 +104,11 @@ public class Book
private void save_multi_file (string type, File file) throws Error
{
- int i = 0;
- foreach (var page in pages)
+ for (var i = 0; i < get_n_pages (); i++)
{
+ var page = get_page (i);
page.save (type, make_indexed_file (file.get_uri (), i));
- i++;
+ saving (i);
}
}
@@ -126,14 +127,16 @@ public class Book
var writer = new PsWriter (stream);
var surface = writer.surface;
- foreach (var page in pages)
+ for (var i = 0; i < get_n_pages (); i++)
{
+ var page = get_page (i);
var image = page.get_image (true);
var width = image.get_width () * 72.0 / page.get_dpi ();
var height = image.get_height () * 72.0 / page.get_dpi ();
surface.set_size (width, height);
save_ps_pdf_surface (surface, image, page.get_dpi ());
surface.show_page ();
+ saving (i);
}
}
@@ -457,6 +460,8 @@ public class Book
writer.write_string ("\n");
writer.write_string ("endstream\n");
writer.write_string ("endobj\n");
+
+ saving (i);
}
/* Info */
@@ -490,16 +495,20 @@ public class Book
public void save (string type, File file) throws Error
{
- if (strcmp (type, "jpeg") == 0)
- save_multi_file ("jpeg", file);
- else if (strcmp (type, "png") == 0)
- save_multi_file ("png", file);
- else if (strcmp (type, "tiff") == 0)
- save_multi_file ("tiff", file);
- else if (strcmp (type, "ps") == 0)
+ switch (type)
+ {
+ case "jpeg":
+ case "png":
+ case "tiff":
+ save_multi_file (type, file);
+ break;
+ case "ps":
save_ps (file);
- else if (strcmp (type, "pdf") == 0)
+ break;
+ case "pdf":
save_pdf (file);
+ break;
+ }
}
public void set_needs_saving (bool needs_saving)
diff --git a/src/page-view.c b/src/page-view.c
index 9f18c73..517b383 100644
--- a/src/page-view.c
+++ b/src/page-view.c
@@ -1,4 +1,4 @@
-/* page-view.c generated by valac 0.16.0, the Vala compiler
+/* page-view.c generated by valac 0.16.1, the Vala compiler
* generated from page-view.vala, do not modify */
/*
diff --git a/src/page.c b/src/page.c
index 3d56125..a6d0673 100644
--- a/src/page.c
+++ b/src/page.c
@@ -1,4 +1,4 @@
-/* page.c generated by valac 0.16.0, the Vala compiler
+/* page.c generated by valac 0.16.1, the Vala compiler
* generated from page.vala, do not modify */
/*
diff --git a/src/scanner.c b/src/scanner.c
index e6d731a..e80ae99 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -1,4 +1,4 @@
-/* scanner.c generated by valac 0.16.0, the Vala compiler
+/* scanner.c generated by valac 0.16.1, the Vala compiler
* generated from scanner.vala, do not modify */
/*
diff --git a/src/simple-scan.c b/src/simple-scan.c
index fb8b8f5..4ead7e5 100644
--- a/src/simple-scan.c
+++ b/src/simple-scan.c
@@ -1,4 +1,4 @@
-/* simple-scan.c generated by valac 0.16.0, the Vala compiler
+/* simple-scan.c generated by valac 0.16.1, the Vala compiler
* generated from simple-scan.vala, do not modify */
/*
@@ -14,10 +14,12 @@
#include <glib.h>
#include <glib-object.h>
+#include <gtk/gtk.h>
#include <gudev/gudev.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include <gio/gio.h>
#include "colord.h"
#include <float.h>
#include <math.h>
@@ -25,23 +27,20 @@
#include <glib/gi18n-lib.h>
#include <glib/gstdio.h>
#include <unistd.h>
-#include <gio/gio.h>
-#include <gtk/gtk.h>
#include <locale.h>
#include "config.h"
-#include <gobject/gvaluecollector.h>
-#define TYPE_APPLICATION (application_get_type ())
-#define APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_APPLICATION, Application))
-#define APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_APPLICATION, ApplicationClass))
-#define IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_APPLICATION))
-#define IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_APPLICATION))
-#define APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_APPLICATION, ApplicationClass))
+#define TYPE_SIMPLE_SCAN (simple_scan_get_type ())
+#define SIMPLE_SCAN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SIMPLE_SCAN, SimpleScan))
+#define SIMPLE_SCAN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SIMPLE_SCAN, SimpleScanClass))
+#define IS_SIMPLE_SCAN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SIMPLE_SCAN))
+#define IS_SIMPLE_SCAN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SIMPLE_SCAN))
+#define SIMPLE_SCAN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SIMPLE_SCAN, SimpleScanClass))
-typedef struct _Application Application;
-typedef struct _ApplicationClass ApplicationClass;
-typedef struct _ApplicationPrivate ApplicationPrivate;
+typedef struct _SimpleScan SimpleScan;
+typedef struct _SimpleScanClass SimpleScanClass;
+typedef struct _SimpleScanPrivate SimpleScanPrivate;
#define TYPE_SCAN_DEVICE (scan_device_get_type ())
#define SCAN_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SCAN_DEVICE, ScanDevice))
@@ -53,15 +52,15 @@ typedef struct _ApplicationPrivate ApplicationPrivate;
typedef struct _ScanDevice ScanDevice;
typedef struct _ScanDeviceClass ScanDeviceClass;
-#define TYPE_SIMPLE_SCAN (simple_scan_get_type ())
-#define SIMPLE_SCAN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SIMPLE_SCAN, SimpleScan))
-#define SIMPLE_SCAN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SIMPLE_SCAN, SimpleScanClass))
-#define IS_SIMPLE_SCAN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SIMPLE_SCAN))
-#define IS_SIMPLE_SCAN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SIMPLE_SCAN))
-#define SIMPLE_SCAN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SIMPLE_SCAN, SimpleScanClass))
+#define TYPE_USER_INTERFACE (user_interface_get_type ())
+#define USER_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_USER_INTERFACE, UserInterface))
+#define USER_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_USER_INTERFACE, UserInterfaceClass))
+#define IS_USER_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_USER_INTERFACE))
+#define IS_USER_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_USER_INTERFACE))
+#define USER_INTERFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_USER_INTERFACE, UserInterfaceClass))
-typedef struct _SimpleScan SimpleScan;
-typedef struct _SimpleScanClass SimpleScanClass;
+typedef struct _UserInterface UserInterface;
+typedef struct _UserInterfaceClass UserInterfaceClass;
#define TYPE_SCANNER (scanner_get_type ())
#define SCANNER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SCANNER, Scanner))
@@ -84,7 +83,7 @@ typedef struct _Book Book;
typedef struct _BookClass BookClass;
#define _scan_device_unref0(var) ((var == NULL) ? NULL : (var = (scan_device_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
-#define _simple_scan_unref0(var) ((var == NULL) ? NULL : (var = (simple_scan_unref (var), NULL)))
+#define _user_interface_unref0(var) ((var == NULL) ? NULL : (var = (user_interface_unref (var), NULL)))
#define _scanner_unref0(var) ((var == NULL) ? NULL : (var = (scanner_unref (var), NULL)))
#define _book_unref0(var) ((var == NULL) ? NULL : (var = (book_unref (var), NULL)))
@@ -147,25 +146,21 @@ typedef struct _ScanOptionsPrivate ScanOptionsPrivate;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_option_context_free0(var) ((var == NULL) ? NULL : (var = (g_option_context_free (var), NULL)))
#define _g_timer_destroy0(var) ((var == NULL) ? NULL : (var = (g_timer_destroy (var), NULL)))
-#define _application_unref0(var) ((var == NULL) ? NULL : (var = (application_unref (var), NULL)))
-typedef struct _ParamSpecApplication ParamSpecApplication;
-struct _Application {
- GTypeInstance parent_instance;
- volatile int ref_count;
- ApplicationPrivate * priv;
+struct _SimpleScan {
+ GtkApplication parent_instance;
+ SimpleScanPrivate * priv;
};
-struct _ApplicationClass {
- GTypeClass parent_class;
- void (*finalize) (Application *self);
+struct _SimpleScanClass {
+ GtkApplicationClass parent_class;
};
-struct _ApplicationPrivate {
+struct _SimpleScanPrivate {
ScanDevice* default_device;
gboolean have_devices;
GUdevClient* udev_client;
- SimpleScan* ui;
+ UserInterface* ui;
Scanner* scanner;
Book* book;
};
@@ -238,30 +233,20 @@ struct _ScanOptionsClass {
void (*finalize) (ScanOptions *self);
};
-struct _ParamSpecApplication {
- GParamSpec parent_instance;
-};
+static gpointer simple_scan_parent_class = NULL;
+static gboolean simple_scan_show_version;
+static gboolean simple_scan_show_version = FALSE;
+static gboolean simple_scan_debug_enabled;
+static gboolean simple_scan_debug_enabled = FALSE;
+static gchar* simple_scan_fix_pdf_filename;
+static gchar* simple_scan_fix_pdf_filename = NULL;
+static GTimer* simple_scan_log_timer;
+static GTimer* simple_scan_log_timer = NULL;
+static FILE* simple_scan_log_file;
+static FILE* simple_scan_log_file = NULL;
-static gpointer application_parent_class = NULL;
-static gboolean application_show_version;
-static gboolean application_show_version = FALSE;
-static gboolean application_debug_enabled;
-static gboolean application_debug_enabled = FALSE;
-static gchar* application_fix_pdf_filename;
-static gchar* application_fix_pdf_filename = NULL;
-static GTimer* application_log_timer;
-static GTimer* application_log_timer = NULL;
-static FILE* application_log_file;
-static FILE* application_log_file = NULL;
-
-gpointer application_ref (gpointer instance);
-void application_unref (gpointer instance);
-GParamSpec* param_spec_application (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-void value_set_application (GValue* value, gpointer v_object);
-void value_take_application (GValue* value, gpointer v_object);
-gpointer value_get_application (const GValue* value);
-GType application_get_type (void) G_GNUC_CONST;
+GType simple_scan_get_type (void) G_GNUC_CONST;
gpointer scan_device_ref (gpointer instance);
void scan_device_unref (gpointer instance);
GParamSpec* param_spec_scan_device (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
@@ -269,13 +254,13 @@ void value_set_scan_device (GValue* value, gpointer v_object);
void value_take_scan_device (GValue* value, gpointer v_object);
gpointer value_get_scan_device (const GValue* value);
GType scan_device_get_type (void) G_GNUC_CONST;
-gpointer simple_scan_ref (gpointer instance);
-void simple_scan_unref (gpointer instance);
-GParamSpec* param_spec_simple_scan (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-void value_set_simple_scan (GValue* value, gpointer v_object);
-void value_take_simple_scan (GValue* value, gpointer v_object);
-gpointer value_get_simple_scan (const GValue* value);
-GType simple_scan_get_type (void) G_GNUC_CONST;
+gpointer user_interface_ref (gpointer instance);
+void user_interface_unref (gpointer instance);
+GParamSpec* param_spec_user_interface (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
+void value_set_user_interface (GValue* value, gpointer v_object);
+void value_take_user_interface (GValue* value, gpointer v_object);
+gpointer value_get_user_interface (const GValue* value);
+GType user_interface_get_type (void) G_GNUC_CONST;
gpointer scanner_ref (gpointer instance);
void scanner_unref (gpointer instance);
GParamSpec* param_spec_scanner (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
@@ -290,15 +275,16 @@ 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 APPLICATION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_APPLICATION, ApplicationPrivate))
+#define SIMPLE_SCAN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_SIMPLE_SCAN, SimpleScanPrivate))
enum {
- APPLICATION_DUMMY_PROPERTY
+ SIMPLE_SCAN_DUMMY_PROPERTY
};
-Application* application_new (ScanDevice* device);
-Application* application_construct (GType object_type, ScanDevice* device);
-SimpleScan* simple_scan_new (void);
-SimpleScan* simple_scan_construct (GType object_type);
-Book* simple_scan_get_book (SimpleScan* self);
+SimpleScan* simple_scan_new (ScanDevice* device);
+SimpleScan* simple_scan_construct (GType object_type, ScanDevice* device);
+static void simple_scan_real_startup (GApplication* base);
+UserInterface* user_interface_new (void);
+UserInterface* user_interface_construct (GType object_type);
+Book* user_interface_get_book (UserInterface* self);
gpointer scan_options_ref (gpointer instance);
void scan_options_unref (gpointer instance);
GParamSpec* param_spec_scan_options (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
@@ -306,21 +292,19 @@ void value_set_scan_options (GValue* value, gpointer v_object);
void value_take_scan_options (GValue* value, gpointer v_object);
gpointer value_get_scan_options (const GValue* value);
GType scan_options_get_type (void) G_GNUC_CONST;
-static void application_scan_cb (Application* self, SimpleScan* ui, const gchar* device, ScanOptions* options);
-static void _application_scan_cb_simple_scan_start_scan (SimpleScan* _sender, const gchar* device, ScanOptions* options, gpointer self);
-static void application_cancel_cb (Application* self, SimpleScan* ui);
-static void _application_cancel_cb_simple_scan_stop_scan (SimpleScan* _sender, gpointer self);
-static void application_email_cb (Application* self, SimpleScan* ui, const gchar* profile);
-static void _application_email_cb_simple_scan_email (SimpleScan* _sender, const gchar* profile, gpointer self);
-static void application_quit_cb (Application* self, SimpleScan* ui);
-static void _application_quit_cb_simple_scan_quit (SimpleScan* _sender, gpointer self);
+static void simple_scan_scan_cb (SimpleScan* self, UserInterface* ui, const gchar* device, ScanOptions* options);
+static void _simple_scan_scan_cb_user_interface_start_scan (UserInterface* _sender, const gchar* device, ScanOptions* options, gpointer self);
+static void simple_scan_cancel_cb (SimpleScan* self, UserInterface* ui);
+static void _simple_scan_cancel_cb_user_interface_stop_scan (UserInterface* _sender, gpointer self);
+static void simple_scan_email_cb (SimpleScan* self, UserInterface* ui, const gchar* profile);
+static void _simple_scan_email_cb_user_interface_email (UserInterface* _sender, const gchar* profile, gpointer self);
Scanner* scanner_get_instance (void);
-static void application_update_scan_devices_cb (Application* self, Scanner* scanner, GList* devices);
-static void _application_update_scan_devices_cb_scanner_update_devices (Scanner* _sender, GList* devices, gpointer self);
-static void application_authorize_cb (Application* self, Scanner* scanner, const gchar* resource);
-static void _application_authorize_cb_scanner_request_authorization (Scanner* _sender, const gchar* resource, gpointer self);
-static void application_scanner_new_page_cb (Application* self, Scanner* scanner);
-static void _application_scanner_new_page_cb_scanner_expect_page (Scanner* _sender, gpointer self);
+static void simple_scan_update_scan_devices_cb (SimpleScan* self, Scanner* scanner, GList* devices);
+static void _simple_scan_update_scan_devices_cb_scanner_update_devices (Scanner* _sender, GList* devices, gpointer self);
+static void simple_scan_authorize_cb (SimpleScan* self, Scanner* scanner, const gchar* resource);
+static void _simple_scan_authorize_cb_scanner_request_authorization (Scanner* _sender, const gchar* resource, gpointer self);
+static void simple_scan_scanner_new_page_cb (SimpleScan* self, Scanner* scanner);
+static void _simple_scan_scanner_new_page_cb_scanner_expect_page (Scanner* _sender, gpointer self);
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);
@@ -328,8 +312,8 @@ 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;
-static void application_scanner_page_info_cb (Application* self, Scanner* scanner, ScanPageInfo* info);
-static void _application_scanner_page_info_cb_scanner_got_page_info (Scanner* _sender, ScanPageInfo* info, gpointer self);
+static void simple_scan_scanner_page_info_cb (SimpleScan* self, Scanner* scanner, ScanPageInfo* info);
+static void _simple_scan_scanner_page_info_cb_scanner_got_page_info (Scanner* _sender, ScanPageInfo* info, gpointer self);
gpointer scan_line_ref (gpointer instance);
void scan_line_unref (gpointer instance);
GParamSpec* param_spec_scan_line (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
@@ -337,26 +321,28 @@ void value_set_scan_line (GValue* value, gpointer v_object);
void value_take_scan_line (GValue* value, gpointer v_object);
gpointer value_get_scan_line (const GValue* value);
GType scan_line_get_type (void) G_GNUC_CONST;
-static void application_scanner_line_cb (Application* self, Scanner* scanner, ScanLine* line);
-static void _application_scanner_line_cb_scanner_got_line (Scanner* _sender, ScanLine* line, gpointer self);
-static void application_scanner_page_done_cb (Application* self, Scanner* scanner);
-static void _application_scanner_page_done_cb_scanner_page_done (Scanner* _sender, gpointer self);
-static void application_scanner_document_done_cb (Application* self, Scanner* scanner);
-static void _application_scanner_document_done_cb_scanner_document_done (Scanner* _sender, gpointer self);
-static void application_scanner_failed_cb (Application* self, Scanner* scanner, gint error_code, const gchar* error_string);
-static void _application_scanner_failed_cb_scanner_scan_failed (Scanner* _sender, gint error_code, const gchar* error_string, gpointer self);
-static void application_scanner_scanning_changed_cb (Application* self, Scanner* scanner);
-static void _application_scanner_scanning_changed_cb_scanner_scanning_changed (Scanner* _sender, gpointer self);
-static void application_on_uevent (Application* self, GUdevClient* client, const gchar* action, GUdevDevice* device);
-static void _application_on_uevent_g_udev_client_uevent (GUdevClient* _sender, const gchar* action, GUdevDevice* device, gpointer self);
-void simple_scan_set_scan_devices (SimpleScan* self, GList* devices);
-void simple_scan_set_selected_device (SimpleScan* self, const gchar* device);
+static void simple_scan_scanner_line_cb (SimpleScan* self, Scanner* scanner, ScanLine* line);
+static void _simple_scan_scanner_line_cb_scanner_got_line (Scanner* _sender, ScanLine* line, gpointer self);
+static void simple_scan_scanner_page_done_cb (SimpleScan* self, Scanner* scanner);
+static void _simple_scan_scanner_page_done_cb_scanner_page_done (Scanner* _sender, gpointer self);
+static void simple_scan_scanner_document_done_cb (SimpleScan* self, Scanner* scanner);
+static void _simple_scan_scanner_document_done_cb_scanner_document_done (Scanner* _sender, gpointer self);
+static void simple_scan_scanner_failed_cb (SimpleScan* self, Scanner* scanner, gint error_code, const gchar* error_string);
+static void _simple_scan_scanner_failed_cb_scanner_scan_failed (Scanner* _sender, gint error_code, const gchar* error_string, gpointer self);
+static void simple_scan_scanner_scanning_changed_cb (SimpleScan* self, Scanner* scanner);
+static void _simple_scan_scanner_scanning_changed_cb_scanner_scanning_changed (Scanner* _sender, gpointer self);
+static void simple_scan_on_uevent (SimpleScan* self, GUdevClient* client, const gchar* action, GUdevDevice* device);
+static void _simple_scan_on_uevent_g_udev_client_uevent (GUdevClient* _sender, const gchar* action, GUdevDevice* device, gpointer self);
+void user_interface_set_scan_devices (UserInterface* self, GList* devices);
+void user_interface_set_selected_device (UserInterface* self, const gchar* device);
static void _scan_device_unref0_ (gpointer var);
static void _g_list_free__scan_device_unref0_ (GList* self);
-void application_start (Application* self);
-void simple_scan_start (SimpleScan* self);
+static void simple_scan_real_activate (GApplication* base);
+void user_interface_start (UserInterface* self);
void scanner_start (Scanner* self);
-void simple_scan_authorize (SimpleScan* self, const gchar* resource, gchar** username, gchar** password);
+static void simple_scan_real_shutdown (GApplication* base);
+void scanner_free (Scanner* self);
+void user_interface_authorize (UserInterface* self, const gchar* resource, gchar** username, gchar** password);
void scanner_authorize (Scanner* self, const gchar* username, const gchar* password);
gpointer page_ref (gpointer instance);
void page_unref (gpointer instance);
@@ -365,10 +351,10 @@ 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;
-static Page* application_append_page (Application* self);
+static Page* simple_scan_append_page (SimpleScan* self);
Page* book_get_page (Book* self, gint page_number);
gboolean page_has_data (Page* self);
-void simple_scan_set_selected_page (SimpleScan* self, Page* page);
+void user_interface_set_selected_page (UserInterface* self, Page* page);
void page_start (Page* self);
GType scan_direction_get_type (void) G_GNUC_CONST;
ScanDirection page_get_scan_direction (Page* self);
@@ -382,111 +368,125 @@ Page* book_append_page (Book* self, gint width, gint height, gint dpi, ScanDirec
void page_set_named_crop (Page* self, const gchar* name);
void page_set_custom_crop (Page* self, gint width, gint height);
void page_move_crop (Page* self, gint x, gint y);
-static gchar* application_get_profile_for_device (Application* self, const gchar* device_name);
+static gchar* simple_scan_get_profile_for_device (SimpleScan* self, const gchar* device_name);
void page_set_page_info (Page* self, ScanPageInfo* info);
void page_set_color_profile (Page* self, const gchar* color_profile);
guint book_get_n_pages (Book* self);
void page_parse_scan_line (Page* self, ScanLine* line);
void page_finish (Page* self);
-static void application_remove_empty_page (Application* self);
+static void simple_scan_remove_empty_page (SimpleScan* self);
void book_delete_page (Book* self, Page* page);
-void simple_scan_show_error (SimpleScan* self, const gchar* error_title, const gchar* error_text, gboolean change_scanner_hint);
-void simple_scan_set_scanning (SimpleScan* self, gboolean scanning);
+void user_interface_show_error (UserInterface* self, const gchar* error_title, const gchar* error_text, gboolean change_scanner_hint);
+void user_interface_set_scanning (UserInterface* self, gboolean scanning);
gboolean scanner_is_scanning (Scanner* self);
GType scan_mode_get_type (void) G_GNUC_CONST;
GType scan_type_get_type (void) G_GNUC_CONST;
-void simple_scan_set_default_file_name (SimpleScan* self, const gchar* default_file_name);
+void user_interface_set_default_file_name (UserInterface* self, const gchar* default_file_name);
void scanner_scan (Scanner* self, const gchar* device, ScanOptions* options);
void scanner_cancel (Scanner* self);
-static gchar* application_get_temporary_filename (Application* self, const gchar* prefix, const gchar* extension);
+static gchar* simple_scan_get_temporary_filename (SimpleScan* self, const gchar* prefix, const gchar* extension);
+void user_interface_show_progress_dialog (UserInterface* self);
void book_save (Book* self, const gchar* type, GFile* file, GError** error);
+void user_interface_hide_progress_dialog (UserInterface* self);
void page_save (Page* self, const gchar* type, GFile* file, GError** error);
-void scanner_free (Scanner* self);
-static void application_log_cb (const gchar* log_domain, GLogLevelFlags log_level, const gchar* message);
+static void simple_scan_log_cb (const gchar* log_domain, GLogLevelFlags log_level, const gchar* message);
void scanner_redetect (Scanner* self);
-static void application_fix_pdf (const gchar* filename, GError** error);
-gint application_main (gchar** args, int args_length1);
+static void simple_scan_fix_pdf (const gchar* filename, GError** error);
+gint simple_scan_main (gchar** args, int args_length1);
ScanDevice* scan_device_new (void);
ScanDevice* scan_device_construct (GType object_type);
-static void _application_log_cb_glog_func (const gchar* log_domain, GLogLevelFlags log_levels, const gchar* message, gpointer self);
-static void application_finalize (Application* obj);
+static void _simple_scan_log_cb_glog_func (const gchar* log_domain, GLogLevelFlags log_levels, const gchar* message, gpointer self);
+static void simple_scan_finalize (GObject* 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);
-const GOptionEntry APPLICATION_options[4] = {{"version", 'v', 0, G_OPTION_ARG_NONE, &application_show_version, "Show release version", NULL}, {"debug", 'd', 0, G_OPTION_ARG_NONE, &application_debug_enabled, "Print debugging messages", NULL}, {"fix-pdf", (gchar) 0, 0, G_OPTION_ARG_STRING, &application_fix_pdf_filename, "Fix PDF files generated with older versions of Simple Scan", "FILENAME..."}, {NULL}};
+const GOptionEntry SIMPLE_SCAN_options[4] = {{"version", 'v', 0, G_OPTION_ARG_NONE, &simple_scan_show_version, "Show release version", NULL}, {"debug", 'd', 0, G_OPTION_ARG_NONE, &simple_scan_debug_enabled, "Print debugging messages", NULL}, {"fix-pdf", (gchar) 0, 0, G_OPTION_ARG_STRING, &simple_scan_fix_pdf_filename, "Fix PDF files generated with older versions of Simple Scan", "FILENAME..."}, {NULL}};
static gpointer _scan_device_ref0 (gpointer self) {
return self ? scan_device_ref (self) : NULL;
}
-static void _application_scan_cb_simple_scan_start_scan (SimpleScan* _sender, const gchar* device, ScanOptions* options, gpointer self) {
- application_scan_cb (self, _sender, device, options);
+SimpleScan* simple_scan_construct (GType object_type, ScanDevice* device) {
+ SimpleScan * self = NULL;
+ ScanDevice* _tmp0_;
+ ScanDevice* _tmp1_;
+ self = (SimpleScan*) g_object_new (object_type, NULL);
+ _tmp0_ = device;
+ _tmp1_ = _scan_device_ref0 (_tmp0_);
+ _scan_device_unref0 (self->priv->default_device);
+ self->priv->default_device = _tmp1_;
+ return self;
+}
+
+
+SimpleScan* simple_scan_new (ScanDevice* device) {
+ return simple_scan_construct (TYPE_SIMPLE_SCAN, device);
}
-static void _application_cancel_cb_simple_scan_stop_scan (SimpleScan* _sender, gpointer self) {
- application_cancel_cb (self, _sender);
+static void _simple_scan_scan_cb_user_interface_start_scan (UserInterface* _sender, const gchar* device, ScanOptions* options, gpointer self) {
+ simple_scan_scan_cb (self, _sender, device, options);
}
-static void _application_email_cb_simple_scan_email (SimpleScan* _sender, const gchar* profile, gpointer self) {
- application_email_cb (self, _sender, profile);
+static void _simple_scan_cancel_cb_user_interface_stop_scan (UserInterface* _sender, gpointer self) {
+ simple_scan_cancel_cb (self, _sender);
}
-static void _application_quit_cb_simple_scan_quit (SimpleScan* _sender, gpointer self) {
- application_quit_cb (self, _sender);
+static void _simple_scan_email_cb_user_interface_email (UserInterface* _sender, const gchar* profile, gpointer self) {
+ simple_scan_email_cb (self, _sender, profile);
}
-static void _application_update_scan_devices_cb_scanner_update_devices (Scanner* _sender, GList* devices, gpointer self) {
- application_update_scan_devices_cb (self, _sender, devices);
+static void _simple_scan_update_scan_devices_cb_scanner_update_devices (Scanner* _sender, GList* devices, gpointer self) {
+ simple_scan_update_scan_devices_cb (self, _sender, devices);
}
-static void _application_authorize_cb_scanner_request_authorization (Scanner* _sender, const gchar* resource, gpointer self) {
- application_authorize_cb (self, _sender, resource);
+static void _simple_scan_authorize_cb_scanner_request_authorization (Scanner* _sender, const gchar* resource, gpointer self) {
+ simple_scan_authorize_cb (self, _sender, resource);
}
-static void _application_scanner_new_page_cb_scanner_expect_page (Scanner* _sender, gpointer self) {
- application_scanner_new_page_cb (self, _sender);
+static void _simple_scan_scanner_new_page_cb_scanner_expect_page (Scanner* _sender, gpointer self) {
+ simple_scan_scanner_new_page_cb (self, _sender);
}
-static void _application_scanner_page_info_cb_scanner_got_page_info (Scanner* _sender, ScanPageInfo* info, gpointer self) {
- application_scanner_page_info_cb (self, _sender, info);
+static void _simple_scan_scanner_page_info_cb_scanner_got_page_info (Scanner* _sender, ScanPageInfo* info, gpointer self) {
+ simple_scan_scanner_page_info_cb (self, _sender, info);
}
-static void _application_scanner_line_cb_scanner_got_line (Scanner* _sender, ScanLine* line, gpointer self) {
- application_scanner_line_cb (self, _sender, line);
+static void _simple_scan_scanner_line_cb_scanner_got_line (Scanner* _sender, ScanLine* line, gpointer self) {
+ simple_scan_scanner_line_cb (self, _sender, line);
}
-static void _application_scanner_page_done_cb_scanner_page_done (Scanner* _sender, gpointer self) {
- application_scanner_page_done_cb (self, _sender);
+static void _simple_scan_scanner_page_done_cb_scanner_page_done (Scanner* _sender, gpointer self) {
+ simple_scan_scanner_page_done_cb (self, _sender);
}
-static void _application_scanner_document_done_cb_scanner_document_done (Scanner* _sender, gpointer self) {
- application_scanner_document_done_cb (self, _sender);
+static void _simple_scan_scanner_document_done_cb_scanner_document_done (Scanner* _sender, gpointer self) {
+ simple_scan_scanner_document_done_cb (self, _sender);
}
-static void _application_scanner_failed_cb_scanner_scan_failed (Scanner* _sender, gint error_code, const gchar* error_string, gpointer self) {
- application_scanner_failed_cb (self, _sender, error_code, error_string);
+static void _simple_scan_scanner_failed_cb_scanner_scan_failed (Scanner* _sender, gint error_code, const gchar* error_string, gpointer self) {
+ simple_scan_scanner_failed_cb (self, _sender, error_code, error_string);
}
-static void _application_scanner_scanning_changed_cb_scanner_scanning_changed (Scanner* _sender, gpointer self) {
- application_scanner_scanning_changed_cb (self, _sender);
+static void _simple_scan_scanner_scanning_changed_cb_scanner_scanning_changed (Scanner* _sender, gpointer self) {
+ simple_scan_scanner_scanning_changed_cb (self, _sender);
}
-static void _application_on_uevent_g_udev_client_uevent (GUdevClient* _sender, const gchar* action, GUdevDevice* device, gpointer self) {
- application_on_uevent (self, _sender, action, device);
+static void _simple_scan_on_uevent_g_udev_client_uevent (GUdevClient* _sender, const gchar* action, GUdevDevice* device, gpointer self) {
+ simple_scan_on_uevent (self, _sender, action, device);
}
@@ -501,144 +501,148 @@ static void _g_list_free__scan_device_unref0_ (GList* self) {
}
-Application* application_construct (GType object_type, ScanDevice* device) {
- Application* self = NULL;
- ScanDevice* _tmp0_;
- ScanDevice* _tmp1_;
- SimpleScan* _tmp2_;
- SimpleScan* _tmp3_;
- Book* _tmp4_ = NULL;
- SimpleScan* _tmp5_;
- SimpleScan* _tmp6_;
- SimpleScan* _tmp7_;
- SimpleScan* _tmp8_;
- Scanner* _tmp9_ = NULL;
+static void simple_scan_real_startup (GApplication* base) {
+ SimpleScan * self;
+ UserInterface* _tmp0_;
+ UserInterface* _tmp1_;
+ Book* _tmp2_ = NULL;
+ UserInterface* _tmp3_;
+ UserInterface* _tmp4_;
+ UserInterface* _tmp5_;
+ Scanner* _tmp6_ = NULL;
+ Scanner* _tmp7_;
+ Scanner* _tmp8_;
+ Scanner* _tmp9_;
Scanner* _tmp10_;
Scanner* _tmp11_;
Scanner* _tmp12_;
Scanner* _tmp13_;
Scanner* _tmp14_;
Scanner* _tmp15_;
- Scanner* _tmp16_;
- Scanner* _tmp17_;
- Scanner* _tmp18_;
- gchar* _tmp19_;
- gchar** _tmp20_ = NULL;
+ gchar* _tmp16_;
+ gchar** _tmp17_ = NULL;
gchar** subsystems;
gint subsystems_length1;
gint _subsystems_size_;
- gchar** _tmp21_;
- gint _tmp21__length1;
- GUdevClient* _tmp22_;
- GUdevClient* _tmp23_;
- ScanDevice* _tmp24_;
- self = (Application*) g_type_create_instance (object_type);
- _tmp0_ = device;
- _tmp1_ = _scan_device_ref0 (_tmp0_);
- _scan_device_unref0 (self->priv->default_device);
- self->priv->default_device = _tmp1_;
- _tmp2_ = simple_scan_new ();
- _simple_scan_unref0 (self->priv->ui);
- self->priv->ui = _tmp2_;
- _tmp3_ = self->priv->ui;
- _tmp4_ = simple_scan_get_book (_tmp3_);
+ gchar** _tmp18_;
+ gint _tmp18__length1;
+ GUdevClient* _tmp19_;
+ GUdevClient* _tmp20_;
+ ScanDevice* _tmp21_;
+ self = (SimpleScan*) base;
+ G_APPLICATION_CLASS (simple_scan_parent_class)->startup ((GApplication*) GTK_APPLICATION (self));
+ _tmp0_ = user_interface_new ();
+ _user_interface_unref0 (self->priv->ui);
+ self->priv->ui = _tmp0_;
+ _tmp1_ = self->priv->ui;
+ _tmp2_ = user_interface_get_book (_tmp1_);
_book_unref0 (self->priv->book);
- self->priv->book = _tmp4_;
+ self->priv->book = _tmp2_;
+ _tmp3_ = self->priv->ui;
+ g_signal_connect_object (_tmp3_, "start-scan", (GCallback) _simple_scan_scan_cb_user_interface_start_scan, self, 0);
+ _tmp4_ = self->priv->ui;
+ g_signal_connect_object (_tmp4_, "stop-scan", (GCallback) _simple_scan_cancel_cb_user_interface_stop_scan, self, 0);
_tmp5_ = self->priv->ui;
- g_signal_connect (_tmp5_, "start-scan", (GCallback) _application_scan_cb_simple_scan_start_scan, self);
- _tmp6_ = self->priv->ui;
- g_signal_connect (_tmp6_, "stop-scan", (GCallback) _application_cancel_cb_simple_scan_stop_scan, self);
- _tmp7_ = self->priv->ui;
- g_signal_connect (_tmp7_, "email", (GCallback) _application_email_cb_simple_scan_email, self);
- _tmp8_ = self->priv->ui;
- g_signal_connect (_tmp8_, "quit", (GCallback) _application_quit_cb_simple_scan_quit, self);
- _tmp9_ = scanner_get_instance ();
+ g_signal_connect_object (_tmp5_, "email", (GCallback) _simple_scan_email_cb_user_interface_email, self, 0);
+ _tmp6_ = scanner_get_instance ();
_scanner_unref0 (self->priv->scanner);
- self->priv->scanner = _tmp9_;
+ self->priv->scanner = _tmp6_;
+ _tmp7_ = self->priv->scanner;
+ g_signal_connect_object (_tmp7_, "update-devices", (GCallback) _simple_scan_update_scan_devices_cb_scanner_update_devices, self, 0);
+ _tmp8_ = self->priv->scanner;
+ g_signal_connect_object (_tmp8_, "request-authorization", (GCallback) _simple_scan_authorize_cb_scanner_request_authorization, self, 0);
+ _tmp9_ = self->priv->scanner;
+ g_signal_connect_object (_tmp9_, "expect-page", (GCallback) _simple_scan_scanner_new_page_cb_scanner_expect_page, self, 0);
_tmp10_ = self->priv->scanner;
- g_signal_connect (_tmp10_, "update-devices", (GCallback) _application_update_scan_devices_cb_scanner_update_devices, self);
+ g_signal_connect_object (_tmp10_, "got-page-info", (GCallback) _simple_scan_scanner_page_info_cb_scanner_got_page_info, self, 0);
_tmp11_ = self->priv->scanner;
- g_signal_connect (_tmp11_, "request-authorization", (GCallback) _application_authorize_cb_scanner_request_authorization, self);
+ g_signal_connect_object (_tmp11_, "got-line", (GCallback) _simple_scan_scanner_line_cb_scanner_got_line, self, 0);
_tmp12_ = self->priv->scanner;
- g_signal_connect (_tmp12_, "expect-page", (GCallback) _application_scanner_new_page_cb_scanner_expect_page, self);
+ g_signal_connect_object (_tmp12_, "page-done", (GCallback) _simple_scan_scanner_page_done_cb_scanner_page_done, self, 0);
_tmp13_ = self->priv->scanner;
- g_signal_connect (_tmp13_, "got-page-info", (GCallback) _application_scanner_page_info_cb_scanner_got_page_info, self);
+ g_signal_connect_object (_tmp13_, "document-done", (GCallback) _simple_scan_scanner_document_done_cb_scanner_document_done, self, 0);
_tmp14_ = self->priv->scanner;
- g_signal_connect (_tmp14_, "got-line", (GCallback) _application_scanner_line_cb_scanner_got_line, self);
+ g_signal_connect_object (_tmp14_, "scan-failed", (GCallback) _simple_scan_scanner_failed_cb_scanner_scan_failed, self, 0);
_tmp15_ = self->priv->scanner;
- g_signal_connect (_tmp15_, "page-done", (GCallback) _application_scanner_page_done_cb_scanner_page_done, self);
- _tmp16_ = self->priv->scanner;
- g_signal_connect (_tmp16_, "document-done", (GCallback) _application_scanner_document_done_cb_scanner_document_done, self);
- _tmp17_ = self->priv->scanner;
- g_signal_connect (_tmp17_, "scan-failed", (GCallback) _application_scanner_failed_cb_scanner_scan_failed, self);
- _tmp18_ = self->priv->scanner;
- g_signal_connect (_tmp18_, "scanning-changed", (GCallback) _application_scanner_scanning_changed_cb_scanner_scanning_changed, self);
- _tmp19_ = g_strdup ("usb");
- _tmp20_ = g_new0 (gchar*, 2 + 1);
- _tmp20_[0] = _tmp19_;
- _tmp20_[1] = NULL;
- subsystems = _tmp20_;
+ g_signal_connect_object (_tmp15_, "scanning-changed", (GCallback) _simple_scan_scanner_scanning_changed_cb_scanner_scanning_changed, self, 0);
+ _tmp16_ = g_strdup ("usb");
+ _tmp17_ = g_new0 (gchar*, 2 + 1);
+ _tmp17_[0] = _tmp16_;
+ _tmp17_[1] = NULL;
+ subsystems = _tmp17_;
subsystems_length1 = 2;
_subsystems_size_ = subsystems_length1;
- _tmp21_ = subsystems;
- _tmp21__length1 = subsystems_length1;
- _tmp22_ = g_udev_client_new (_tmp21_);
+ _tmp18_ = subsystems;
+ _tmp18__length1 = subsystems_length1;
+ _tmp19_ = g_udev_client_new (_tmp18_);
_g_object_unref0 (self->priv->udev_client);
- self->priv->udev_client = _tmp22_;
- _tmp23_ = self->priv->udev_client;
- g_signal_connect (_tmp23_, "uevent", (GCallback) _application_on_uevent_g_udev_client_uevent, self);
- _tmp24_ = self->priv->default_device;
- if (_tmp24_ != NULL) {
+ self->priv->udev_client = _tmp19_;
+ _tmp20_ = self->priv->udev_client;
+ g_signal_connect_object (_tmp20_, "uevent", (GCallback) _simple_scan_on_uevent_g_udev_client_uevent, self, 0);
+ _tmp21_ = self->priv->default_device;
+ if (_tmp21_ != NULL) {
GList* device_list;
- ScanDevice* _tmp25_;
- ScanDevice* _tmp26_;
- SimpleScan* _tmp27_;
- GList* _tmp28_;
- SimpleScan* _tmp29_;
- ScanDevice* _tmp30_;
- const gchar* _tmp31_;
+ ScanDevice* _tmp22_;
+ ScanDevice* _tmp23_;
+ UserInterface* _tmp24_;
+ GList* _tmp25_;
+ UserInterface* _tmp26_;
+ ScanDevice* _tmp27_;
+ const gchar* _tmp28_;
device_list = NULL;
- _tmp25_ = self->priv->default_device;
- _tmp26_ = _scan_device_ref0 (_tmp25_);
- device_list = g_list_append (device_list, _tmp26_);
- _tmp27_ = self->priv->ui;
- _tmp28_ = device_list;
- simple_scan_set_scan_devices (_tmp27_, _tmp28_);
- _tmp29_ = self->priv->ui;
- _tmp30_ = self->priv->default_device;
- _tmp31_ = _tmp30_->name;
- simple_scan_set_selected_device (_tmp29_, _tmp31_);
+ _tmp22_ = self->priv->default_device;
+ _tmp23_ = _scan_device_ref0 (_tmp22_);
+ device_list = g_list_append (device_list, _tmp23_);
+ _tmp24_ = self->priv->ui;
+ _tmp25_ = device_list;
+ user_interface_set_scan_devices (_tmp24_, _tmp25_);
+ _tmp26_ = self->priv->ui;
+ _tmp27_ = self->priv->default_device;
+ _tmp28_ = _tmp27_->name;
+ user_interface_set_selected_device (_tmp26_, _tmp28_);
__g_list_free__scan_device_unref0_0 (device_list);
}
subsystems = (_vala_array_free (subsystems, subsystems_length1, (GDestroyNotify) g_free), NULL);
- return self;
}
-Application* application_new (ScanDevice* device) {
- return application_construct (TYPE_APPLICATION, device);
-}
-
-
-void application_start (Application* self) {
- SimpleScan* _tmp0_;
+static void simple_scan_real_activate (GApplication* base) {
+ SimpleScan * self;
+ UserInterface* _tmp0_;
Scanner* _tmp1_;
- g_return_if_fail (self != NULL);
+ self = (SimpleScan*) base;
+ G_APPLICATION_CLASS (simple_scan_parent_class)->activate ((GApplication*) GTK_APPLICATION (self));
_tmp0_ = self->priv->ui;
- simple_scan_start (_tmp0_);
+ user_interface_start (_tmp0_);
_tmp1_ = self->priv->scanner;
scanner_start (_tmp1_);
}
-static void application_update_scan_devices_cb (Application* self, Scanner* scanner, GList* devices) {
+static void simple_scan_real_shutdown (GApplication* base) {
+ SimpleScan * self;
+ Scanner* _tmp0_;
+ self = (SimpleScan*) base;
+ G_APPLICATION_CLASS (simple_scan_parent_class)->shutdown ((GApplication*) GTK_APPLICATION (self));
+ _book_unref0 (self->priv->book);
+ self->priv->book = NULL;
+ _user_interface_unref0 (self->priv->ui);
+ self->priv->ui = NULL;
+ _g_object_unref0 (self->priv->udev_client);
+ self->priv->udev_client = NULL;
+ _tmp0_ = self->priv->scanner;
+ scanner_free (_tmp0_);
+}
+
+
+static void simple_scan_update_scan_devices_cb (SimpleScan* self, Scanner* scanner, GList* devices) {
GList* _tmp0_;
GList* _tmp1_ = NULL;
GList* devices_copy;
ScanDevice* _tmp2_;
GList* _tmp10_;
guint _tmp11_ = 0U;
- SimpleScan* _tmp12_;
+ UserInterface* _tmp12_;
GList* _tmp13_;
g_return_if_fail (self != NULL);
g_return_if_fail (scanner != NULL);
@@ -687,15 +691,15 @@ static void application_update_scan_devices_cb (Application* self, Scanner* scan
self->priv->have_devices = _tmp11_ > ((guint) 0);
_tmp12_ = self->priv->ui;
_tmp13_ = devices_copy;
- simple_scan_set_scan_devices (_tmp12_, _tmp13_);
+ user_interface_set_scan_devices (_tmp12_, _tmp13_);
_g_list_free0 (devices_copy);
}
-static void application_authorize_cb (Application* self, Scanner* scanner, const gchar* resource) {
+static void simple_scan_authorize_cb (SimpleScan* self, Scanner* scanner, const gchar* resource) {
gchar* username = NULL;
gchar* password = NULL;
- SimpleScan* _tmp0_;
+ UserInterface* _tmp0_;
const gchar* _tmp1_;
gchar* _tmp2_ = NULL;
gchar* _tmp3_ = NULL;
@@ -705,7 +709,7 @@ static void application_authorize_cb (Application* self, Scanner* scanner, const
g_return_if_fail (resource != NULL);
_tmp0_ = self->priv->ui;
_tmp1_ = resource;
- simple_scan_authorize (_tmp0_, _tmp1_, &_tmp2_, &_tmp3_);
+ user_interface_authorize (_tmp0_, _tmp1_, &_tmp2_, &_tmp3_);
_g_free0 (username);
username = _tmp2_;
_g_free0 (password);
@@ -717,7 +721,7 @@ static void application_authorize_cb (Application* self, Scanner* scanner, const
}
-static Page* application_append_page (Application* self) {
+static Page* simple_scan_append_page (SimpleScan* self) {
Page* result = NULL;
Book* _tmp0_;
Page* _tmp1_ = NULL;
@@ -743,7 +747,7 @@ static Page* application_append_page (Application* self) {
ScanDirection _tmp33_;
Page* _tmp34_ = NULL;
gboolean _tmp35_;
- SimpleScan* _tmp45_;
+ UserInterface* _tmp45_;
Page* _tmp46_;
Page* _tmp47_;
g_return_val_if_fail (self != NULL, NULL);
@@ -762,12 +766,12 @@ static Page* application_append_page (Application* self) {
}
_tmp6_ = _tmp2_;
if (_tmp6_) {
- SimpleScan* _tmp7_;
+ UserInterface* _tmp7_;
Page* _tmp8_;
Page* _tmp9_;
_tmp7_ = self->priv->ui;
_tmp8_ = page;
- simple_scan_set_selected_page (_tmp7_, _tmp8_);
+ user_interface_set_selected_page (_tmp7_, _tmp8_);
_tmp9_ = page;
page_start (_tmp9_);
result = page;
@@ -869,7 +873,7 @@ static Page* application_append_page (Application* self) {
}
_tmp45_ = self->priv->ui;
_tmp46_ = page;
- simple_scan_set_selected_page (_tmp45_, _tmp46_);
+ user_interface_set_selected_page (_tmp45_, _tmp46_);
_tmp47_ = page;
page_start (_tmp47_);
result = page;
@@ -878,18 +882,18 @@ static Page* application_append_page (Application* self) {
}
-static void application_scanner_new_page_cb (Application* self, Scanner* scanner) {
+static void simple_scan_scanner_new_page_cb (SimpleScan* self, Scanner* scanner) {
Page* _tmp0_ = NULL;
Page* _tmp1_;
g_return_if_fail (self != NULL);
g_return_if_fail (scanner != NULL);
- _tmp0_ = application_append_page (self);
+ _tmp0_ = simple_scan_append_page (self);
_tmp1_ = _tmp0_;
_page_unref0 (_tmp1_);
}
-static gchar* application_get_profile_for_device (Application* self, const gchar* device_name) {
+static gchar* simple_scan_get_profile_for_device (SimpleScan* self, const gchar* device_name) {
gchar* result = NULL;
const gchar* _tmp0_;
gchar* _tmp1_ = NULL;
@@ -920,7 +924,7 @@ static gchar* application_get_profile_for_device (Application* self, const gchar
_tmp1_ = g_strdup_printf ("sane:%s", _tmp0_);
device_id = _tmp1_;
_tmp2_ = device_name;
- g_debug ("simple-scan.vala:170: Getting color profile for device %s", _tmp2_);
+ g_debug ("simple-scan.vala:184: Getting color profile for device %s", _tmp2_);
_tmp3_ = cd_client_new ();
client = _tmp3_;
{
@@ -941,7 +945,7 @@ static gchar* application_get_profile_for_device (Application* self, const gchar
_inner_error_ = NULL;
_tmp5_ = e;
_tmp6_ = _tmp5_->message;
- g_debug ("simple-scan.vala:179: Failed to connect to colord: %s", _tmp6_);
+ g_debug ("simple-scan.vala:193: Failed to connect to colord: %s", _tmp6_);
result = NULL;
_g_error_free0 (e);
_g_object_unref0 (client);
@@ -983,7 +987,7 @@ static gchar* application_get_profile_for_device (Application* self, const gchar
_tmp11_ = device_name;
_tmp12_ = e;
_tmp13_ = _tmp12_->message;
- g_debug ("simple-scan.vala:190: Unable to find colord device %s: %s", _tmp11_, _tmp13_);
+ g_debug ("simple-scan.vala:204: Unable to find colord device %s: %s", _tmp11_, _tmp13_);
result = NULL;
_g_error_free0 (e);
_g_object_unref0 (device);
@@ -1020,7 +1024,7 @@ static gchar* application_get_profile_for_device (Application* self, const gchar
_tmp15_ = device_name;
_tmp16_ = e;
_tmp17_ = _tmp16_->message;
- g_debug ("simple-scan.vala:200: Failed to get properties from the device %s: %s", _tmp15_, _tmp17_);
+ g_debug ("simple-scan.vala:214: Failed to get properties from the device %s: %s", _tmp15_, _tmp17_);
result = NULL;
_g_error_free0 (e);
_g_object_unref0 (device);
@@ -1044,7 +1048,7 @@ static gchar* application_get_profile_for_device (Application* self, const gchar
if (_tmp20_ == NULL) {
const gchar* _tmp21_;
_tmp21_ = device_name;
- g_debug ("simple-scan.vala:207: No default color profile for device: %s", _tmp21_);
+ g_debug ("simple-scan.vala:221: No default color profile for device: %s", _tmp21_);
result = NULL;
_g_object_unref0 (profile);
_g_object_unref0 (device);
@@ -1072,7 +1076,7 @@ static gchar* application_get_profile_for_device (Application* self, const gchar
_tmp23_ = device_name;
_tmp24_ = e;
_tmp25_ = _tmp24_->message;
- g_debug ("simple-scan.vala:217: Failed to get properties from the profile %s: %s", _tmp23_, _tmp25_);
+ g_debug ("simple-scan.vala:231: Failed to get properties from the profile %s: %s", _tmp23_, _tmp25_);
result = NULL;
_g_error_free0 (e);
_g_object_unref0 (profile);
@@ -1097,7 +1101,7 @@ static gchar* application_get_profile_for_device (Application* self, const gchar
if (_tmp28_ == NULL) {
const gchar* _tmp29_;
_tmp29_ = device_name;
- g_debug ("simple-scan.vala:223: No icc color profile for the device %s", _tmp29_);
+ g_debug ("simple-scan.vala:237: No icc color profile for the device %s", _tmp29_);
result = NULL;
_g_object_unref0 (profile);
_g_object_unref0 (device);
@@ -1109,7 +1113,7 @@ static gchar* application_get_profile_for_device (Application* self, const gchar
_tmp31_ = cd_profile_get_filename (_tmp30_);
_tmp32_ = _tmp31_;
_tmp33_ = device_name;
- g_debug ("simple-scan.vala:227: Using color profile %s for device %s", _tmp32_, _tmp33_);
+ g_debug ("simple-scan.vala:241: Using color profile %s for device %s", _tmp32_, _tmp33_);
_tmp34_ = profile;
_tmp35_ = cd_profile_get_filename (_tmp34_);
_tmp36_ = _tmp35_;
@@ -1123,7 +1127,7 @@ static gchar* application_get_profile_for_device (Application* self, const gchar
}
-static void application_scanner_page_info_cb (Application* self, Scanner* scanner, ScanPageInfo* info) {
+static void simple_scan_scanner_page_info_cb (SimpleScan* self, Scanner* scanner, ScanPageInfo* info) {
ScanPageInfo* _tmp0_;
gint _tmp1_;
ScanPageInfo* _tmp2_;
@@ -1146,15 +1150,15 @@ static void application_scanner_page_info_cb (Application* self, Scanner* scanne
_tmp3_ = _tmp2_->height;
_tmp4_ = info;
_tmp5_ = _tmp4_->depth;
- g_debug ("simple-scan.vala:236: Page is %d pixels wide, %d pixels high, %d bits " \
+ g_debug ("simple-scan.vala:250: Page is %d pixels wide, %d pixels high, %d bits " \
"per pixel", _tmp1_, _tmp3_, _tmp5_);
- _tmp6_ = application_append_page (self);
+ _tmp6_ = simple_scan_append_page (self);
page = _tmp6_;
_tmp7_ = info;
page_set_page_info (page, _tmp7_);
_tmp8_ = info;
_tmp9_ = _tmp8_->device;
- _tmp10_ = application_get_profile_for_device (self, _tmp9_);
+ _tmp10_ = simple_scan_get_profile_for_device (self, _tmp9_);
_tmp11_ = _tmp10_;
page_set_color_profile (page, _tmp11_);
_g_free0 (_tmp11_);
@@ -1162,7 +1166,7 @@ static void application_scanner_page_info_cb (Application* self, Scanner* scanne
}
-static void application_scanner_line_cb (Application* self, Scanner* scanner, ScanLine* line) {
+static void simple_scan_scanner_line_cb (SimpleScan* self, Scanner* scanner, ScanLine* line) {
Book* _tmp0_;
Book* _tmp1_;
guint _tmp2_ = 0U;
@@ -1183,7 +1187,7 @@ static void application_scanner_line_cb (Application* self, Scanner* scanner, Sc
}
-static void application_scanner_page_done_cb (Application* self, Scanner* scanner) {
+static void simple_scan_scanner_page_done_cb (SimpleScan* self, Scanner* scanner) {
Book* _tmp0_;
Book* _tmp1_;
guint _tmp2_ = 0U;
@@ -1201,7 +1205,7 @@ static void application_scanner_page_done_cb (Application* self, Scanner* scanne
}
-static void application_remove_empty_page (Application* self) {
+static void simple_scan_remove_empty_page (SimpleScan* self) {
Book* _tmp0_;
Book* _tmp1_;
guint _tmp2_ = 0U;
@@ -1232,22 +1236,22 @@ static void application_remove_empty_page (Application* self) {
}
-static void application_scanner_document_done_cb (Application* self, Scanner* scanner) {
+static void simple_scan_scanner_document_done_cb (SimpleScan* self, Scanner* scanner) {
g_return_if_fail (self != NULL);
g_return_if_fail (scanner != NULL);
- application_remove_empty_page (self);
+ simple_scan_remove_empty_page (self);
}
-static void application_scanner_failed_cb (Application* self, Scanner* scanner, gint error_code, const gchar* error_string) {
+static void simple_scan_scanner_failed_cb (SimpleScan* self, Scanner* scanner, gint error_code, const gchar* error_string) {
gint _tmp0_;
g_return_if_fail (self != NULL);
g_return_if_fail (scanner != NULL);
g_return_if_fail (error_string != NULL);
- application_remove_empty_page (self);
+ simple_scan_remove_empty_page (self);
_tmp0_ = error_code;
if (_tmp0_ != ((gint) SANE_STATUS_CANCELLED)) {
- SimpleScan* _tmp1_;
+ UserInterface* _tmp1_;
const gchar* _tmp2_ = NULL;
const gchar* _tmp3_;
gboolean _tmp4_;
@@ -1255,13 +1259,13 @@ static void application_scanner_failed_cb (Application* self, Scanner* scanner,
_tmp2_ = _ ("Failed to scan");
_tmp3_ = error_string;
_tmp4_ = self->priv->have_devices;
- simple_scan_show_error (_tmp1_, _tmp2_, _tmp3_, _tmp4_);
+ user_interface_show_error (_tmp1_, _tmp2_, _tmp3_, _tmp4_);
}
}
-static void application_scanner_scanning_changed_cb (Application* self, Scanner* scanner) {
- SimpleScan* _tmp0_;
+static void simple_scan_scanner_scanning_changed_cb (SimpleScan* self, Scanner* scanner) {
+ UserInterface* _tmp0_;
Scanner* _tmp1_;
gboolean _tmp2_ = FALSE;
g_return_if_fail (self != NULL);
@@ -1269,11 +1273,11 @@ static void application_scanner_scanning_changed_cb (Application* self, Scanner*
_tmp0_ = self->priv->ui;
_tmp1_ = scanner;
_tmp2_ = scanner_is_scanning (_tmp1_);
- simple_scan_set_scanning (_tmp0_, _tmp2_);
+ user_interface_set_scanning (_tmp0_, _tmp2_);
}
-static void application_scan_cb (Application* self, SimpleScan* ui, const gchar* device, ScanOptions* options) {
+static void simple_scan_scan_cb (SimpleScan* self, UserInterface* ui, const gchar* device, ScanOptions* options) {
ScanOptions* _tmp0_;
gint _tmp1_;
const gchar* _tmp2_;
@@ -1289,7 +1293,7 @@ static void application_scan_cb (Application* self, SimpleScan* ui, const gchar*
const gchar* _tmp14_;
gchar* _tmp15_ = NULL;
gchar* filename;
- SimpleScan* _tmp16_;
+ UserInterface* _tmp16_;
Scanner* _tmp17_;
const gchar* _tmp18_;
ScanOptions* _tmp19_;
@@ -1299,13 +1303,13 @@ static void application_scan_cb (Application* self, SimpleScan* ui, const gchar*
_tmp0_ = options;
_tmp1_ = _tmp0_->dpi;
_tmp2_ = device;
- g_debug ("simple-scan.vala:296: Requesting scan at %d dpi from device '%s'", _tmp1_, _tmp2_);
+ g_debug ("simple-scan.vala:310: Requesting scan at %d dpi from device '%s'", _tmp1_, _tmp2_);
_tmp3_ = self->priv->scanner;
_tmp4_ = scanner_is_scanning (_tmp3_);
if (!_tmp4_) {
Page* _tmp5_ = NULL;
Page* _tmp6_;
- _tmp5_ = application_append_page (self);
+ _tmp5_ = simple_scan_append_page (self);
_tmp6_ = _tmp5_;
_page_unref0 (_tmp6_);
}
@@ -1330,7 +1334,7 @@ static void application_scan_cb (Application* self, SimpleScan* ui, const gchar*
_tmp15_ = g_strdup_printf ("%s.%s", _tmp13_, _tmp14_);
filename = _tmp15_;
_tmp16_ = ui;
- simple_scan_set_default_file_name (_tmp16_, filename);
+ user_interface_set_default_file_name (_tmp16_, filename);
_tmp17_ = self->priv->scanner;
_tmp18_ = device;
_tmp19_ = options;
@@ -1341,7 +1345,7 @@ static void application_scan_cb (Application* self, SimpleScan* ui, const gchar*
}
-static void application_cancel_cb (Application* self, SimpleScan* ui) {
+static void simple_scan_cancel_cb (SimpleScan* self, UserInterface* ui) {
Scanner* _tmp0_;
g_return_if_fail (self != NULL);
g_return_if_fail (ui != NULL);
@@ -1350,7 +1354,7 @@ static void application_cancel_cb (Application* self, SimpleScan* ui) {
}
-static gchar* application_get_temporary_filename (Application* self, const gchar* prefix, const gchar* extension) {
+static gchar* simple_scan_get_temporary_filename (SimpleScan* self, const gchar* prefix, const gchar* extension) {
gchar* result = NULL;
const gchar* _tmp0_;
const gchar* _tmp1_;
@@ -1392,7 +1396,7 @@ static gchar* application_get_temporary_filename (Application* self, const gchar
_inner_error_ = NULL;
_tmp7_ = e;
_tmp8_ = _tmp7_->message;
- g_warning ("simple-scan.vala:332: Error saving email attachment: %s", _tmp8_);
+ g_warning ("simple-scan.vala:346: Error saving email attachment: %s", _tmp8_);
result = NULL;
_g_error_free0 (e);
_g_free0 (path);
@@ -1413,12 +1417,12 @@ static gchar* application_get_temporary_filename (Application* self, const gchar
}
-static void application_email_cb (Application* self, SimpleScan* ui, const gchar* profile) {
+static void simple_scan_email_cb (SimpleScan* self, UserInterface* ui, const gchar* profile) {
gboolean saved;
gchar* _tmp0_;
gchar* command_line;
const gchar* _tmp1_;
- const gchar* _tmp38_;
+ const gchar* _tmp40_;
GError * _inner_error_ = NULL;
g_return_if_fail (self != NULL);
g_return_if_fail (ui != NULL);
@@ -1431,27 +1435,30 @@ static void application_email_cb (Application* self, SimpleScan* ui, const gchar
gchar* _tmp2_ = NULL;
gchar* path;
const gchar* _tmp3_;
- _tmp2_ = application_get_temporary_filename (self, "scan", "pdf");
+ _tmp2_ = simple_scan_get_temporary_filename (self, "scan", "pdf");
path = _tmp2_;
_tmp3_ = path;
if (_tmp3_ != NULL) {
const gchar* _tmp4_;
GFile* _tmp5_ = NULL;
GFile* file;
- const gchar* _tmp10_;
- const gchar* _tmp11_;
- gchar* _tmp12_ = NULL;
- gchar* _tmp13_;
- gchar* _tmp14_;
+ UserInterface* _tmp6_;
+ const gchar* _tmp12_;
+ const gchar* _tmp13_;
+ gchar* _tmp14_ = NULL;
+ gchar* _tmp15_;
+ gchar* _tmp16_;
_tmp4_ = path;
_tmp5_ = g_file_new_for_path (_tmp4_);
file = _tmp5_;
+ _tmp6_ = ui;
+ user_interface_show_progress_dialog (_tmp6_);
{
- Book* _tmp6_;
- GFile* _tmp7_;
- _tmp6_ = self->priv->book;
- _tmp7_ = file;
- book_save (_tmp6_, "pdf", _tmp7_, &_inner_error_);
+ Book* _tmp7_;
+ GFile* _tmp8_;
+ _tmp7_ = self->priv->book;
+ _tmp8_ = file;
+ book_save (_tmp7_, "pdf", _tmp8_, &_inner_error_);
if (_inner_error_ != NULL) {
goto __catch8_g_error;
}
@@ -1460,13 +1467,16 @@ static void application_email_cb (Application* self, SimpleScan* ui, const gchar
__catch8_g_error:
{
GError* e = NULL;
- GError* _tmp8_;
- const gchar* _tmp9_;
+ UserInterface* _tmp9_;
+ GError* _tmp10_;
+ const gchar* _tmp11_;
e = _inner_error_;
_inner_error_ = NULL;
- _tmp8_ = e;
- _tmp9_ = _tmp8_->message;
- g_warning ("simple-scan.vala:358: Unable to save email file: %s", _tmp9_);
+ _tmp9_ = ui;
+ user_interface_hide_progress_dialog (_tmp9_);
+ _tmp10_ = e;
+ _tmp11_ = _tmp10_->message;
+ g_warning ("simple-scan.vala:374: Unable to save email file: %s", _tmp11_);
_g_error_free0 (e);
_g_object_unref0 (file);
_g_free0 (path);
@@ -1482,14 +1492,14 @@ static void application_email_cb (Application* self, SimpleScan* ui, const gchar
g_clear_error (&_inner_error_);
return;
}
- _tmp10_ = command_line;
- _tmp11_ = path;
- _tmp12_ = g_strdup_printf (" --attach %s", _tmp11_);
- _tmp13_ = _tmp12_;
- _tmp14_ = g_strconcat (_tmp10_, _tmp13_, NULL);
+ _tmp12_ = command_line;
+ _tmp13_ = path;
+ _tmp14_ = g_strdup_printf (" --attach %s", _tmp13_);
+ _tmp15_ = _tmp14_;
+ _tmp16_ = g_strconcat (_tmp12_, _tmp15_, NULL);
_g_free0 (command_line);
- command_line = _tmp14_;
- _g_free0 (_tmp13_);
+ command_line = _tmp16_;
+ _g_free0 (_tmp15_);
_g_object_unref0 (file);
}
_g_free0 (path);
@@ -1498,62 +1508,62 @@ static void application_email_cb (Application* self, SimpleScan* ui, const gchar
gint i;
i = 0;
{
- gboolean _tmp15_;
- _tmp15_ = TRUE;
+ gboolean _tmp17_;
+ _tmp17_ = TRUE;
while (TRUE) {
- gboolean _tmp16_;
- gint _tmp18_;
- Book* _tmp19_;
- guint _tmp20_ = 0U;
- gchar* _tmp21_ = NULL;
+ gboolean _tmp18_;
+ gint _tmp20_;
+ Book* _tmp21_;
+ guint _tmp22_ = 0U;
+ gchar* _tmp23_ = NULL;
gchar* path;
- const gchar* _tmp22_;
- const gchar* _tmp23_;
- GFile* _tmp24_ = NULL;
+ const gchar* _tmp24_;
+ const gchar* _tmp25_;
+ GFile* _tmp26_ = NULL;
GFile* file;
- const gchar* _tmp32_;
- const gchar* _tmp33_;
- gchar* _tmp34_ = NULL;
- gchar* _tmp35_;
- gchar* _tmp36_;
- gboolean _tmp37_;
- _tmp16_ = _tmp15_;
- if (!_tmp16_) {
- gint _tmp17_;
- _tmp17_ = i;
- i = _tmp17_ + 1;
+ const gchar* _tmp34_;
+ const gchar* _tmp35_;
+ gchar* _tmp36_ = NULL;
+ gchar* _tmp37_;
+ gchar* _tmp38_;
+ gboolean _tmp39_;
+ _tmp18_ = _tmp17_;
+ if (!_tmp18_) {
+ gint _tmp19_;
+ _tmp19_ = i;
+ i = _tmp19_ + 1;
}
- _tmp15_ = FALSE;
- _tmp18_ = i;
- _tmp19_ = self->priv->book;
- _tmp20_ = book_get_n_pages (_tmp19_);
- if (!(((guint) _tmp18_) < _tmp20_)) {
+ _tmp17_ = FALSE;
+ _tmp20_ = i;
+ _tmp21_ = self->priv->book;
+ _tmp22_ = book_get_n_pages (_tmp21_);
+ if (!(((guint) _tmp20_) < _tmp22_)) {
break;
}
- _tmp21_ = application_get_temporary_filename (self, "scan", "jpg");
- path = _tmp21_;
- _tmp22_ = path;
- if (_tmp22_ == NULL) {
+ _tmp23_ = simple_scan_get_temporary_filename (self, "scan", "jpg");
+ path = _tmp23_;
+ _tmp24_ = path;
+ if (_tmp24_ == NULL) {
saved = FALSE;
_g_free0 (path);
break;
}
- _tmp23_ = path;
- _tmp24_ = g_file_new_for_path (_tmp23_);
- file = _tmp24_;
+ _tmp25_ = path;
+ _tmp26_ = g_file_new_for_path (_tmp25_);
+ file = _tmp26_;
{
- Book* _tmp25_;
- gint _tmp26_;
- Page* _tmp27_ = NULL;
- Page* _tmp28_;
- GFile* _tmp29_;
- _tmp25_ = self->priv->book;
- _tmp26_ = i;
- _tmp27_ = book_get_page (_tmp25_, _tmp26_);
- _tmp28_ = _tmp27_;
- _tmp29_ = file;
- page_save (_tmp28_, "jpeg", _tmp29_, &_inner_error_);
- _page_unref0 (_tmp28_);
+ Book* _tmp27_;
+ gint _tmp28_;
+ Page* _tmp29_ = NULL;
+ Page* _tmp30_;
+ GFile* _tmp31_;
+ _tmp27_ = self->priv->book;
+ _tmp28_ = i;
+ _tmp29_ = book_get_page (_tmp27_, _tmp28_);
+ _tmp30_ = _tmp29_;
+ _tmp31_ = file;
+ page_save (_tmp30_, "jpeg", _tmp31_, &_inner_error_);
+ _page_unref0 (_tmp30_);
if (_inner_error_ != NULL) {
goto __catch9_g_error;
}
@@ -1562,13 +1572,13 @@ static void application_email_cb (Application* self, SimpleScan* ui, const gchar
__catch9_g_error:
{
GError* e = NULL;
- GError* _tmp30_;
- const gchar* _tmp31_;
+ GError* _tmp32_;
+ const gchar* _tmp33_;
e = _inner_error_;
_inner_error_ = NULL;
- _tmp30_ = e;
- _tmp31_ = _tmp30_->message;
- g_warning ("simple-scan.vala:382: Unable to save email file: %s", _tmp31_);
+ _tmp32_ = e;
+ _tmp33_ = _tmp32_->message;
+ g_warning ("simple-scan.vala:398: Unable to save email file: %s", _tmp33_);
_g_error_free0 (e);
_g_object_unref0 (file);
_g_free0 (path);
@@ -1584,16 +1594,16 @@ static void application_email_cb (Application* self, SimpleScan* ui, const gchar
g_clear_error (&_inner_error_);
return;
}
- _tmp32_ = command_line;
- _tmp33_ = path;
- _tmp34_ = g_strdup_printf (" --attach %s", _tmp33_);
- _tmp35_ = _tmp34_;
- _tmp36_ = g_strconcat (_tmp32_, _tmp35_, NULL);
+ _tmp34_ = command_line;
+ _tmp35_ = path;
+ _tmp36_ = g_strdup_printf (" --attach %s", _tmp35_);
+ _tmp37_ = _tmp36_;
+ _tmp38_ = g_strconcat (_tmp34_, _tmp37_, NULL);
_g_free0 (command_line);
- command_line = _tmp36_;
- _g_free0 (_tmp35_);
- _tmp37_ = saved;
- if (!_tmp37_) {
+ command_line = _tmp38_;
+ _g_free0 (_tmp37_);
+ _tmp39_ = saved;
+ if (!_tmp39_) {
_g_object_unref0 (file);
_g_free0 (path);
break;
@@ -1604,12 +1614,12 @@ static void application_email_cb (Application* self, SimpleScan* ui, const gchar
}
}
}
- _tmp38_ = command_line;
- g_debug ("simple-scan.vala:392: Launching email client: %s", _tmp38_);
+ _tmp40_ = command_line;
+ g_debug ("simple-scan.vala:408: Launching email client: %s", _tmp40_);
{
- const gchar* _tmp39_;
- _tmp39_ = command_line;
- g_spawn_command_line_async (_tmp39_, &_inner_error_);
+ const gchar* _tmp41_;
+ _tmp41_ = command_line;
+ g_spawn_command_line_async (_tmp41_, &_inner_error_);
if (_inner_error_ != NULL) {
goto __catch10_g_error;
}
@@ -1618,13 +1628,13 @@ static void application_email_cb (Application* self, SimpleScan* ui, const gchar
__catch10_g_error:
{
GError* e = NULL;
- GError* _tmp40_;
- const gchar* _tmp41_;
+ GError* _tmp42_;
+ const gchar* _tmp43_;
e = _inner_error_;
_inner_error_ = NULL;
- _tmp40_ = e;
- _tmp41_ = _tmp40_->message;
- g_warning ("simple-scan.vala:399: Unable to start email: %s", _tmp41_);
+ _tmp42_ = e;
+ _tmp43_ = _tmp42_->message;
+ g_warning ("simple-scan.vala:415: Unable to start email: %s", _tmp43_);
_g_error_free0 (e);
}
__finally10:
@@ -1638,26 +1648,11 @@ static void application_email_cb (Application* self, SimpleScan* ui, const gchar
}
-static void application_quit_cb (Application* self, SimpleScan* ui) {
- Scanner* _tmp0_;
- g_return_if_fail (self != NULL);
- g_return_if_fail (ui != NULL);
- _book_unref0 (self->priv->book);
- self->priv->book = NULL;
- ui = NULL;
- _g_object_unref0 (self->priv->udev_client);
- self->priv->udev_client = NULL;
- _tmp0_ = self->priv->scanner;
- scanner_free (_tmp0_);
- gtk_main_quit ();
-}
-
-
-static void application_log_cb (const gchar* log_domain, GLogLevelFlags log_level, const gchar* message) {
+static void simple_scan_log_cb (const gchar* log_domain, GLogLevelFlags log_level, const gchar* message) {
FILE* _tmp0_;
GLogLevelFlags _tmp14_;
g_return_if_fail (message != NULL);
- _tmp0_ = application_log_file;
+ _tmp0_ = simple_scan_log_file;
if (_tmp0_ != NULL) {
gchar* prefix = NULL;
GLogLevelFlags _tmp1_;
@@ -1725,8 +1720,8 @@ static void application_log_cb (const gchar* log_domain, GLogLevelFlags log_leve
break;
}
}
- _tmp9_ = application_log_file;
- _tmp10_ = application_log_timer;
+ _tmp9_ = simple_scan_log_file;
+ _tmp10_ = simple_scan_log_timer;
_tmp11_ = g_timer_elapsed (_tmp10_, NULL);
_tmp12_ = prefix;
_tmp13_ = message;
@@ -1736,7 +1731,7 @@ static void application_log_cb (const gchar* log_domain, GLogLevelFlags log_leve
_tmp14_ = log_level;
if ((_tmp14_ & G_LOG_LEVEL_DEBUG) != 0) {
gboolean _tmp15_;
- _tmp15_ = application_debug_enabled;
+ _tmp15_ = simple_scan_debug_enabled;
if (_tmp15_) {
GLogFunc _tmp16_;
void* _tmp16__target;
@@ -1766,7 +1761,7 @@ static void application_log_cb (const gchar* log_domain, GLogLevelFlags log_leve
}
-static void application_on_uevent (Application* self, GUdevClient* client, const gchar* action, GUdevDevice* device) {
+static void simple_scan_on_uevent (SimpleScan* self, GUdevClient* client, const gchar* action, GUdevDevice* device) {
Scanner* _tmp0_;
g_return_if_fail (self != NULL);
g_return_if_fail (client != NULL);
@@ -1881,7 +1876,7 @@ static gchar* string_substring (const gchar* self, glong offset, glong len) {
}
-static void application_fix_pdf (const gchar* filename, GError** error) {
+static void simple_scan_fix_pdf (const gchar* filename, GError** error) {
guint8* data = NULL;
gint data_length1 = 0;
gint _data_size_ = 0;
@@ -2200,12 +2195,12 @@ static void application_fix_pdf (const gchar* filename, GError** error) {
}
-static void _application_log_cb_glog_func (const gchar* log_domain, GLogLevelFlags log_levels, const gchar* message, gpointer self) {
- application_log_cb (log_domain, log_levels, message);
+static void _simple_scan_log_cb_glog_func (const gchar* log_domain, GLogLevelFlags log_levels, const gchar* message, gpointer self) {
+ simple_scan_log_cb (log_domain, log_levels, message);
}
-gint application_main (gchar** args, int args_length1) {
+gint simple_scan_main (gchar** args, int args_length1) {
gint result = 0;
const gchar* _tmp0_ = NULL;
GOptionContext* _tmp1_;
@@ -2229,9 +2224,10 @@ gint application_main (gchar** args, int args_length1) {
FILE* _tmp46_ = NULL;
pid_t _tmp47_ = 0;
ScanDevice* _tmp48_;
- Application* _tmp49_;
- Application* app;
- Application* _tmp50_;
+ SimpleScan* _tmp49_;
+ SimpleScan* app;
+ SimpleScan* _tmp50_;
+ gint _tmp51_ = 0;
GError * _inner_error_ = NULL;
setlocale (LC_ALL, "");
bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
@@ -2242,7 +2238,7 @@ gint application_main (gchar** args, int args_length1) {
_tmp1_ = g_option_context_new (_tmp0_);
c = _tmp1_;
_tmp2_ = c;
- g_option_context_add_main_entries (_tmp2_, APPLICATION_options, GETTEXT_PACKAGE);
+ g_option_context_add_main_entries (_tmp2_, SIMPLE_SCAN_options, GETTEXT_PACKAGE);
_tmp3_ = c;
_tmp4_ = gtk_get_option_group (TRUE);
g_option_context_add_group (_tmp3_, _tmp4_);
@@ -2293,7 +2289,7 @@ gint application_main (gchar** args, int args_length1) {
g_clear_error (&_inner_error_);
return 0;
}
- _tmp14_ = application_show_version;
+ _tmp14_ = simple_scan_show_version;
if (_tmp14_) {
FILE* _tmp15_;
_tmp15_ = stderr;
@@ -2302,12 +2298,12 @@ gint application_main (gchar** args, int args_length1) {
_g_option_context_free0 (c);
return result;
}
- _tmp16_ = application_fix_pdf_filename;
+ _tmp16_ = simple_scan_fix_pdf_filename;
if (_tmp16_ != NULL) {
{
const gchar* _tmp17_;
- _tmp17_ = application_fix_pdf_filename;
- application_fix_pdf (_tmp17_, &_inner_error_);
+ _tmp17_ = simple_scan_fix_pdf_filename;
+ simple_scan_fix_pdf (_tmp17_, &_inner_error_);
if (_inner_error_ != NULL) {
goto __catch12_g_error;
}
@@ -2343,7 +2339,7 @@ gint application_main (gchar** args, int args_length1) {
_tmp23__length1 = args_length1;
_tmp24_ = i;
_tmp25_ = _tmp23_[_tmp24_];
- application_fix_pdf (_tmp25_, &_inner_error_);
+ simple_scan_fix_pdf (_tmp25_, &_inner_error_);
if (_inner_error_ != NULL) {
goto __catch12_g_error;
}
@@ -2414,8 +2410,8 @@ gint application_main (gchar** args, int args_length1) {
_tmp35_->label = _tmp38_;
}
_tmp39_ = g_timer_new ();
- _g_timer_destroy0 (application_log_timer);
- application_log_timer = _tmp39_;
+ _g_timer_destroy0 (simple_scan_log_timer);
+ simple_scan_log_timer = _tmp39_;
_tmp40_ = g_get_user_cache_dir ();
_tmp41_ = g_build_filename (_tmp40_, "simple-scan", NULL, NULL);
path = _tmp41_;
@@ -2427,19 +2423,18 @@ gint application_main (gchar** args, int args_length1) {
path = _tmp44_;
_tmp45_ = path;
_tmp46_ = fopen (_tmp45_, "w");
- _fclose0 (application_log_file);
- application_log_file = _tmp46_;
- g_log_set_default_handler (_application_log_cb_glog_func, NULL);
+ _fclose0 (simple_scan_log_file);
+ simple_scan_log_file = _tmp46_;
+ g_log_set_default_handler (_simple_scan_log_cb_glog_func, NULL);
_tmp47_ = getpid ();
- g_debug ("simple-scan.vala:586: Starting Simple Scan %s, PID=%i", VERSION, (gint) _tmp47_);
+ g_debug ("simple-scan.vala:593: Starting Simple Scan %s, PID=%i", VERSION, (gint) _tmp47_);
_tmp48_ = device;
- _tmp49_ = application_new (_tmp48_);
+ _tmp49_ = simple_scan_new (_tmp48_);
app = _tmp49_;
_tmp50_ = app;
- application_start (_tmp50_);
- gtk_main ();
- result = EXIT_SUCCESS;
- _application_unref0 (app);
+ _tmp51_ = g_application_run ((GApplication*) _tmp50_, 0, NULL);
+ result = _tmp51_;
+ _g_object_unref0 (app);
_g_free0 (path);
_scan_device_unref0 (device);
_g_option_context_free0 (c);
@@ -2449,175 +2444,48 @@ gint application_main (gchar** args, int args_length1) {
int main (int argc, char ** argv) {
g_type_init ();
- return application_main (argv, argc);
+ return simple_scan_main (argv, argc);
}
-static void value_application_init (GValue* value) {
- value->data[0].v_pointer = NULL;
-}
-
-
-static void value_application_free_value (GValue* value) {
- if (value->data[0].v_pointer) {
- application_unref (value->data[0].v_pointer);
- }
+static void simple_scan_class_init (SimpleScanClass * klass) {
+ simple_scan_parent_class = g_type_class_peek_parent (klass);
+ g_type_class_add_private (klass, sizeof (SimpleScanPrivate));
+ G_APPLICATION_CLASS (klass)->startup = simple_scan_real_startup;
+ G_APPLICATION_CLASS (klass)->activate = simple_scan_real_activate;
+ G_APPLICATION_CLASS (klass)->shutdown = simple_scan_real_shutdown;
+ G_OBJECT_CLASS (klass)->finalize = simple_scan_finalize;
}
-static void value_application_copy_value (const GValue* src_value, GValue* dest_value) {
- if (src_value->data[0].v_pointer) {
- dest_value->data[0].v_pointer = application_ref (src_value->data[0].v_pointer);
- } else {
- dest_value->data[0].v_pointer = NULL;
- }
-}
-
-
-static gpointer value_application_peek_pointer (const GValue* value) {
- return value->data[0].v_pointer;
-}
-
-
-static gchar* value_application_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
- if (collect_values[0].v_pointer) {
- Application* object;
- object = collect_values[0].v_pointer;
- if (object->parent_instance.g_class == NULL) {
- return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
- } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
- return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
- }
- value->data[0].v_pointer = application_ref (object);
- } else {
- value->data[0].v_pointer = NULL;
- }
- return NULL;
-}
-
-
-static gchar* value_application_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
- Application** object_p;
- object_p = collect_values[0].v_pointer;
- if (!object_p) {
- return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
- }
- if (!value->data[0].v_pointer) {
- *object_p = NULL;
- } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
- *object_p = value->data[0].v_pointer;
- } else {
- *object_p = application_ref (value->data[0].v_pointer);
- }
- return NULL;
-}
-
-
-GParamSpec* param_spec_application (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
- ParamSpecApplication* spec;
- g_return_val_if_fail (g_type_is_a (object_type, TYPE_APPLICATION), NULL);
- spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
- G_PARAM_SPEC (spec)->value_type = object_type;
- return G_PARAM_SPEC (spec);
-}
-
-
-gpointer value_get_application (const GValue* value) {
- g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_APPLICATION), NULL);
- return value->data[0].v_pointer;
-}
-
-
-void value_set_application (GValue* value, gpointer v_object) {
- Application* old;
- g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_APPLICATION));
- old = value->data[0].v_pointer;
- if (v_object) {
- g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_APPLICATION));
- g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
- value->data[0].v_pointer = v_object;
- application_ref (value->data[0].v_pointer);
- } else {
- value->data[0].v_pointer = NULL;
- }
- if (old) {
- application_unref (old);
- }
-}
-
-
-void value_take_application (GValue* value, gpointer v_object) {
- Application* old;
- g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_APPLICATION));
- old = value->data[0].v_pointer;
- if (v_object) {
- g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_APPLICATION));
- g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
- value->data[0].v_pointer = v_object;
- } else {
- value->data[0].v_pointer = NULL;
- }
- if (old) {
- application_unref (old);
- }
-}
-
-
-static void application_class_init (ApplicationClass * klass) {
- application_parent_class = g_type_class_peek_parent (klass);
- APPLICATION_CLASS (klass)->finalize = application_finalize;
- g_type_class_add_private (klass, sizeof (ApplicationPrivate));
-}
-
-
-static void application_instance_init (Application * self) {
- self->priv = APPLICATION_GET_PRIVATE (self);
+static void simple_scan_instance_init (SimpleScan * self) {
+ self->priv = SIMPLE_SCAN_GET_PRIVATE (self);
self->priv->default_device = NULL;
self->priv->have_devices = FALSE;
- self->ref_count = 1;
}
-static void application_finalize (Application* obj) {
- Application * self;
- self = APPLICATION (obj);
+static void simple_scan_finalize (GObject* obj) {
+ SimpleScan * self;
+ self = SIMPLE_SCAN (obj);
_scan_device_unref0 (self->priv->default_device);
_g_object_unref0 (self->priv->udev_client);
- _simple_scan_unref0 (self->priv->ui);
+ _user_interface_unref0 (self->priv->ui);
_scanner_unref0 (self->priv->scanner);
_book_unref0 (self->priv->book);
+ G_OBJECT_CLASS (simple_scan_parent_class)->finalize (obj);
}
-GType application_get_type (void) {
- static volatile gsize application_type_id__volatile = 0;
- if (g_once_init_enter (&application_type_id__volatile)) {
- static const GTypeValueTable g_define_type_value_table = { value_application_init, value_application_free_value, value_application_copy_value, value_application_peek_pointer, "p", value_application_collect_value, "p", value_application_lcopy_value };
- static const GTypeInfo g_define_type_info = { sizeof (ApplicationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) application_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Application), 0, (GInstanceInitFunc) application_instance_init, &g_define_type_value_table };
- static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
- GType application_type_id;
- application_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Application", &g_define_type_info, &g_define_type_fundamental_info, 0);
- g_once_init_leave (&application_type_id__volatile, application_type_id);
- }
- return application_type_id__volatile;
-}
-
-
-gpointer application_ref (gpointer instance) {
- Application* self;
- self = instance;
- g_atomic_int_inc (&self->ref_count);
- return instance;
-}
-
-
-void application_unref (gpointer instance) {
- Application* self;
- self = instance;
- if (g_atomic_int_dec_and_test (&self->ref_count)) {
- APPLICATION_GET_CLASS (self)->finalize (self);
- g_type_free_instance ((GTypeInstance *) self);
+GType simple_scan_get_type (void) {
+ static volatile gsize simple_scan_type_id__volatile = 0;
+ if (g_once_init_enter (&simple_scan_type_id__volatile)) {
+ static const GTypeInfo g_define_type_info = { sizeof (SimpleScanClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) simple_scan_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SimpleScan), 0, (GInstanceInitFunc) simple_scan_instance_init, NULL };
+ GType simple_scan_type_id;
+ simple_scan_type_id = g_type_register_static (GTK_TYPE_APPLICATION, "SimpleScan", &g_define_type_info, 0);
+ g_once_init_leave (&simple_scan_type_id__volatile, simple_scan_type_id);
}
+ return simple_scan_type_id__volatile;
}
diff --git a/src/simple-scan.vala b/src/simple-scan.vala
index cff06f8..0cc2c8d 100644
--- a/src/simple-scan.vala
+++ b/src/simple-scan.vala
@@ -9,7 +9,7 @@
* license.
*/
-public class Application
+public class SimpleScan : Gtk.Application
{
static bool show_version;
static bool debug_enabled;
@@ -32,20 +32,24 @@ public class Application
private ScanDevice? default_device = null;
private bool have_devices = false;
private GUdev.Client udev_client;
- private SimpleScan ui;
+ private UserInterface ui;
private Scanner scanner;
private Book book;
- public Application (ScanDevice? device = null)
+ public SimpleScan (ScanDevice? device = null)
{
default_device = device;
+ }
+
+ public override void startup ()
+ {
+ base.startup ();
- ui = new SimpleScan ();
+ ui = new UserInterface ();
book = ui.get_book ();
ui.start_scan.connect (scan_cb);
ui.stop_scan.connect (cancel_cb);
ui.email.connect (email_cb);
- ui.quit.connect (quit_cb);
scanner = Scanner.get_instance ();
scanner.update_devices.connect (update_scan_devices_cb);
@@ -71,13 +75,23 @@ public class Application
ui.set_selected_device (default_device.name);
}
}
-
- public void start ()
+
+ public override void activate ()
{
+ base.activate ();
ui.start ();
scanner.start ();
}
+ public override void shutdown ()
+ {
+ base.shutdown ();
+ book = null;
+ ui = null;
+ udev_client = null;
+ scanner.free ();
+ }
+
private void update_scan_devices_cb (Scanner scanner, List<ScanDevice> devices)
{
var devices_copy = devices.copy ();
@@ -291,7 +305,7 @@ public class Application
ui.set_scanning (scanner.is_scanning ());
}
- private void scan_cb (SimpleScan ui, string? device, ScanOptions options)
+ private void scan_cb (UserInterface ui, string? device, ScanOptions options)
{
debug ("Requesting scan at %d dpi from device '%s'", options.dpi, device);
@@ -310,7 +324,7 @@ public class Application
scanner.scan (device, options);
}
- private void cancel_cb (SimpleScan ui)
+ private void cancel_cb (UserInterface ui)
{
scanner.cancel ();
}
@@ -336,7 +350,7 @@ public class Application
return path;
}
- private void email_cb (SimpleScan ui, string profile)
+ private void email_cb (UserInterface ui, string profile)
{
var saved = false;
var command_line = "xdg-email";
@@ -349,12 +363,14 @@ public class Application
if (path != null)
{
var file = File.new_for_path (path);
+ ui.show_progress_dialog ();
try
{
book.save ("pdf", file);
}
catch (Error e)
{
+ ui.hide_progress_dialog ();
warning ("Unable to save email file: %s", e.message);
return;
}
@@ -400,15 +416,6 @@ public class Application
}
}
- private void quit_cb (SimpleScan ui)
- {
- book = null;
- ui = null;
- udev_client = null;
- scanner.free ();
- Gtk.main_quit ();
- }
-
private static void log_cb (string? log_domain, LogLevelFlags log_level, string message)
{
/* Log everything to a file */
@@ -585,11 +592,7 @@ public class Application
debug ("Starting Simple Scan %s, PID=%i", Config.VERSION, Posix.getpid ());
- Application app = new Application (device);
- app.start ();
-
- Gtk.main ();
-
- return Posix.EXIT_SUCCESS;
+ var app = new SimpleScan (device);
+ return app.run ();
}
}
diff --git a/src/ui.c b/src/ui.c
index 5b27835..da21602 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -1,4 +1,4 @@
-/* ui.c generated by valac 0.16.0, the Vala compiler
+/* ui.c generated by valac 0.16.1, the Vala compiler
* generated from ui.vala, do not modify */
/*
@@ -19,27 +19,47 @@
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
-#include <glib/gstdio.h>
-#include <unistd.h>
#include <cairo.h>
#include <float.h>
#include <math.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdk.h>
#include "config.h"
+#include <glib/gstdio.h>
+#include <unistd.h>
#include <gobject/gvaluecollector.h>
-#define TYPE_SIMPLE_SCAN (simple_scan_get_type ())
-#define SIMPLE_SCAN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SIMPLE_SCAN, SimpleScan))
-#define SIMPLE_SCAN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SIMPLE_SCAN, SimpleScanClass))
-#define IS_SIMPLE_SCAN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SIMPLE_SCAN))
-#define IS_SIMPLE_SCAN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SIMPLE_SCAN))
-#define SIMPLE_SCAN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SIMPLE_SCAN, SimpleScanClass))
+#define TYPE_USER_INTERFACE (user_interface_get_type ())
+#define USER_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_USER_INTERFACE, UserInterface))
+#define USER_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_USER_INTERFACE, UserInterfaceClass))
+#define IS_USER_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_USER_INTERFACE))
+#define IS_USER_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_USER_INTERFACE))
+#define USER_INTERFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_USER_INTERFACE, UserInterfaceClass))
+
+typedef struct _UserInterface UserInterface;
+typedef struct _UserInterfaceClass UserInterfaceClass;
+typedef struct _UserInterfacePrivate UserInterfacePrivate;
+
+#define TYPE_PROGRESS_BAR_DIALOG (progress_bar_dialog_get_type ())
+#define PROGRESS_BAR_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PROGRESS_BAR_DIALOG, ProgressBarDialog))
+#define PROGRESS_BAR_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PROGRESS_BAR_DIALOG, ProgressBarDialogClass))
+#define IS_PROGRESS_BAR_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PROGRESS_BAR_DIALOG))
+#define IS_PROGRESS_BAR_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PROGRESS_BAR_DIALOG))
+#define PROGRESS_BAR_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PROGRESS_BAR_DIALOG, ProgressBarDialogClass))
+
+typedef struct _ProgressBarDialog ProgressBarDialog;
+typedef struct _ProgressBarDialogClass ProgressBarDialogClass;
+
+#define TYPE_DRAG_AND_DROP_HANDLER (drag_and_drop_handler_get_type ())
+#define DRAG_AND_DROP_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DRAG_AND_DROP_HANDLER, DragAndDropHandler))
+#define DRAG_AND_DROP_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DRAG_AND_DROP_HANDLER, DragAndDropHandlerClass))
+#define IS_DRAG_AND_DROP_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DRAG_AND_DROP_HANDLER))
+#define IS_DRAG_AND_DROP_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DRAG_AND_DROP_HANDLER))
+#define DRAG_AND_DROP_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DRAG_AND_DROP_HANDLER, DragAndDropHandlerClass))
-typedef struct _SimpleScan SimpleScan;
-typedef struct _SimpleScanClass SimpleScanClass;
-typedef struct _SimpleScanPrivate SimpleScanPrivate;
+typedef struct _DragAndDropHandler DragAndDropHandler;
+typedef struct _DragAndDropHandlerClass DragAndDropHandlerClass;
#define TYPE_BOOK (book_get_type ())
#define BOOK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BOOK, Book))
@@ -63,6 +83,7 @@ typedef struct _BookViewClass BookViewClass;
#define TYPE_SCAN_DIRECTION (scan_direction_get_type ())
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _drag_and_drop_handler_unref0(var) ((var == NULL) ? NULL : (var = (drag_and_drop_handler_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _book_unref0(var) ((var == NULL) ? NULL : (var = (book_unref (var), NULL)))
@@ -106,17 +127,23 @@ typedef struct _ScanOptionsClass ScanOptionsClass;
typedef struct _ScanOptionsPrivate ScanOptionsPrivate;
#define _scan_options_unref0(var) ((var == NULL) ? NULL : (var = (scan_options_unref (var), NULL)))
#define _cairo_destroy0(var) ((var == NULL) ? NULL : (var = (cairo_destroy (var), NULL)))
-typedef struct _ParamSpecSimpleScan ParamSpecSimpleScan;
+typedef struct _ParamSpecUserInterface ParamSpecUserInterface;
+typedef struct _ProgressBarDialogPrivate ProgressBarDialogPrivate;
+typedef struct _DragAndDropHandlerPrivate DragAndDropHandlerPrivate;
-struct _SimpleScan {
+#define DRAG_AND_DROP_HANDLER_TYPE_TARGET_TYPE (drag_and_drop_handler_target_type_get_type ())
+#define _gtk_target_list_unref0(var) ((var == NULL) ? NULL : (var = (gtk_target_list_unref (var), NULL)))
+typedef struct _ParamSpecDragAndDropHandler ParamSpecDragAndDropHandler;
+
+struct _UserInterface {
GTypeInstance parent_instance;
volatile int ref_count;
- SimpleScanPrivate * priv;
+ UserInterfacePrivate * priv;
};
-struct _SimpleScanClass {
+struct _UserInterfaceClass {
GTypeClass parent_class;
- void (*finalize) (SimpleScan *self);
+ void (*finalize) (UserInterface *self);
};
typedef enum {
@@ -126,7 +153,7 @@ typedef enum {
SCAN_DIRECTION_RIGHT_TO_LEFT
} ScanDirection;
-struct _SimpleScanPrivate {
+struct _UserInterfacePrivate {
GSettings* settings;
GtkBuilder* builder;
GtkWindow* window;
@@ -167,6 +194,8 @@ struct _SimpleScanPrivate {
gboolean setting_devices;
gboolean user_selected_device;
GtkFileChooserDialog* save_dialog;
+ ProgressBarDialog* progress_dialog;
+ DragAndDropHandler* dnd_handler;
gboolean have_error;
gchar* error_title;
gchar* error_text;
@@ -231,20 +260,67 @@ struct _ScanOptionsClass {
void (*finalize) (ScanOptions *self);
};
-struct _ParamSpecSimpleScan {
+struct _ParamSpecUserInterface {
GParamSpec parent_instance;
};
+struct _ProgressBarDialog {
+ GtkWindow parent_instance;
+ ProgressBarDialogPrivate * priv;
+};
+
+struct _ProgressBarDialogClass {
+ GtkWindowClass parent_class;
+};
+
+struct _ProgressBarDialogPrivate {
+ GtkProgressBar* bar;
+};
+
+struct _DragAndDropHandler {
+ GTypeInstance parent_instance;
+ volatile int ref_count;
+ DragAndDropHandlerPrivate * priv;
+};
+
+struct _DragAndDropHandlerClass {
+ GTypeClass parent_class;
+ void (*finalize) (DragAndDropHandler *self);
+};
+
+struct _DragAndDropHandlerPrivate {
+ BookView* book_view;
+};
+
+typedef enum {
+ DRAG_AND_DROP_HANDLER_TARGET_TYPE_IMAGE,
+ DRAG_AND_DROP_HANDLER_TARGET_TYPE_URI
+} DragAndDropHandlerTargetType;
+
+struct _ParamSpecDragAndDropHandler {
+ GParamSpec parent_instance;
+};
-static gpointer simple_scan_parent_class = NULL;
-gpointer simple_scan_ref (gpointer instance);
-void simple_scan_unref (gpointer instance);
-GParamSpec* param_spec_simple_scan (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-void value_set_simple_scan (GValue* value, gpointer v_object);
-void value_take_simple_scan (GValue* value, gpointer v_object);
-gpointer value_get_simple_scan (const GValue* value);
-GType simple_scan_get_type (void) G_GNUC_CONST;
+static gpointer user_interface_parent_class = NULL;
+static gpointer progress_bar_dialog_parent_class = NULL;
+static gpointer drag_and_drop_handler_parent_class = NULL;
+
+gpointer user_interface_ref (gpointer instance);
+void user_interface_unref (gpointer instance);
+GParamSpec* param_spec_user_interface (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
+void value_set_user_interface (GValue* value, gpointer v_object);
+void value_take_user_interface (GValue* value, gpointer v_object);
+gpointer value_get_user_interface (const GValue* value);
+GType user_interface_get_type (void) G_GNUC_CONST;
+GType progress_bar_dialog_get_type (void) G_GNUC_CONST;
+gpointer drag_and_drop_handler_ref (gpointer instance);
+void drag_and_drop_handler_unref (gpointer instance);
+GParamSpec* param_spec_drag_and_drop_handler (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
+void value_set_drag_and_drop_handler (GValue* value, gpointer v_object);
+void value_take_drag_and_drop_handler (GValue* value, gpointer v_object);
+gpointer value_get_drag_and_drop_handler (const GValue* value);
+GType drag_and_drop_handler_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);
@@ -254,14 +330,14 @@ gpointer value_get_book (const GValue* value);
GType book_get_type (void) G_GNUC_CONST;
GType book_view_get_type (void) G_GNUC_CONST;
GType scan_direction_get_type (void) G_GNUC_CONST;
-#define SIMPLE_SCAN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_SIMPLE_SCAN, SimpleScanPrivate))
+#define USER_INTERFACE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_USER_INTERFACE, UserInterfacePrivate))
enum {
- SIMPLE_SCAN_DUMMY_PROPERTY
+ USER_INTERFACE_DUMMY_PROPERTY
};
-#define SIMPLE_SCAN_DEFAULT_TEXT_DPI 150
-#define SIMPLE_SCAN_DEFAULT_PHOTO_DPI 300
-SimpleScan* simple_scan_new (void);
-SimpleScan* simple_scan_construct (GType object_type);
+#define USER_INTERFACE_DEFAULT_TEXT_DPI 150
+#define USER_INTERFACE_DEFAULT_PHOTO_DPI 300
+UserInterface* user_interface_new (void);
+UserInterface* user_interface_construct (GType object_type);
Book* book_new (void);
Book* book_construct (GType object_type);
gpointer page_ref (gpointer instance);
@@ -271,17 +347,17 @@ 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;
-static void simple_scan_page_removed_cb (SimpleScan* self, Book* book, Page* page);
-static void _simple_scan_page_removed_cb_book_page_removed (Book* _sender, Page* page, gpointer self);
-static void simple_scan_page_added_cb (SimpleScan* self, Book* book, Page* page);
-static void _simple_scan_page_added_cb_book_page_added (Book* _sender, Page* page, gpointer self);
-static void simple_scan_load (SimpleScan* self);
-static gboolean simple_scan_find_scan_device (SimpleScan* self, const gchar* device, GtkTreeIter* iter);
-static void simple_scan_show_error_dialog (SimpleScan* self, const gchar* error_title, const gchar* error_text);
-void simple_scan_set_default_file_name (SimpleScan* self, const gchar* default_file_name);
-void simple_scan_authorize (SimpleScan* self, const gchar* resource, gchar** username, gchar** password);
-void G_MODULE_EXPORT device_combo_changed_cb (GtkWidget* widget, SimpleScan* self);
-static void simple_scan_update_info_bar (SimpleScan* self);
+static void user_interface_page_removed_cb (UserInterface* self, Book* book, Page* page);
+static void _user_interface_page_removed_cb_book_page_removed (Book* _sender, Page* page, gpointer self);
+static void user_interface_page_added_cb (UserInterface* self, Book* book, Page* page);
+static void _user_interface_page_added_cb_book_page_added (Book* _sender, Page* page, gpointer self);
+static void user_interface_load (UserInterface* self);
+static gboolean user_interface_find_scan_device (UserInterface* self, const gchar* device, GtkTreeIter* iter);
+static void user_interface_show_error_dialog (UserInterface* self, const gchar* error_title, const gchar* error_text);
+void user_interface_set_default_file_name (UserInterface* self, const gchar* default_file_name);
+void user_interface_authorize (UserInterface* self, const gchar* resource, gchar** username, gchar** password);
+void G_MODULE_EXPORT device_combo_changed_cb (GtkWidget* widget, UserInterface* self);
+static void user_interface_update_info_bar (UserInterface* self);
gpointer scan_device_ref (gpointer instance);
void scan_device_unref (gpointer instance);
GParamSpec* param_spec_scan_device (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
@@ -289,34 +365,36 @@ void value_set_scan_device (GValue* value, gpointer v_object);
void value_take_scan_device (GValue* value, gpointer v_object);
gpointer value_get_scan_device (const GValue* value);
GType scan_device_get_type (void) G_GNUC_CONST;
-void simple_scan_set_scan_devices (SimpleScan* self, GList* devices);
-static gchar* simple_scan_get_selected_device (SimpleScan* self);
-void simple_scan_set_selected_device (SimpleScan* self, const gchar* device);
-static void simple_scan_add_default_page (SimpleScan* self);
+void user_interface_set_scan_devices (UserInterface* self, GList* devices);
+static gchar* user_interface_get_selected_device (UserInterface* self);
+void user_interface_set_selected_device (UserInterface* self, const gchar* device);
+static void user_interface_add_default_page (UserInterface* self);
Page* book_append_page (Book* self, gint width, gint height, gint dpi, ScanDirection scan_direction);
void book_view_select_page (BookView* self, Page* page);
-static void simple_scan_on_file_type_changed (SimpleScan* self, GtkTreeSelection* selection);
-static gchar* simple_scan_choose_file_location (SimpleScan* self);
-static void _simple_scan_on_file_type_changed_gtk_tree_selection_changed (GtkTreeSelection* _sender, gpointer self);
-static gboolean simple_scan_save_document (SimpleScan* self, gboolean force_choose_location);
+static void user_interface_on_file_type_changed (UserInterface* self, GtkTreeSelection* selection);
+static gchar* user_interface_choose_file_location (UserInterface* self);
+static void _user_interface_on_file_type_changed_gtk_tree_selection_changed (GtkTreeSelection* _sender, gpointer self);
+static gboolean user_interface_save_document (UserInterface* self, gboolean force_choose_location);
+void user_interface_show_progress_dialog (UserInterface* self);
void book_save (Book* self, const gchar* type, GFile* file, GError** error);
-void simple_scan_show_error (SimpleScan* self, const gchar* error_title, const gchar* error_text, gboolean change_scanner_hint);
+void user_interface_hide_progress_dialog (UserInterface* self);
+void user_interface_show_error (UserInterface* self, const gchar* error_title, const gchar* error_text, gboolean change_scanner_hint);
void book_set_needs_saving (Book* self, gboolean needs_saving);
-static gboolean simple_scan_prompt_to_save (SimpleScan* self, const gchar* title, const gchar* discard_label);
+static gboolean user_interface_prompt_to_save (UserInterface* self, const gchar* title, const gchar* discard_label);
gboolean book_get_needs_saving (Book* self);
-static void simple_scan_clear_document (SimpleScan* self);
+static void user_interface_clear_document (UserInterface* self);
void book_clear (Book* self);
-void G_MODULE_EXPORT new_button_clicked_cb (GtkWidget* widget, SimpleScan* self);
-static void simple_scan_set_document_hint (SimpleScan* self, const gchar* document_hint);
-void G_MODULE_EXPORT text_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleScan* self);
-void G_MODULE_EXPORT photo_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleScan* self);
+void G_MODULE_EXPORT new_button_clicked_cb (GtkWidget* widget, UserInterface* self);
+static void user_interface_set_document_hint (UserInterface* self, const gchar* document_hint);
+void G_MODULE_EXPORT text_menuitem_toggled_cb (GtkCheckMenuItem* widget, UserInterface* self);
+void G_MODULE_EXPORT photo_menuitem_toggled_cb (GtkCheckMenuItem* widget, UserInterface* self);
GType scan_type_get_type (void) G_GNUC_CONST;
-static void simple_scan_set_page_side (SimpleScan* self, ScanType page_side);
-static void simple_scan_set_paper_size (SimpleScan* self, gint width, gint height);
-static gint simple_scan_get_text_dpi (SimpleScan* self);
-static gint simple_scan_get_photo_dpi (SimpleScan* self);
-static ScanType simple_scan_get_page_side (SimpleScan* self);
-static gboolean simple_scan_get_paper_size (SimpleScan* self, gint* width, gint* height);
+static void user_interface_set_page_side (UserInterface* self, ScanType page_side);
+static void user_interface_set_paper_size (UserInterface* self, gint width, gint height);
+static gint user_interface_get_text_dpi (UserInterface* self);
+static gint user_interface_get_photo_dpi (UserInterface* self);
+static ScanType user_interface_get_page_side (UserInterface* self);
+static gboolean user_interface_get_paper_size (UserInterface* self, gint* width, gint* height);
gpointer scan_options_ref (gpointer instance);
void scan_options_unref (gpointer instance);
GParamSpec* param_spec_scan_options (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
@@ -324,136 +402,161 @@ void value_set_scan_options (GValue* value, gpointer v_object);
void value_take_scan_options (GValue* value, gpointer v_object);
gpointer value_get_scan_options (const GValue* value);
GType scan_options_get_type (void) G_GNUC_CONST;
-static ScanOptions* simple_scan_get_scan_options (SimpleScan* self);
+static ScanOptions* user_interface_get_scan_options (UserInterface* self);
ScanOptions* scan_options_new (void);
ScanOptions* scan_options_construct (GType object_type);
GType scan_mode_get_type (void) G_GNUC_CONST;
-void G_MODULE_EXPORT scan_button_clicked_cb (GtkWidget* widget, SimpleScan* self);
-void G_MODULE_EXPORT stop_scan_button_clicked_cb (GtkWidget* widget, SimpleScan* self);
-void G_MODULE_EXPORT continuous_scan_button_clicked_cb (GtkWidget* widget, SimpleScan* self);
-void G_MODULE_EXPORT preferences_button_clicked_cb (GtkWidget* widget, SimpleScan* self);
-gboolean G_MODULE_EXPORT preferences_dialog_delete_event_cb (GtkWidget* widget, SimpleScan* self);
-void G_MODULE_EXPORT preferences_dialog_response_cb (GtkWidget* widget, gint response_id, SimpleScan* self);
-static void simple_scan_update_page_menu (SimpleScan* self);
+void G_MODULE_EXPORT scan_button_clicked_cb (GtkWidget* widget, UserInterface* self);
+void G_MODULE_EXPORT stop_scan_button_clicked_cb (GtkWidget* widget, UserInterface* self);
+void G_MODULE_EXPORT continuous_scan_button_clicked_cb (GtkWidget* widget, UserInterface* self);
+void G_MODULE_EXPORT preferences_button_clicked_cb (GtkWidget* widget, UserInterface* self);
+gboolean G_MODULE_EXPORT preferences_dialog_delete_event_cb (GtkWidget* widget, UserInterface* self);
+void G_MODULE_EXPORT preferences_dialog_response_cb (GtkWidget* widget, gint response_id, UserInterface* self);
+static void user_interface_update_page_menu (UserInterface* self);
Page* book_view_get_selected (BookView* self);
guint book_get_page_index (Book* self, Page* page);
guint book_get_n_pages (Book* self);
-static void simple_scan_page_selected_cb (SimpleScan* self, BookView* view, Page* page);
+static void user_interface_page_selected_cb (UserInterface* self, BookView* view, Page* page);
gboolean page_has_crop (Page* self);
gchar* page_get_named_crop (Page* self);
-static gchar* simple_scan_get_temporary_filename (SimpleScan* self, const gchar* prefix, const gchar* extension);
-static void simple_scan_show_page_cb (SimpleScan* self, BookView* view, Page* page);
+static void user_interface_show_page_cb (UserInterface* self, BookView* view, Page* page);
+gchar* get_temporary_filename (const gchar* prefix, const gchar* extension);
void page_save (Page* self, const gchar* type, GFile* file, GError** error);
-static void simple_scan_show_page_menu_cb (SimpleScan* self, BookView* view);
-void G_MODULE_EXPORT rotate_left_button_clicked_cb (GtkWidget* widget, SimpleScan* self);
+static void user_interface_show_page_menu_cb (UserInterface* self, BookView* view);
+void G_MODULE_EXPORT rotate_left_button_clicked_cb (GtkWidget* widget, UserInterface* self);
void page_rotate_left (Page* self);
-void G_MODULE_EXPORT rotate_right_button_clicked_cb (GtkWidget* widget, SimpleScan* self);
+void G_MODULE_EXPORT rotate_right_button_clicked_cb (GtkWidget* widget, UserInterface* self);
void page_rotate_right (Page* self);
-static void simple_scan_set_crop (SimpleScan* self, const gchar* crop_name);
+static void user_interface_set_crop (UserInterface* self, const gchar* crop_name);
void page_set_no_crop (Page* self);
gint page_get_width (Page* self);
gint page_get_height (Page* self);
void page_set_custom_crop (Page* self, gint width, gint height);
void page_move_crop (Page* self, gint x, gint y);
void page_set_named_crop (Page* self, const gchar* name);
-void G_MODULE_EXPORT no_crop_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleScan* self);
-void G_MODULE_EXPORT custom_crop_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleScan* self);
-void G_MODULE_EXPORT crop_toolbutton_toggled_cb (GtkToggleToolButton* widget, SimpleScan* self);
-void G_MODULE_EXPORT four_by_six_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleScan* self);
-void G_MODULE_EXPORT legal_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleScan* self);
-void G_MODULE_EXPORT letter_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleScan* self);
-void G_MODULE_EXPORT a6_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleScan* self);
-void G_MODULE_EXPORT a5_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleScan* self);
-void G_MODULE_EXPORT a4_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleScan* self);
-void G_MODULE_EXPORT crop_rotate_menuitem_activate_cb (GtkWidget* widget, SimpleScan* self);
+void G_MODULE_EXPORT no_crop_menuitem_toggled_cb (GtkCheckMenuItem* widget, UserInterface* self);
+void G_MODULE_EXPORT custom_crop_menuitem_toggled_cb (GtkCheckMenuItem* widget, UserInterface* self);
+void G_MODULE_EXPORT crop_toolbutton_toggled_cb (GtkToggleToolButton* widget, UserInterface* self);
+void G_MODULE_EXPORT four_by_six_menuitem_toggled_cb (GtkCheckMenuItem* widget, UserInterface* self);
+void G_MODULE_EXPORT legal_menuitem_toggled_cb (GtkCheckMenuItem* widget, UserInterface* self);
+void G_MODULE_EXPORT letter_menuitem_toggled_cb (GtkCheckMenuItem* widget, UserInterface* self);
+void G_MODULE_EXPORT a6_menuitem_toggled_cb (GtkCheckMenuItem* widget, UserInterface* self);
+void G_MODULE_EXPORT a5_menuitem_toggled_cb (GtkCheckMenuItem* widget, UserInterface* self);
+void G_MODULE_EXPORT a4_menuitem_toggled_cb (GtkCheckMenuItem* widget, UserInterface* self);
+void G_MODULE_EXPORT crop_rotate_menuitem_activate_cb (GtkWidget* widget, UserInterface* self);
void page_rotate_crop (Page* self);
-void G_MODULE_EXPORT page_move_left_menuitem_activate_cb (GtkWidget* widget, SimpleScan* self);
+void G_MODULE_EXPORT page_move_left_menuitem_activate_cb (GtkWidget* widget, UserInterface* self);
void book_move_page (Book* self, Page* page, guint location);
-void G_MODULE_EXPORT page_move_right_menuitem_activate_cb (GtkWidget* widget, SimpleScan* self);
-void G_MODULE_EXPORT page_delete_menuitem_activate_cb (GtkWidget* widget, SimpleScan* self);
+void G_MODULE_EXPORT page_move_right_menuitem_activate_cb (GtkWidget* widget, UserInterface* self);
+void G_MODULE_EXPORT page_delete_menuitem_activate_cb (GtkWidget* widget, UserInterface* self);
Book* book_view_get_book (BookView* self);
void book_delete_page (Book* self, Page* page);
-void G_MODULE_EXPORT save_file_button_clicked_cb (GtkWidget* widget, SimpleScan* self);
-void G_MODULE_EXPORT save_as_file_button_clicked_cb (GtkWidget* widget, SimpleScan* self);
-static void simple_scan_draw_page (SimpleScan* self, GtkPrintOperation* operation, GtkPrintContext* print_context, gint page_number);
+void G_MODULE_EXPORT save_file_button_clicked_cb (GtkWidget* widget, UserInterface* self);
+void G_MODULE_EXPORT save_as_file_button_clicked_cb (GtkWidget* widget, UserInterface* self);
+static void user_interface_draw_page (UserInterface* self, GtkPrintOperation* operation, GtkPrintContext* print_context, gint page_number);
Page* book_get_page (Book* self, gint page_number);
gboolean page_is_landscape (Page* self);
gint page_get_dpi (Page* self);
GdkPixbuf* page_get_image (Page* self, gboolean apply_crop);
-void G_MODULE_EXPORT email_button_clicked_cb (GtkWidget* widget, SimpleScan* self);
-void G_MODULE_EXPORT print_button_clicked_cb (GtkWidget* widget, SimpleScan* self);
-static void _simple_scan_draw_page_gtk_print_operation_draw_page (GtkPrintOperation* _sender, GtkPrintContext* context, gint page_nr, gpointer self);
-void G_MODULE_EXPORT help_contents_menuitem_activate_cb (GtkWidget* widget, SimpleScan* self);
-void G_MODULE_EXPORT about_menuitem_activate_cb (GtkWidget* widget, SimpleScan* self);
-static gboolean simple_scan_on_quit (SimpleScan* self);
-void G_MODULE_EXPORT quit_menuitem_activate_cb (GtkWidget* widget, SimpleScan* self);
-gboolean G_MODULE_EXPORT simple_scan_window_configure_event_cb (GtkWidget* widget, GdkEventConfigure* event, SimpleScan* self);
-static void simple_scan_info_bar_response_cb (SimpleScan* self, GtkInfoBar* widget, gint response_id);
-gboolean G_MODULE_EXPORT simple_scan_window_window_state_event_cb (GtkWidget* widget, GdkEventWindowState* event, SimpleScan* self);
-gboolean G_MODULE_EXPORT window_delete_event_cb (GtkWidget* widget, GdkEvent* event, SimpleScan* self);
-static void simple_scan_page_size_changed_cb (SimpleScan* self, Page* page);
-static void simple_scan_page_scan_direction_changed_cb (SimpleScan* self, Page* page);
+void G_MODULE_EXPORT email_button_clicked_cb (GtkWidget* widget, UserInterface* self);
+void G_MODULE_EXPORT print_button_clicked_cb (GtkWidget* widget, UserInterface* self);
+static void _user_interface_draw_page_gtk_print_operation_draw_page (GtkPrintOperation* _sender, GtkPrintContext* context, gint page_nr, gpointer self);
+void G_MODULE_EXPORT help_contents_menuitem_activate_cb (GtkWidget* widget, UserInterface* self);
+void G_MODULE_EXPORT about_menuitem_activate_cb (GtkWidget* widget, UserInterface* self);
+static gboolean user_interface_on_quit (UserInterface* self);
+void G_MODULE_EXPORT quit_menuitem_activate_cb (GtkWidget* widget, UserInterface* self);
+gboolean G_MODULE_EXPORT simple_scan_window_configure_event_cb (GtkWidget* widget, GdkEventConfigure* event, UserInterface* self);
+static void user_interface_info_bar_response_cb (UserInterface* self, GtkInfoBar* widget, gint response_id);
+gboolean G_MODULE_EXPORT simple_scan_window_window_state_event_cb (GtkWidget* widget, GdkEventWindowState* event, UserInterface* self);
+gboolean G_MODULE_EXPORT window_delete_event_cb (GtkWidget* widget, GdkEvent* event, UserInterface* self);
+static void user_interface_page_size_changed_cb (UserInterface* self, Page* page);
+static void user_interface_page_scan_direction_changed_cb (UserInterface* self, Page* page);
ScanDirection page_get_scan_direction (Page* self);
-static void _simple_scan_page_size_changed_cb_page_size_changed (Page* _sender, gpointer self);
-static void _simple_scan_page_scan_direction_changed_cb_page_scan_direction_changed (Page* _sender, gpointer self);
-static void simple_scan_set_dpi_combo (SimpleScan* self, GtkComboBox* combo, gint default_dpi, gint current_dpi);
-static void simple_scan_needs_saving_cb (SimpleScan* self, Book* book);
-static void _simple_scan_info_bar_response_cb_gtk_info_bar_response (GtkInfoBar* _sender, gint response_id, gpointer self);
+static void _user_interface_page_size_changed_cb_page_size_changed (Page* _sender, gpointer self);
+static void _user_interface_page_scan_direction_changed_cb_page_scan_direction_changed (Page* _sender, gpointer self);
+static void user_interface_set_dpi_combo (UserInterface* self, GtkComboBox* combo, gint default_dpi, gint current_dpi);
+static void user_interface_needs_saving_cb (UserInterface* self, Book* book);
+static void _user_interface_info_bar_response_cb_gtk_info_bar_response (GtkInfoBar* _sender, gint response_id, gpointer self);
BookView* book_view_new (Book* book);
BookView* book_view_construct (GType object_type, Book* book);
-static void _simple_scan_page_selected_cb_book_view_page_selected (BookView* _sender, Page* page, gpointer self);
-static void _simple_scan_show_page_cb_book_view_show_page (BookView* _sender, Page* page, gpointer self);
-static void _simple_scan_show_page_menu_cb_book_view_show_menu (BookView* _sender, gpointer self);
-static void _simple_scan_needs_saving_cb_book_needs_saving_changed (Book* _sender, gpointer self);
-Book* simple_scan_get_book (SimpleScan* self);
-void simple_scan_set_selected_page (SimpleScan* self, Page* page);
-Page* simple_scan_get_selected_page (SimpleScan* self);
-void simple_scan_set_scanning (SimpleScan* self, gboolean scanning);
-void simple_scan_start (SimpleScan* self);
+static void _user_interface_page_selected_cb_book_view_page_selected (BookView* _sender, Page* page, gpointer self);
+static void _user_interface_show_page_cb_book_view_show_page (BookView* _sender, Page* page, gpointer self);
+static void _user_interface_show_page_menu_cb_book_view_show_menu (BookView* _sender, gpointer self);
+static void _user_interface_needs_saving_cb_book_needs_saving_changed (Book* _sender, gpointer self);
+ProgressBarDialog* progress_bar_dialog_new (GtkWindow* parent, const gchar* title);
+ProgressBarDialog* progress_bar_dialog_construct (GType object_type, GtkWindow* parent, const gchar* title);
+static void user_interface_book_saving_cb (UserInterface* self, gint page_number);
+static void _user_interface_book_saving_cb_book_saving (Book* _sender, gint i, gpointer self);
+DragAndDropHandler* drag_and_drop_handler_new (BookView* book_view);
+DragAndDropHandler* drag_and_drop_handler_construct (GType object_type, BookView* book_view);
+static gboolean ___lambda2_ (UserInterface* self);
+static gboolean ____lambda2__gsource_func (gpointer self);
+void progress_bar_dialog_set_fraction (ProgressBarDialog* self, gdouble percent);
+void progress_bar_dialog_set_message (ProgressBarDialog* self, const gchar* message);
+Book* user_interface_get_book (UserInterface* self);
+void user_interface_set_selected_page (UserInterface* self, Page* page);
+Page* user_interface_get_selected_page (UserInterface* self);
+void user_interface_set_scanning (UserInterface* self, gboolean scanning);
+void user_interface_start (UserInterface* self);
static void g_cclosure_user_marshal_VOID__STRING_SCAN_OPTIONS (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
-static void simple_scan_finalize (SimpleScan* obj);
+static void user_interface_finalize (UserInterface* obj);
+#define PROGRESS_BAR_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_PROGRESS_BAR_DIALOG, ProgressBarDialogPrivate))
+enum {
+ PROGRESS_BAR_DIALOG_DUMMY_PROPERTY
+};
+static void progress_bar_dialog_finalize (GObject* obj);
+#define DRAG_AND_DROP_HANDLER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_DRAG_AND_DROP_HANDLER, DragAndDropHandlerPrivate))
+enum {
+ DRAG_AND_DROP_HANDLER_DUMMY_PROPERTY
+};
+static GType drag_and_drop_handler_target_type_get_type (void) G_GNUC_UNUSED;
+GtkWidget* book_view_get_event_source (BookView* self);
+static void drag_and_drop_handler_set_targets (DragAndDropHandler* self, GtkWidget* event_source);
+static void drag_and_drop_handler_on_drag_data_get (DragAndDropHandler* self, GdkDragContext* context, GtkSelectionData* selection, guint target_type, guint time);
+static void _drag_and_drop_handler_on_drag_data_get_gtk_widget_drag_data_get (GtkWidget* _sender, GdkDragContext* context, GtkSelectionData* selection_data, guint info, guint time_, gpointer self);
+static void drag_and_drop_handler_finalize (DragAndDropHandler* 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 void _simple_scan_page_removed_cb_book_page_removed (Book* _sender, Page* page, gpointer self) {
- simple_scan_page_removed_cb (self, _sender, page);
+static void _user_interface_page_removed_cb_book_page_removed (Book* _sender, Page* page, gpointer self) {
+ user_interface_page_removed_cb (self, _sender, page);
}
-static void _simple_scan_page_added_cb_book_page_added (Book* _sender, Page* page, gpointer self) {
- simple_scan_page_added_cb (self, _sender, page);
+static void _user_interface_page_added_cb_book_page_added (Book* _sender, Page* page, gpointer self) {
+ user_interface_page_added_cb (self, _sender, page);
}
-SimpleScan* simple_scan_construct (GType object_type) {
- SimpleScan* self = NULL;
+UserInterface* user_interface_construct (GType object_type) {
+ UserInterface* self = NULL;
Book* _tmp0_;
Book* _tmp1_;
Book* _tmp2_;
GSettings* _tmp3_;
- self = (SimpleScan*) g_type_create_instance (object_type);
+ self = (UserInterface*) g_type_create_instance (object_type);
_tmp0_ = book_new ();
_book_unref0 (self->priv->book);
self->priv->book = _tmp0_;
_tmp1_ = self->priv->book;
- g_signal_connect (_tmp1_, "page-removed", (GCallback) _simple_scan_page_removed_cb_book_page_removed, self);
+ g_signal_connect (_tmp1_, "page-removed", (GCallback) _user_interface_page_removed_cb_book_page_removed, self);
_tmp2_ = self->priv->book;
- g_signal_connect (_tmp2_, "page-added", (GCallback) _simple_scan_page_added_cb_book_page_added, self);
+ g_signal_connect (_tmp2_, "page-added", (GCallback) _user_interface_page_added_cb_book_page_added, self);
_tmp3_ = g_settings_new ("org.gnome.SimpleScan");
_g_object_unref0 (self->priv->settings);
self->priv->settings = _tmp3_;
- simple_scan_load (self);
+ user_interface_load (self);
return self;
}
-SimpleScan* simple_scan_new (void) {
- return simple_scan_construct (TYPE_SIMPLE_SCAN);
+UserInterface* user_interface_new (void) {
+ return user_interface_construct (TYPE_USER_INTERFACE);
}
-static gboolean simple_scan_find_scan_device (SimpleScan* self, const gchar* device, GtkTreeIter* iter) {
+static gboolean user_interface_find_scan_device (UserInterface* self, const gchar* device, GtkTreeIter* iter) {
GtkTreeIter _vala_iter = {0};
gboolean result = FALSE;
gboolean have_iter;
@@ -518,7 +621,7 @@ static gboolean simple_scan_find_scan_device (SimpleScan* self, const gchar* dev
}
-static void simple_scan_show_error_dialog (SimpleScan* self, const gchar* error_title, const gchar* error_text) {
+static void user_interface_show_error_dialog (UserInterface* self, const gchar* error_title, const gchar* error_text) {
GtkWindow* _tmp0_;
const gchar* _tmp1_;
GtkMessageDialog* _tmp2_;
@@ -541,7 +644,7 @@ static void simple_scan_show_error_dialog (SimpleScan* self, const gchar* error_
}
-void simple_scan_set_default_file_name (SimpleScan* self, const gchar* default_file_name) {
+void user_interface_set_default_file_name (UserInterface* self, const gchar* default_file_name) {
const gchar* _tmp0_;
gchar* _tmp1_;
g_return_if_fail (self != NULL);
@@ -553,7 +656,7 @@ void simple_scan_set_default_file_name (SimpleScan* self, const gchar* default_f
}
-void simple_scan_authorize (SimpleScan* self, const gchar* resource, gchar** username, gchar** password) {
+void user_interface_authorize (UserInterface* self, const gchar* resource, gchar** username, gchar** password) {
gchar* _vala_username = NULL;
gchar* _vala_password = NULL;
const gchar* _tmp0_ = NULL;
@@ -614,7 +717,7 @@ void simple_scan_authorize (SimpleScan* self, const gchar* resource, gchar** use
}
-void G_MODULE_EXPORT device_combo_changed_cb (GtkWidget* widget, SimpleScan* self) {
+void G_MODULE_EXPORT device_combo_changed_cb (GtkWidget* widget, UserInterface* self) {
gboolean _tmp0_;
g_return_if_fail (self != NULL);
g_return_if_fail (widget != NULL);
@@ -626,7 +729,7 @@ void G_MODULE_EXPORT device_combo_changed_cb (GtkWidget* widget, SimpleScan* sel
}
-static void simple_scan_update_info_bar (SimpleScan* self) {
+static void user_interface_update_info_bar (UserInterface* self) {
GtkMessageType type = 0;
gchar* title = NULL;
gchar* text = NULL;
@@ -741,7 +844,7 @@ static gpointer _scan_device_ref0 (gpointer self) {
}
-void simple_scan_set_scan_devices (SimpleScan* self, GList* devices) {
+void user_interface_set_scan_devices (UserInterface* self, GList* devices) {
gboolean have_selection;
gint index = 0;
GtkTreeIter iter = {0};
@@ -941,11 +1044,11 @@ void simple_scan_set_scan_devices (SimpleScan* self, GList* devices) {
gtk_combo_box_set_active (_tmp56_, 0);
}
self->priv->setting_devices = FALSE;
- simple_scan_update_info_bar (self);
+ user_interface_update_info_bar (self);
}
-static gchar* simple_scan_get_selected_device (SimpleScan* self) {
+static gchar* user_interface_get_selected_device (UserInterface* self) {
gchar* result = NULL;
GtkTreeIter iter = {0};
GtkComboBox* _tmp0_;
@@ -970,7 +1073,7 @@ static gchar* simple_scan_get_selected_device (SimpleScan* self) {
}
-void simple_scan_set_selected_device (SimpleScan* self, const gchar* device) {
+void user_interface_set_selected_device (UserInterface* self, const gchar* device) {
GtkTreeIter iter = {0};
const gchar* _tmp0_;
GtkTreeIter _tmp1_ = {0};
@@ -980,7 +1083,7 @@ void simple_scan_set_selected_device (SimpleScan* self, const gchar* device) {
g_return_if_fail (self != NULL);
g_return_if_fail (device != NULL);
_tmp0_ = device;
- _tmp2_ = simple_scan_find_scan_device (self, _tmp0_, &_tmp1_);
+ _tmp2_ = user_interface_find_scan_device (self, _tmp0_, &_tmp1_);
iter = _tmp1_;
if (!_tmp2_) {
return;
@@ -992,7 +1095,7 @@ void simple_scan_set_selected_device (SimpleScan* self, const gchar* device) {
}
-static void simple_scan_add_default_page (SimpleScan* self) {
+static void user_interface_add_default_page (UserInterface* self) {
Book* _tmp0_;
gint _tmp1_;
gint _tmp2_;
@@ -1120,7 +1223,7 @@ static gchar* string_slice (const gchar* self, glong start, glong end) {
}
-static void simple_scan_on_file_type_changed (SimpleScan* self, GtkTreeSelection* selection) {
+static void user_interface_on_file_type_changed (UserInterface* self, GtkTreeSelection* selection) {
GtkTreeModel* model = NULL;
GtkTreeIter iter = {0};
GtkTreeSelection* _tmp0_;
@@ -1196,12 +1299,12 @@ static void simple_scan_on_file_type_changed (SimpleScan* self, GtkTreeSelection
}
-static void _simple_scan_on_file_type_changed_gtk_tree_selection_changed (GtkTreeSelection* _sender, gpointer self) {
- simple_scan_on_file_type_changed (self, _sender);
+static void _user_interface_on_file_type_changed_gtk_tree_selection_changed (GtkTreeSelection* _sender, gpointer self) {
+ user_interface_on_file_type_changed (self, _sender);
}
-static gchar* simple_scan_choose_file_location (SimpleScan* self) {
+static gchar* user_interface_choose_file_location (UserInterface* self) {
gchar* result = NULL;
gchar* directory;
GSettings* _tmp0_;
@@ -1476,7 +1579,7 @@ static gchar* simple_scan_choose_file_location (SimpleScan* self) {
}
_tmp90_ = file_type_view;
_tmp91_ = gtk_tree_view_get_selection (_tmp90_);
- g_signal_connect (_tmp91_, "changed", (GCallback) _simple_scan_on_file_type_changed_gtk_tree_selection_changed, self);
+ g_signal_connect (_tmp91_, "changed", (GCallback) _user_interface_on_file_type_changed_gtk_tree_selection_changed, self);
_tmp92_ = expander;
gtk_widget_show_all ((GtkWidget*) _tmp92_);
_tmp93_ = self->priv->save_dialog;
@@ -1514,7 +1617,7 @@ static gchar* simple_scan_choose_file_location (SimpleScan* self) {
}
-static gboolean simple_scan_save_document (SimpleScan* self, gboolean force_choose_location) {
+static gboolean user_interface_save_document (UserInterface* self, gboolean force_choose_location) {
gboolean result = FALSE;
gchar* uri = NULL;
gboolean _tmp0_ = FALSE;
@@ -1555,7 +1658,7 @@ static gboolean simple_scan_save_document (SimpleScan* self, gboolean force_choo
uri = _tmp5_;
} else {
gchar* _tmp6_ = NULL;
- _tmp6_ = simple_scan_choose_file_location (self);
+ _tmp6_ = user_interface_choose_file_location (self);
_g_free0 (uri);
uri = _tmp6_;
}
@@ -1569,7 +1672,7 @@ static gboolean simple_scan_save_document (SimpleScan* self, gboolean force_choo
_tmp9_ = g_file_new_for_uri (_tmp8_);
file = _tmp9_;
_tmp10_ = uri;
- g_debug ("ui.vala:445: Saving to '%s'", _tmp10_);
+ g_debug ("ui.vala:446: Saving to '%s'", _tmp10_);
_tmp11_ = uri;
_tmp12_ = g_utf8_strdown (_tmp11_, (gssize) (-1));
uri_lower = _tmp12_;
@@ -1628,6 +1731,7 @@ static gboolean simple_scan_save_document (SimpleScan* self, gboolean force_choo
}
}
}
+ user_interface_show_progress_dialog (self);
{
Book* _tmp30_;
const gchar* _tmp31_;
@@ -1651,13 +1755,14 @@ static gboolean simple_scan_save_document (SimpleScan* self, gboolean force_choo
const gchar* _tmp37_;
e = _inner_error_;
_inner_error_ = NULL;
+ user_interface_hide_progress_dialog (self);
_tmp33_ = e;
_tmp34_ = _tmp33_->message;
- g_warning ("ui.vala:464: Error saving file: %s", _tmp34_);
+ g_warning ("ui.vala:467: Error saving file: %s", _tmp34_);
_tmp35_ = _ ("Failed to save file");
_tmp36_ = e;
_tmp37_ = _tmp36_->message;
- simple_scan_show_error (self, _tmp35_, _tmp37_, FALSE);
+ user_interface_show_error (self, _tmp35_, _tmp37_, FALSE);
result = FALSE;
_g_error_free0 (e);
_g_free0 (format);
@@ -1691,7 +1796,7 @@ static gboolean simple_scan_save_document (SimpleScan* self, gboolean force_choo
}
-static gboolean simple_scan_prompt_to_save (SimpleScan* self, const gchar* title, const gchar* discard_label) {
+static gboolean user_interface_prompt_to_save (UserInterface* self, const gchar* title, const gchar* discard_label) {
gboolean result = FALSE;
Book* _tmp0_;
gboolean _tmp1_ = FALSE;
@@ -1745,7 +1850,7 @@ static gboolean simple_scan_prompt_to_save (SimpleScan* self, const gchar* title
case GTK_RESPONSE_YES:
{
gboolean _tmp16_ = FALSE;
- _tmp16_ = simple_scan_save_document (self, FALSE);
+ _tmp16_ = user_interface_save_document (self, FALSE);
if (_tmp16_) {
result = TRUE;
_g_object_unref0 (dialog);
@@ -1774,14 +1879,14 @@ static gboolean simple_scan_prompt_to_save (SimpleScan* self, const gchar* title
}
-static void simple_scan_clear_document (SimpleScan* self) {
+static void user_interface_clear_document (UserInterface* self) {
Book* _tmp0_;
Book* _tmp1_;
GtkMenuItem* _tmp2_;
g_return_if_fail (self != NULL);
_tmp0_ = self->priv->book;
book_clear (_tmp0_);
- simple_scan_add_default_page (self);
+ user_interface_add_default_page (self);
_g_free0 (self->priv->book_uri);
self->priv->book_uri = NULL;
_tmp1_ = self->priv->book;
@@ -1791,7 +1896,7 @@ static void simple_scan_clear_document (SimpleScan* self) {
}
-void G_MODULE_EXPORT new_button_clicked_cb (GtkWidget* widget, SimpleScan* self) {
+void G_MODULE_EXPORT new_button_clicked_cb (GtkWidget* widget, UserInterface* self) {
const gchar* _tmp0_ = NULL;
const gchar* _tmp1_ = NULL;
gboolean _tmp2_ = FALSE;
@@ -1799,15 +1904,15 @@ void G_MODULE_EXPORT new_button_clicked_cb (GtkWidget* widget, SimpleScan* self)
g_return_if_fail (widget != NULL);
_tmp0_ = _ ("Save current document?");
_tmp1_ = _ ("Discard Changes");
- _tmp2_ = simple_scan_prompt_to_save (self, _tmp0_, _tmp1_);
+ _tmp2_ = user_interface_prompt_to_save (self, _tmp0_, _tmp1_);
if (!_tmp2_) {
return;
}
- simple_scan_clear_document (self);
+ user_interface_clear_document (self);
}
-static void simple_scan_set_document_hint (SimpleScan* self, const gchar* document_hint) {
+static void user_interface_set_document_hint (UserInterface* self, const gchar* document_hint) {
const gchar* _tmp0_;
gchar* _tmp1_;
const gchar* _tmp2_;
@@ -1840,7 +1945,7 @@ static void simple_scan_set_document_hint (SimpleScan* self, const gchar* docume
}
-void G_MODULE_EXPORT text_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleScan* self) {
+void G_MODULE_EXPORT text_menuitem_toggled_cb (GtkCheckMenuItem* widget, UserInterface* self) {
GtkCheckMenuItem* _tmp0_;
gboolean _tmp1_ = FALSE;
g_return_if_fail (self != NULL);
@@ -1848,12 +1953,12 @@ void G_MODULE_EXPORT text_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleS
_tmp0_ = widget;
_tmp1_ = gtk_check_menu_item_get_active (_tmp0_);
if (_tmp1_) {
- simple_scan_set_document_hint (self, "text");
+ user_interface_set_document_hint (self, "text");
}
}
-void G_MODULE_EXPORT photo_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleScan* self) {
+void G_MODULE_EXPORT photo_menuitem_toggled_cb (GtkCheckMenuItem* widget, UserInterface* self) {
GtkCheckMenuItem* _tmp0_;
gboolean _tmp1_ = FALSE;
g_return_if_fail (self != NULL);
@@ -1861,12 +1966,12 @@ void G_MODULE_EXPORT photo_menuitem_toggled_cb (GtkCheckMenuItem* widget, Simple
_tmp0_ = widget;
_tmp1_ = gtk_check_menu_item_get_active (_tmp0_);
if (_tmp1_) {
- simple_scan_set_document_hint (self, "photo");
+ user_interface_set_document_hint (self, "photo");
}
}
-static void simple_scan_set_page_side (SimpleScan* self, ScanType page_side) {
+static void user_interface_set_page_side (UserInterface* self, ScanType page_side) {
GtkTreeIter iter = {0};
GtkListStore* _tmp0_;
GtkTreeIter _tmp1_ = {0};
@@ -1916,7 +2021,7 @@ static void simple_scan_set_page_side (SimpleScan* self, ScanType page_side) {
}
-static void simple_scan_set_paper_size (SimpleScan* self, gint width, gint height) {
+static void user_interface_set_paper_size (UserInterface* self, gint width, gint height) {
GtkTreeIter iter = {0};
gboolean have_iter = FALSE;
gboolean _tmp16_;
@@ -1997,7 +2102,7 @@ static void simple_scan_set_paper_size (SimpleScan* self, gint width, gint heigh
}
-static gint simple_scan_get_text_dpi (SimpleScan* self) {
+static gint user_interface_get_text_dpi (UserInterface* self) {
gint result = 0;
GtkTreeIter iter = {0};
gint dpi;
@@ -2005,7 +2110,7 @@ static gint simple_scan_get_text_dpi (SimpleScan* self) {
GtkTreeIter _tmp1_ = {0};
gboolean _tmp2_ = FALSE;
g_return_val_if_fail (self != NULL, 0);
- dpi = SIMPLE_SCAN_DEFAULT_TEXT_DPI;
+ dpi = USER_INTERFACE_DEFAULT_TEXT_DPI;
_tmp0_ = self->priv->text_dpi_combo;
_tmp2_ = gtk_combo_box_get_active_iter (_tmp0_, &_tmp1_);
iter = _tmp1_;
@@ -2021,7 +2126,7 @@ static gint simple_scan_get_text_dpi (SimpleScan* self) {
}
-static gint simple_scan_get_photo_dpi (SimpleScan* self) {
+static gint user_interface_get_photo_dpi (UserInterface* self) {
gint result = 0;
GtkTreeIter iter = {0};
gint dpi;
@@ -2029,7 +2134,7 @@ static gint simple_scan_get_photo_dpi (SimpleScan* self) {
GtkTreeIter _tmp1_ = {0};
gboolean _tmp2_ = FALSE;
g_return_val_if_fail (self != NULL, 0);
- dpi = SIMPLE_SCAN_DEFAULT_PHOTO_DPI;
+ dpi = USER_INTERFACE_DEFAULT_PHOTO_DPI;
_tmp0_ = self->priv->photo_dpi_combo;
_tmp2_ = gtk_combo_box_get_active_iter (_tmp0_, &_tmp1_);
iter = _tmp1_;
@@ -2045,7 +2150,7 @@ static gint simple_scan_get_photo_dpi (SimpleScan* self) {
}
-static ScanType simple_scan_get_page_side (SimpleScan* self) {
+static ScanType user_interface_get_page_side (UserInterface* self) {
ScanType result = 0;
GtkTreeIter iter = {0};
gint page_side;
@@ -2071,7 +2176,7 @@ static ScanType simple_scan_get_page_side (SimpleScan* self) {
}
-static gboolean simple_scan_get_paper_size (SimpleScan* self, gint* width, gint* height) {
+static gboolean user_interface_get_paper_size (UserInterface* self, gint* width, gint* height) {
gint _vala_width = 0;
gint _vala_height = 0;
gboolean result = FALSE;
@@ -2113,7 +2218,7 @@ static gboolean simple_scan_get_paper_size (SimpleScan* self, gint* width, gint*
}
-static ScanOptions* simple_scan_get_scan_options (SimpleScan* self) {
+static ScanOptions* user_interface_get_scan_options (UserInterface* self) {
ScanOptions* result = NULL;
ScanOptions* _tmp0_;
ScanOptions* options;
@@ -2134,7 +2239,7 @@ static ScanOptions* simple_scan_get_scan_options (SimpleScan* self) {
_tmp2_ = options;
_tmp2_->scan_mode = SCAN_MODE_GRAY;
_tmp3_ = options;
- _tmp4_ = simple_scan_get_text_dpi (self);
+ _tmp4_ = user_interface_get_text_dpi (self);
_tmp3_->dpi = _tmp4_;
_tmp5_ = options;
_tmp5_->depth = 2;
@@ -2146,14 +2251,14 @@ static ScanOptions* simple_scan_get_scan_options (SimpleScan* self) {
_tmp6_ = options;
_tmp6_->scan_mode = SCAN_MODE_COLOR;
_tmp7_ = options;
- _tmp8_ = simple_scan_get_photo_dpi (self);
+ _tmp8_ = user_interface_get_photo_dpi (self);
_tmp7_->dpi = _tmp8_;
_tmp9_ = options;
_tmp9_->depth = 8;
}
_tmp10_ = options;
_tmp11_ = options;
- simple_scan_get_paper_size (self, &_tmp12_, &_tmp13_);
+ user_interface_get_paper_size (self, &_tmp12_, &_tmp13_);
_tmp10_->paper_width = _tmp12_;
_tmp11_->paper_height = _tmp13_;
result = options;
@@ -2161,17 +2266,17 @@ static ScanOptions* simple_scan_get_scan_options (SimpleScan* self) {
}
-void G_MODULE_EXPORT scan_button_clicked_cb (GtkWidget* widget, SimpleScan* self) {
+void G_MODULE_EXPORT scan_button_clicked_cb (GtkWidget* widget, UserInterface* self) {
ScanOptions* _tmp0_ = NULL;
ScanOptions* options;
gchar* _tmp1_ = NULL;
gchar* _tmp2_;
g_return_if_fail (self != NULL);
g_return_if_fail (widget != NULL);
- _tmp0_ = simple_scan_get_scan_options (self);
+ _tmp0_ = user_interface_get_scan_options (self);
options = _tmp0_;
options->type = SCAN_TYPE_SINGLE;
- _tmp1_ = simple_scan_get_selected_device (self);
+ _tmp1_ = user_interface_get_selected_device (self);
_tmp2_ = _tmp1_;
g_signal_emit_by_name (self, "start-scan", _tmp2_, options);
_g_free0 (_tmp2_);
@@ -2179,14 +2284,14 @@ void G_MODULE_EXPORT scan_button_clicked_cb (GtkWidget* widget, SimpleScan* self
}
-void G_MODULE_EXPORT stop_scan_button_clicked_cb (GtkWidget* widget, SimpleScan* self) {
+void G_MODULE_EXPORT stop_scan_button_clicked_cb (GtkWidget* widget, UserInterface* self) {
g_return_if_fail (self != NULL);
g_return_if_fail (widget != NULL);
g_signal_emit_by_name (self, "stop-scan");
}
-void G_MODULE_EXPORT continuous_scan_button_clicked_cb (GtkWidget* widget, SimpleScan* self) {
+void G_MODULE_EXPORT continuous_scan_button_clicked_cb (GtkWidget* widget, UserInterface* self) {
gboolean _tmp0_;
g_return_if_fail (self != NULL);
g_return_if_fail (widget != NULL);
@@ -2201,12 +2306,12 @@ void G_MODULE_EXPORT continuous_scan_button_clicked_cb (GtkWidget* widget, Simpl
gchar* _tmp4_ = NULL;
gchar* _tmp5_;
ScanOptions* _tmp6_;
- _tmp1_ = simple_scan_get_scan_options (self);
+ _tmp1_ = user_interface_get_scan_options (self);
options = _tmp1_;
_tmp2_ = options;
- _tmp3_ = simple_scan_get_page_side (self);
+ _tmp3_ = user_interface_get_page_side (self);
_tmp2_->type = _tmp3_;
- _tmp4_ = simple_scan_get_selected_device (self);
+ _tmp4_ = user_interface_get_selected_device (self);
_tmp5_ = _tmp4_;
_tmp6_ = options;
g_signal_emit_by_name (self, "start-scan", _tmp5_, _tmp6_);
@@ -2216,7 +2321,7 @@ void G_MODULE_EXPORT continuous_scan_button_clicked_cb (GtkWidget* widget, Simpl
}
-void G_MODULE_EXPORT preferences_button_clicked_cb (GtkWidget* widget, SimpleScan* self) {
+void G_MODULE_EXPORT preferences_button_clicked_cb (GtkWidget* widget, UserInterface* self) {
GtkDialog* _tmp0_;
g_return_if_fail (self != NULL);
g_return_if_fail (widget != NULL);
@@ -2225,7 +2330,7 @@ void G_MODULE_EXPORT preferences_button_clicked_cb (GtkWidget* widget, SimpleSca
}
-gboolean G_MODULE_EXPORT preferences_dialog_delete_event_cb (GtkWidget* widget, SimpleScan* self) {
+gboolean G_MODULE_EXPORT preferences_dialog_delete_event_cb (GtkWidget* widget, UserInterface* self) {
gboolean result = FALSE;
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (widget != NULL, FALSE);
@@ -2234,7 +2339,7 @@ gboolean G_MODULE_EXPORT preferences_dialog_delete_event_cb (GtkWidget* widget,
}
-void G_MODULE_EXPORT preferences_dialog_response_cb (GtkWidget* widget, gint response_id, SimpleScan* self) {
+void G_MODULE_EXPORT preferences_dialog_response_cb (GtkWidget* widget, gint response_id, UserInterface* self) {
GtkDialog* _tmp0_;
g_return_if_fail (self != NULL);
g_return_if_fail (widget != NULL);
@@ -2243,7 +2348,7 @@ void G_MODULE_EXPORT preferences_dialog_response_cb (GtkWidget* widget, gint res
}
-static void simple_scan_update_page_menu (SimpleScan* self) {
+static void user_interface_update_page_menu (UserInterface* self) {
BookView* _tmp0_;
Page* _tmp1_ = NULL;
Page* page;
@@ -2288,7 +2393,7 @@ static void simple_scan_update_page_menu (SimpleScan* self) {
}
-static void simple_scan_page_selected_cb (SimpleScan* self, BookView* view, Page* page) {
+static void user_interface_page_selected_cb (UserInterface* self, BookView* view, Page* page) {
Page* _tmp0_;
gchar* name;
Page* _tmp1_;
@@ -2313,7 +2418,7 @@ static void simple_scan_page_selected_cb (SimpleScan* self, BookView* view, Page
return;
}
self->priv->updating_page_menu = TRUE;
- simple_scan_update_page_menu (self);
+ user_interface_update_page_menu (self);
name = NULL;
_tmp1_ = page;
_tmp2_ = page_has_crop (_tmp1_);
@@ -2415,70 +2520,7 @@ static void simple_scan_page_selected_cb (SimpleScan* self, BookView* view, Page
}
-static gchar* simple_scan_get_temporary_filename (SimpleScan* self, const gchar* prefix, const gchar* extension) {
- gchar* result = NULL;
- const gchar* _tmp0_;
- const gchar* _tmp1_;
- gchar* _tmp2_ = NULL;
- gchar* filename;
- gchar* path = NULL;
- GError * _inner_error_ = NULL;
- g_return_val_if_fail (self != NULL, NULL);
- g_return_val_if_fail (prefix != NULL, NULL);
- g_return_val_if_fail (extension != NULL, NULL);
- _tmp0_ = prefix;
- _tmp1_ = extension;
- _tmp2_ = g_strdup_printf ("%sXXXXXX.%s", _tmp0_, _tmp1_);
- filename = _tmp2_;
- {
- const gchar* _tmp3_;
- gchar* _tmp4_ = NULL;
- gint _tmp5_ = 0;
- gint fd;
- gint _tmp6_;
- _tmp3_ = filename;
- _tmp5_ = g_file_open_tmp (_tmp3_, &_tmp4_, &_inner_error_);
- _g_free0 (path);
- path = _tmp4_;
- fd = _tmp5_;
- if (_inner_error_ != NULL) {
- goto __catch16_g_error;
- }
- _tmp6_ = fd;
- close (_tmp6_);
- }
- goto __finally16;
- __catch16_g_error:
- {
- GError* e = NULL;
- GError* _tmp7_;
- const gchar* _tmp8_;
- e = _inner_error_;
- _inner_error_ = NULL;
- _tmp7_ = e;
- _tmp8_ = _tmp7_->message;
- g_warning ("ui.vala:789: Error saving email attachment: %s", _tmp8_);
- result = NULL;
- _g_error_free0 (e);
- _g_free0 (path);
- _g_free0 (filename);
- return result;
- }
- __finally16:
- if (_inner_error_ != NULL) {
- _g_free0 (path);
- _g_free0 (filename);
- 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);
- g_clear_error (&_inner_error_);
- return NULL;
- }
- result = path;
- _g_free0 (filename);
- return result;
-}
-
-
-static void simple_scan_show_page_cb (SimpleScan* self, BookView* view, Page* page) {
+static void user_interface_show_page_cb (UserInterface* self, BookView* view, Page* page) {
gchar* _tmp0_ = NULL;
gchar* path;
const gchar* _tmp1_;
@@ -2489,7 +2531,7 @@ static void simple_scan_show_page_cb (SimpleScan* self, BookView* view, Page* pa
g_return_if_fail (self != NULL);
g_return_if_fail (view != NULL);
g_return_if_fail (page != NULL);
- _tmp0_ = simple_scan_get_temporary_filename (self, "scanned-page", "tiff");
+ _tmp0_ = get_temporary_filename ("scanned-page", "tiff");
path = _tmp0_;
_tmp1_ = path;
if (_tmp1_ == NULL) {
@@ -2506,11 +2548,11 @@ static void simple_scan_show_page_cb (SimpleScan* self, BookView* view, Page* pa
_tmp5_ = file;
page_save (_tmp4_, "tiff", _tmp5_, &_inner_error_);
if (_inner_error_ != NULL) {
- goto __catch17_g_error;
+ goto __catch16_g_error;
}
}
- goto __finally17;
- __catch17_g_error:
+ goto __finally16;
+ __catch16_g_error:
{
GError* e = NULL;
const gchar* _tmp6_ = NULL;
@@ -2521,13 +2563,13 @@ static void simple_scan_show_page_cb (SimpleScan* self, BookView* view, Page* pa
_tmp6_ = _ ("Unable to save image for preview");
_tmp7_ = e;
_tmp8_ = _tmp7_->message;
- simple_scan_show_error_dialog (self, _tmp6_, _tmp8_);
+ user_interface_show_error_dialog (self, _tmp6_, _tmp8_);
_g_error_free0 (e);
_g_object_unref0 (file);
_g_free0 (path);
return;
}
- __finally17:
+ __finally16:
if (_inner_error_ != NULL) {
_g_object_unref0 (file);
_g_free0 (path);
@@ -2551,11 +2593,11 @@ static void simple_scan_show_page_cb (SimpleScan* self, BookView* view, Page* pa
gtk_show_uri (_tmp10_, _tmp13_, _tmp14_, &_inner_error_);
_g_free0 (_tmp13_);
if (_inner_error_ != NULL) {
- goto __catch18_g_error;
+ goto __catch17_g_error;
}
}
- goto __finally18;
- __catch18_g_error:
+ goto __finally17;
+ __catch17_g_error:
{
GError* e = NULL;
const gchar* _tmp15_ = NULL;
@@ -2566,10 +2608,10 @@ static void simple_scan_show_page_cb (SimpleScan* self, BookView* view, Page* pa
_tmp15_ = _ ("Unable to open image preview application");
_tmp16_ = e;
_tmp17_ = _tmp16_->message;
- simple_scan_show_error_dialog (self, _tmp15_, _tmp17_);
+ user_interface_show_error_dialog (self, _tmp15_, _tmp17_);
_g_error_free0 (e);
}
- __finally18:
+ __finally17:
if (_inner_error_ != NULL) {
_g_object_unref0 (file);
_g_free0 (path);
@@ -2582,7 +2624,7 @@ static void simple_scan_show_page_cb (SimpleScan* self, BookView* view, Page* pa
}
-static void simple_scan_show_page_menu_cb (SimpleScan* self, BookView* view) {
+static void user_interface_show_page_menu_cb (UserInterface* self, BookView* view) {
GtkBuilder* _tmp0_;
GObject* _tmp1_ = NULL;
GtkMenu* _tmp2_;
@@ -2600,7 +2642,7 @@ static void simple_scan_show_page_menu_cb (SimpleScan* self, BookView* view) {
}
-void G_MODULE_EXPORT rotate_left_button_clicked_cb (GtkWidget* widget, SimpleScan* self) {
+void G_MODULE_EXPORT rotate_left_button_clicked_cb (GtkWidget* widget, UserInterface* self) {
gboolean _tmp0_;
BookView* _tmp1_;
Page* _tmp2_ = NULL;
@@ -2625,7 +2667,7 @@ void G_MODULE_EXPORT rotate_left_button_clicked_cb (GtkWidget* widget, SimpleSca
}
-void G_MODULE_EXPORT rotate_right_button_clicked_cb (GtkWidget* widget, SimpleScan* self) {
+void G_MODULE_EXPORT rotate_right_button_clicked_cb (GtkWidget* widget, UserInterface* self) {
gboolean _tmp0_;
BookView* _tmp1_;
Page* _tmp2_ = NULL;
@@ -2650,7 +2692,7 @@ void G_MODULE_EXPORT rotate_right_button_clicked_cb (GtkWidget* widget, SimpleSc
}
-static void simple_scan_set_crop (SimpleScan* self, const gchar* crop_name) {
+static void user_interface_set_crop (UserInterface* self, const gchar* crop_name) {
GtkMenuItem* _tmp0_;
const gchar* _tmp1_;
gboolean _tmp2_;
@@ -2736,7 +2778,7 @@ static void simple_scan_set_crop (SimpleScan* self, const gchar* crop_name) {
}
-void G_MODULE_EXPORT no_crop_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleScan* self) {
+void G_MODULE_EXPORT no_crop_menuitem_toggled_cb (GtkCheckMenuItem* widget, UserInterface* self) {
GtkCheckMenuItem* _tmp0_;
gboolean _tmp1_ = FALSE;
g_return_if_fail (self != NULL);
@@ -2744,12 +2786,12 @@ void G_MODULE_EXPORT no_crop_menuitem_toggled_cb (GtkCheckMenuItem* widget, Simp
_tmp0_ = widget;
_tmp1_ = gtk_check_menu_item_get_active (_tmp0_);
if (_tmp1_) {
- simple_scan_set_crop (self, NULL);
+ user_interface_set_crop (self, NULL);
}
}
-void G_MODULE_EXPORT custom_crop_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleScan* self) {
+void G_MODULE_EXPORT custom_crop_menuitem_toggled_cb (GtkCheckMenuItem* widget, UserInterface* self) {
GtkCheckMenuItem* _tmp0_;
gboolean _tmp1_ = FALSE;
g_return_if_fail (self != NULL);
@@ -2757,12 +2799,12 @@ void G_MODULE_EXPORT custom_crop_menuitem_toggled_cb (GtkCheckMenuItem* widget,
_tmp0_ = widget;
_tmp1_ = gtk_check_menu_item_get_active (_tmp0_);
if (_tmp1_) {
- simple_scan_set_crop (self, "custom");
+ user_interface_set_crop (self, "custom");
}
}
-void G_MODULE_EXPORT crop_toolbutton_toggled_cb (GtkToggleToolButton* widget, SimpleScan* self) {
+void G_MODULE_EXPORT crop_toolbutton_toggled_cb (GtkToggleToolButton* widget, UserInterface* self) {
gboolean _tmp0_;
GtkRadioMenuItem* menuitem = NULL;
GtkToggleToolButton* _tmp1_;
@@ -2801,7 +2843,7 @@ void G_MODULE_EXPORT crop_toolbutton_toggled_cb (GtkToggleToolButton* widget, Si
}
-void G_MODULE_EXPORT four_by_six_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleScan* self) {
+void G_MODULE_EXPORT four_by_six_menuitem_toggled_cb (GtkCheckMenuItem* widget, UserInterface* self) {
GtkCheckMenuItem* _tmp0_;
gboolean _tmp1_ = FALSE;
g_return_if_fail (self != NULL);
@@ -2809,12 +2851,12 @@ void G_MODULE_EXPORT four_by_six_menuitem_toggled_cb (GtkCheckMenuItem* widget,
_tmp0_ = widget;
_tmp1_ = gtk_check_menu_item_get_active (_tmp0_);
if (_tmp1_) {
- simple_scan_set_crop (self, "4x6");
+ user_interface_set_crop (self, "4x6");
}
}
-void G_MODULE_EXPORT legal_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleScan* self) {
+void G_MODULE_EXPORT legal_menuitem_toggled_cb (GtkCheckMenuItem* widget, UserInterface* self) {
GtkCheckMenuItem* _tmp0_;
gboolean _tmp1_ = FALSE;
g_return_if_fail (self != NULL);
@@ -2822,12 +2864,12 @@ void G_MODULE_EXPORT legal_menuitem_toggled_cb (GtkCheckMenuItem* widget, Simple
_tmp0_ = widget;
_tmp1_ = gtk_check_menu_item_get_active (_tmp0_);
if (_tmp1_) {
- simple_scan_set_crop (self, "legal");
+ user_interface_set_crop (self, "legal");
}
}
-void G_MODULE_EXPORT letter_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleScan* self) {
+void G_MODULE_EXPORT letter_menuitem_toggled_cb (GtkCheckMenuItem* widget, UserInterface* self) {
GtkCheckMenuItem* _tmp0_;
gboolean _tmp1_ = FALSE;
g_return_if_fail (self != NULL);
@@ -2835,12 +2877,12 @@ void G_MODULE_EXPORT letter_menuitem_toggled_cb (GtkCheckMenuItem* widget, Simpl
_tmp0_ = widget;
_tmp1_ = gtk_check_menu_item_get_active (_tmp0_);
if (_tmp1_) {
- simple_scan_set_crop (self, "letter");
+ user_interface_set_crop (self, "letter");
}
}
-void G_MODULE_EXPORT a6_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleScan* self) {
+void G_MODULE_EXPORT a6_menuitem_toggled_cb (GtkCheckMenuItem* widget, UserInterface* self) {
GtkCheckMenuItem* _tmp0_;
gboolean _tmp1_ = FALSE;
g_return_if_fail (self != NULL);
@@ -2848,12 +2890,12 @@ void G_MODULE_EXPORT a6_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleSca
_tmp0_ = widget;
_tmp1_ = gtk_check_menu_item_get_active (_tmp0_);
if (_tmp1_) {
- simple_scan_set_crop (self, "A6");
+ user_interface_set_crop (self, "A6");
}
}
-void G_MODULE_EXPORT a5_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleScan* self) {
+void G_MODULE_EXPORT a5_menuitem_toggled_cb (GtkCheckMenuItem* widget, UserInterface* self) {
GtkCheckMenuItem* _tmp0_;
gboolean _tmp1_ = FALSE;
g_return_if_fail (self != NULL);
@@ -2861,12 +2903,12 @@ void G_MODULE_EXPORT a5_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleSca
_tmp0_ = widget;
_tmp1_ = gtk_check_menu_item_get_active (_tmp0_);
if (_tmp1_) {
- simple_scan_set_crop (self, "A5");
+ user_interface_set_crop (self, "A5");
}
}
-void G_MODULE_EXPORT a4_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleScan* self) {
+void G_MODULE_EXPORT a4_menuitem_toggled_cb (GtkCheckMenuItem* widget, UserInterface* self) {
GtkCheckMenuItem* _tmp0_;
gboolean _tmp1_ = FALSE;
g_return_if_fail (self != NULL);
@@ -2874,12 +2916,12 @@ void G_MODULE_EXPORT a4_menuitem_toggled_cb (GtkCheckMenuItem* widget, SimpleSca
_tmp0_ = widget;
_tmp1_ = gtk_check_menu_item_get_active (_tmp0_);
if (_tmp1_) {
- simple_scan_set_crop (self, "A4");
+ user_interface_set_crop (self, "A4");
}
}
-void G_MODULE_EXPORT crop_rotate_menuitem_activate_cb (GtkWidget* widget, SimpleScan* self) {
+void G_MODULE_EXPORT crop_rotate_menuitem_activate_cb (GtkWidget* widget, UserInterface* self) {
BookView* _tmp0_;
Page* _tmp1_ = NULL;
Page* page;
@@ -2901,7 +2943,7 @@ void G_MODULE_EXPORT crop_rotate_menuitem_activate_cb (GtkWidget* widget, Simple
}
-void G_MODULE_EXPORT page_move_left_menuitem_activate_cb (GtkWidget* widget, SimpleScan* self) {
+void G_MODULE_EXPORT page_move_left_menuitem_activate_cb (GtkWidget* widget, UserInterface* self) {
BookView* _tmp0_;
Page* _tmp1_ = NULL;
Page* page;
@@ -2929,12 +2971,12 @@ void G_MODULE_EXPORT page_move_left_menuitem_activate_cb (GtkWidget* widget, Sim
_tmp8_ = index;
book_move_page (_tmp6_, _tmp7_, _tmp8_ - 1);
}
- simple_scan_update_page_menu (self);
+ user_interface_update_page_menu (self);
_page_unref0 (page);
}
-void G_MODULE_EXPORT page_move_right_menuitem_activate_cb (GtkWidget* widget, SimpleScan* self) {
+void G_MODULE_EXPORT page_move_right_menuitem_activate_cb (GtkWidget* widget, UserInterface* self) {
BookView* _tmp0_;
Page* _tmp1_ = NULL;
Page* page;
@@ -2970,12 +3012,12 @@ void G_MODULE_EXPORT page_move_right_menuitem_activate_cb (GtkWidget* widget, Si
_tmp12_ = book_get_page_index (_tmp10_, _tmp11_);
book_move_page (_tmp8_, _tmp9_, _tmp12_ + 1);
}
- simple_scan_update_page_menu (self);
+ user_interface_update_page_menu (self);
_page_unref0 (page);
}
-void G_MODULE_EXPORT page_delete_menuitem_activate_cb (GtkWidget* widget, SimpleScan* self) {
+void G_MODULE_EXPORT page_delete_menuitem_activate_cb (GtkWidget* widget, UserInterface* self) {
BookView* _tmp0_;
Book* _tmp1_ = NULL;
Book* _tmp2_;
@@ -2996,17 +3038,17 @@ void G_MODULE_EXPORT page_delete_menuitem_activate_cb (GtkWidget* widget, Simple
}
-void G_MODULE_EXPORT save_file_button_clicked_cb (GtkWidget* widget, SimpleScan* self) {
+void G_MODULE_EXPORT save_file_button_clicked_cb (GtkWidget* widget, UserInterface* self) {
g_return_if_fail (self != NULL);
g_return_if_fail (widget != NULL);
- simple_scan_save_document (self, FALSE);
+ user_interface_save_document (self, FALSE);
}
-void G_MODULE_EXPORT save_as_file_button_clicked_cb (GtkWidget* widget, SimpleScan* self) {
+void G_MODULE_EXPORT save_as_file_button_clicked_cb (GtkWidget* widget, UserInterface* self) {
g_return_if_fail (self != NULL);
g_return_if_fail (widget != NULL);
- simple_scan_save_document (self, TRUE);
+ user_interface_save_document (self, TRUE);
}
@@ -3015,7 +3057,7 @@ static gpointer _cairo_reference0 (gpointer self) {
}
-static void simple_scan_draw_page (SimpleScan* self, GtkPrintOperation* operation, GtkPrintContext* print_context, gint page_number) {
+static void user_interface_draw_page (UserInterface* self, GtkPrintOperation* operation, GtkPrintContext* print_context, gint page_number) {
GtkPrintContext* _tmp0_;
cairo_t* _tmp1_ = NULL;
cairo_t* _tmp2_;
@@ -3103,7 +3145,7 @@ static void simple_scan_draw_page (SimpleScan* self, GtkPrintOperation* operatio
}
-void G_MODULE_EXPORT email_button_clicked_cb (GtkWidget* widget, SimpleScan* self) {
+void G_MODULE_EXPORT email_button_clicked_cb (GtkWidget* widget, UserInterface* self) {
const gchar* _tmp0_;
g_return_if_fail (self != NULL);
g_return_if_fail (widget != NULL);
@@ -3112,12 +3154,12 @@ void G_MODULE_EXPORT email_button_clicked_cb (GtkWidget* widget, SimpleScan* sel
}
-static void _simple_scan_draw_page_gtk_print_operation_draw_page (GtkPrintOperation* _sender, GtkPrintContext* context, gint page_nr, gpointer self) {
- simple_scan_draw_page (self, _sender, context, page_nr);
+static void _user_interface_draw_page_gtk_print_operation_draw_page (GtkPrintOperation* _sender, GtkPrintContext* context, gint page_nr, gpointer self) {
+ user_interface_draw_page (self, _sender, context, page_nr);
}
-void G_MODULE_EXPORT print_button_clicked_cb (GtkWidget* widget, SimpleScan* self) {
+void G_MODULE_EXPORT print_button_clicked_cb (GtkWidget* widget, UserInterface* self) {
GtkPrintOperation* _tmp0_;
GtkPrintOperation* print;
Book* _tmp1_;
@@ -3130,17 +3172,17 @@ void G_MODULE_EXPORT print_button_clicked_cb (GtkWidget* widget, SimpleScan* sel
_tmp1_ = self->priv->book;
_tmp2_ = book_get_n_pages (_tmp1_);
gtk_print_operation_set_n_pages (print, (gint) _tmp2_);
- g_signal_connect (print, "draw-page", (GCallback) _simple_scan_draw_page_gtk_print_operation_draw_page, self);
+ g_signal_connect (print, "draw-page", (GCallback) _user_interface_draw_page_gtk_print_operation_draw_page, self);
{
GtkWindow* _tmp3_;
_tmp3_ = self->priv->window;
gtk_print_operation_run (print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, _tmp3_, &_inner_error_);
if (_inner_error_ != NULL) {
- goto __catch19_g_error;
+ goto __catch18_g_error;
}
}
- goto __finally19;
- __catch19_g_error:
+ goto __finally18;
+ __catch18_g_error:
{
GError* e = NULL;
GError* _tmp4_;
@@ -3149,10 +3191,10 @@ void G_MODULE_EXPORT print_button_clicked_cb (GtkWidget* widget, SimpleScan* sel
_inner_error_ = NULL;
_tmp4_ = e;
_tmp5_ = _tmp4_->message;
- g_warning ("ui.vala:1045: Error printing: %s", _tmp5_);
+ g_warning ("ui.vala:1026: Error printing: %s", _tmp5_);
_g_error_free0 (e);
}
- __finally19:
+ __finally18:
if (_inner_error_ != NULL) {
_g_object_unref0 (print);
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);
@@ -3163,7 +3205,7 @@ void G_MODULE_EXPORT print_button_clicked_cb (GtkWidget* widget, SimpleScan* sel
}
-void G_MODULE_EXPORT help_contents_menuitem_activate_cb (GtkWidget* widget, SimpleScan* self) {
+void G_MODULE_EXPORT help_contents_menuitem_activate_cb (GtkWidget* widget, UserInterface* self) {
GError * _inner_error_ = NULL;
g_return_if_fail (self != NULL);
g_return_if_fail (widget != NULL);
@@ -3176,11 +3218,11 @@ void G_MODULE_EXPORT help_contents_menuitem_activate_cb (GtkWidget* widget, Simp
_tmp2_ = gtk_get_current_event_time ();
gtk_show_uri (_tmp1_, "help:simple-scan", _tmp2_, &_inner_error_);
if (_inner_error_ != NULL) {
- goto __catch20_g_error;
+ goto __catch19_g_error;
}
}
- goto __finally20;
- __catch20_g_error:
+ goto __finally19;
+ __catch19_g_error:
{
GError* e = NULL;
const gchar* _tmp3_ = NULL;
@@ -3191,10 +3233,10 @@ void G_MODULE_EXPORT help_contents_menuitem_activate_cb (GtkWidget* widget, Simp
_tmp3_ = _ ("Unable to open help file");
_tmp4_ = e;
_tmp5_ = _tmp4_->message;
- simple_scan_show_error_dialog (self, _tmp3_, _tmp5_);
+ user_interface_show_error_dialog (self, _tmp3_, _tmp5_);
_g_error_free0 (e);
}
- __finally20:
+ __finally19:
if (_inner_error_ != NULL) {
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);
g_clear_error (&_inner_error_);
@@ -3203,7 +3245,7 @@ void G_MODULE_EXPORT help_contents_menuitem_activate_cb (GtkWidget* widget, Simp
}
-void G_MODULE_EXPORT about_menuitem_activate_cb (GtkWidget* widget, SimpleScan* self) {
+void G_MODULE_EXPORT about_menuitem_activate_cb (GtkWidget* widget, UserInterface* self) {
gchar* _tmp0_;
gchar** _tmp1_ = NULL;
gchar** authors;
@@ -3258,7 +3300,7 @@ void G_MODULE_EXPORT about_menuitem_activate_cb (GtkWidget* widget, SimpleScan*
}
-static gboolean simple_scan_on_quit (SimpleScan* self) {
+static gboolean user_interface_on_quit (UserInterface* self) {
gboolean result = FALSE;
const gchar* _tmp0_ = NULL;
const gchar* _tmp1_ = NULL;
@@ -3296,19 +3338,20 @@ static gboolean simple_scan_on_quit (SimpleScan* self) {
gint _tmp32_;
GSettings* _tmp33_;
gint _tmp34_;
+ GtkWindow* _tmp35_;
g_return_val_if_fail (self != NULL, FALSE);
_tmp0_ = _ ("Save document before quitting?");
_tmp1_ = _ ("Quit without Saving");
- _tmp2_ = simple_scan_prompt_to_save (self, _tmp0_, _tmp1_);
+ _tmp2_ = user_interface_prompt_to_save (self, _tmp0_, _tmp1_);
if (!_tmp2_) {
result = FALSE;
return result;
}
- _tmp3_ = simple_scan_get_selected_device (self);
+ _tmp3_ = user_interface_get_selected_device (self);
device = _tmp3_;
paper_width = 0;
paper_height = 0;
- simple_scan_get_paper_size (self, &_tmp4_, &_tmp5_);
+ user_interface_get_paper_size (self, &_tmp4_, &_tmp5_);
paper_width = _tmp4_;
paper_height = _tmp5_;
_tmp6_ = device;
@@ -3323,13 +3366,13 @@ static gboolean simple_scan_on_quit (SimpleScan* self) {
_tmp10_ = self->priv->document_hint;
g_settings_set_string (_tmp9_, "document-type", _tmp10_);
_tmp11_ = self->priv->settings;
- _tmp12_ = simple_scan_get_text_dpi (self);
+ _tmp12_ = user_interface_get_text_dpi (self);
g_settings_set_int (_tmp11_, "text-dpi", _tmp12_);
_tmp13_ = self->priv->settings;
- _tmp14_ = simple_scan_get_photo_dpi (self);
+ _tmp14_ = user_interface_get_photo_dpi (self);
g_settings_set_int (_tmp13_, "photo-dpi", _tmp14_);
_tmp15_ = self->priv->settings;
- _tmp16_ = simple_scan_get_page_side (self);
+ _tmp16_ = user_interface_get_page_side (self);
g_settings_set_enum (_tmp15_, "page-side", (gint) _tmp16_);
_tmp17_ = self->priv->settings;
_tmp18_ = paper_width;
@@ -3358,21 +3401,22 @@ static gboolean simple_scan_on_quit (SimpleScan* self) {
_tmp33_ = self->priv->settings;
_tmp34_ = self->priv->default_page_dpi;
g_settings_set_int (_tmp33_, "page-dpi", _tmp34_);
- g_signal_emit_by_name (self, "quit");
+ _tmp35_ = self->priv->window;
+ gtk_widget_destroy ((GtkWidget*) _tmp35_);
result = TRUE;
_g_free0 (device);
return result;
}
-void G_MODULE_EXPORT quit_menuitem_activate_cb (GtkWidget* widget, SimpleScan* self) {
+void G_MODULE_EXPORT quit_menuitem_activate_cb (GtkWidget* widget, UserInterface* self) {
g_return_if_fail (self != NULL);
g_return_if_fail (widget != NULL);
- simple_scan_on_quit (self);
+ user_interface_on_quit (self);
}
-gboolean G_MODULE_EXPORT simple_scan_window_configure_event_cb (GtkWidget* widget, GdkEventConfigure* event, SimpleScan* self) {
+gboolean G_MODULE_EXPORT simple_scan_window_configure_event_cb (GtkWidget* widget, GdkEventConfigure* event, UserInterface* self) {
gboolean result = FALSE;
gboolean _tmp0_;
g_return_val_if_fail (self != NULL, FALSE);
@@ -3396,7 +3440,7 @@ gboolean G_MODULE_EXPORT simple_scan_window_configure_event_cb (GtkWidget* widge
}
-static void simple_scan_info_bar_response_cb (SimpleScan* self, GtkInfoBar* widget, gint response_id) {
+static void user_interface_info_bar_response_cb (UserInterface* self, GtkInfoBar* widget, gint response_id) {
gint _tmp0_;
g_return_if_fail (self != NULL);
g_return_if_fail (widget != NULL);
@@ -3414,12 +3458,12 @@ static void simple_scan_info_bar_response_cb (SimpleScan* self, GtkInfoBar* widg
self->priv->error_title = NULL;
_g_free0 (self->priv->error_text);
self->priv->error_text = NULL;
- simple_scan_update_info_bar (self);
+ user_interface_update_info_bar (self);
}
}
-gboolean G_MODULE_EXPORT simple_scan_window_window_state_event_cb (GtkWidget* widget, GdkEventWindowState* event, SimpleScan* self) {
+gboolean G_MODULE_EXPORT simple_scan_window_window_state_event_cb (GtkWidget* widget, GdkEventWindowState* event, UserInterface* self) {
gboolean result = FALSE;
GdkEventWindowState _tmp0_;
GdkWindowState _tmp1_;
@@ -3440,19 +3484,19 @@ gboolean G_MODULE_EXPORT simple_scan_window_window_state_event_cb (GtkWidget* wi
}
-gboolean G_MODULE_EXPORT window_delete_event_cb (GtkWidget* widget, GdkEvent* event, SimpleScan* self) {
+gboolean G_MODULE_EXPORT window_delete_event_cb (GtkWidget* widget, GdkEvent* event, UserInterface* self) {
gboolean result = FALSE;
gboolean _tmp0_ = FALSE;
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (event != NULL, FALSE);
- _tmp0_ = simple_scan_on_quit (self);
+ _tmp0_ = user_interface_on_quit (self);
result = !_tmp0_;
return result;
}
-static void simple_scan_page_size_changed_cb (SimpleScan* self, Page* page) {
+static void user_interface_page_size_changed_cb (UserInterface* self, Page* page) {
Page* _tmp0_;
gint _tmp1_ = 0;
Page* _tmp2_;
@@ -3473,7 +3517,7 @@ static void simple_scan_page_size_changed_cb (SimpleScan* self, Page* page) {
}
-static void simple_scan_page_scan_direction_changed_cb (SimpleScan* self, Page* page) {
+static void user_interface_page_scan_direction_changed_cb (UserInterface* self, Page* page) {
Page* _tmp0_;
ScanDirection _tmp1_ = 0;
g_return_if_fail (self != NULL);
@@ -3484,17 +3528,17 @@ static void simple_scan_page_scan_direction_changed_cb (SimpleScan* self, Page*
}
-static void _simple_scan_page_size_changed_cb_page_size_changed (Page* _sender, gpointer self) {
- simple_scan_page_size_changed_cb (self, _sender);
+static void _user_interface_page_size_changed_cb_page_size_changed (Page* _sender, gpointer self) {
+ user_interface_page_size_changed_cb (self, _sender);
}
-static void _simple_scan_page_scan_direction_changed_cb_page_scan_direction_changed (Page* _sender, gpointer self) {
- simple_scan_page_scan_direction_changed_cb (self, _sender);
+static void _user_interface_page_scan_direction_changed_cb_page_scan_direction_changed (Page* _sender, gpointer self) {
+ user_interface_page_scan_direction_changed_cb (self, _sender);
}
-static void simple_scan_page_added_cb (SimpleScan* self, Book* book, Page* page) {
+static void user_interface_page_added_cb (UserInterface* self, Book* book, Page* page) {
Page* _tmp0_;
gint _tmp1_ = 0;
Page* _tmp2_;
@@ -3521,14 +3565,14 @@ static void simple_scan_page_added_cb (SimpleScan* self, Book* book, Page* page)
_tmp7_ = page_get_scan_direction (_tmp6_);
self->priv->default_page_scan_direction = _tmp7_;
_tmp8_ = page;
- g_signal_connect (_tmp8_, "size-changed", (GCallback) _simple_scan_page_size_changed_cb_page_size_changed, self);
+ g_signal_connect (_tmp8_, "size-changed", (GCallback) _user_interface_page_size_changed_cb_page_size_changed, self);
_tmp9_ = page;
- g_signal_connect (_tmp9_, "scan-direction-changed", (GCallback) _simple_scan_page_scan_direction_changed_cb_page_scan_direction_changed, self);
- simple_scan_update_page_menu (self);
+ g_signal_connect (_tmp9_, "scan-direction-changed", (GCallback) _user_interface_page_scan_direction_changed_cb_page_scan_direction_changed, self);
+ user_interface_update_page_menu (self);
}
-static void simple_scan_page_removed_cb (SimpleScan* self, Book* book, Page* page) {
+static void user_interface_page_removed_cb (UserInterface* self, Book* book, Page* page) {
Book* _tmp0_;
guint _tmp1_ = 0U;
g_return_if_fail (self != NULL);
@@ -3537,13 +3581,13 @@ static void simple_scan_page_removed_cb (SimpleScan* self, Book* book, Page* pag
_tmp0_ = book;
_tmp1_ = book_get_n_pages (_tmp0_);
if (_tmp1_ == ((guint) 1)) {
- simple_scan_add_default_page (self);
+ user_interface_add_default_page (self);
}
- simple_scan_update_page_menu (self);
+ user_interface_update_page_menu (self);
}
-static void simple_scan_set_dpi_combo (SimpleScan* self, GtkComboBox* combo, gint default_dpi, gint current_dpi) {
+static void user_interface_set_dpi_combo (UserInterface* self, GtkComboBox* combo, gint default_dpi, gint current_dpi) {
GtkCellRendererText* _tmp0_;
GtkCellRendererText* _tmp1_;
GtkCellRendererText* renderer;
@@ -3685,7 +3729,7 @@ static void simple_scan_set_dpi_combo (SimpleScan* self, GtkComboBox* combo, gin
}
-static void simple_scan_needs_saving_cb (SimpleScan* self, Book* book) {
+static void user_interface_needs_saving_cb (UserInterface* self, Book* book) {
GtkMenuItem* _tmp0_;
Book* _tmp1_;
gboolean _tmp2_ = FALSE;
@@ -3714,32 +3758,37 @@ static void simple_scan_needs_saving_cb (SimpleScan* self, Book* book) {
}
-static void _simple_scan_info_bar_response_cb_gtk_info_bar_response (GtkInfoBar* _sender, gint response_id, gpointer self) {
- simple_scan_info_bar_response_cb (self, _sender, response_id);
+static void _user_interface_info_bar_response_cb_gtk_info_bar_response (GtkInfoBar* _sender, gint response_id, gpointer self) {
+ user_interface_info_bar_response_cb (self, _sender, response_id);
}
-static void _simple_scan_page_selected_cb_book_view_page_selected (BookView* _sender, Page* page, gpointer self) {
- simple_scan_page_selected_cb (self, _sender, page);
+static void _user_interface_page_selected_cb_book_view_page_selected (BookView* _sender, Page* page, gpointer self) {
+ user_interface_page_selected_cb (self, _sender, page);
}
-static void _simple_scan_show_page_cb_book_view_show_page (BookView* _sender, Page* page, gpointer self) {
- simple_scan_show_page_cb (self, _sender, page);
+static void _user_interface_show_page_cb_book_view_show_page (BookView* _sender, Page* page, gpointer self) {
+ user_interface_show_page_cb (self, _sender, page);
}
-static void _simple_scan_show_page_menu_cb_book_view_show_menu (BookView* _sender, gpointer self) {
- simple_scan_show_page_menu_cb (self, _sender);
+static void _user_interface_show_page_menu_cb_book_view_show_menu (BookView* _sender, gpointer self) {
+ user_interface_show_page_menu_cb (self, _sender);
}
-static void _simple_scan_needs_saving_cb_book_needs_saving_changed (Book* _sender, gpointer self) {
- simple_scan_needs_saving_cb (self, _sender);
+static void _user_interface_needs_saving_cb_book_needs_saving_changed (Book* _sender, gpointer self) {
+ user_interface_needs_saving_cb (self, _sender);
}
-static void simple_scan_load (SimpleScan* self) {
+static void _user_interface_book_saving_cb_book_saving (Book* _sender, gint i, gpointer self) {
+ user_interface_book_saving_cb (self, i);
+}
+
+
+static void user_interface_load (UserInterface* self) {
GtkIconTheme* _tmp0_ = NULL;
GtkBuilder* _tmp1_;
gchar* _tmp2_ = NULL;
@@ -3748,136 +3797,137 @@ static void simple_scan_load (SimpleScan* self) {
GtkBuilder* _tmp9_;
GObject* _tmp10_ = NULL;
GtkWindow* _tmp11_;
- GtkBuilder* _tmp12_;
- GObject* _tmp13_ = NULL;
- GtkVBox* _tmp14_;
- GtkBuilder* _tmp15_;
- GObject* _tmp16_ = NULL;
- GtkMenuItem* _tmp17_;
- GtkBuilder* _tmp18_;
- GObject* _tmp19_ = NULL;
- GtkMenuItem* _tmp20_;
- GtkBuilder* _tmp21_;
- GObject* _tmp22_ = NULL;
- GtkMenuItem* _tmp23_;
- GtkBuilder* _tmp24_;
- GObject* _tmp25_ = NULL;
- GtkMenuItem* _tmp26_;
- GtkBuilder* _tmp27_;
- GObject* _tmp28_ = NULL;
- GtkMenuItem* _tmp29_;
- GtkBuilder* _tmp30_;
- GObject* _tmp31_ = NULL;
- GtkMenuItem* _tmp32_;
- GtkBuilder* _tmp33_;
- GObject* _tmp34_ = NULL;
- GtkToolButton* _tmp35_;
- GtkBuilder* _tmp36_;
- GObject* _tmp37_ = NULL;
- GtkMenuItem* _tmp38_;
- GtkBuilder* _tmp39_;
- GObject* _tmp40_ = NULL;
- GtkToolButton* _tmp41_;
- GtkBuilder* _tmp42_;
- GObject* _tmp43_ = NULL;
- GtkRadioMenuItem* _tmp44_;
- GtkBuilder* _tmp45_;
- GObject* _tmp46_ = NULL;
- GtkRadioMenuItem* _tmp47_;
- GtkBuilder* _tmp48_;
- GObject* _tmp49_ = NULL;
- GtkRadioMenuItem* _tmp50_;
- GtkBuilder* _tmp51_;
- GObject* _tmp52_ = NULL;
- GtkRadioMenuItem* _tmp53_;
- GtkBuilder* _tmp54_;
- GObject* _tmp55_ = NULL;
- GtkDialog* _tmp56_;
- GtkBuilder* _tmp57_;
- GObject* _tmp58_ = NULL;
- GtkLabel* _tmp59_;
- GtkBuilder* _tmp60_;
- GObject* _tmp61_ = NULL;
- GtkEntry* _tmp62_;
- GtkBuilder* _tmp63_;
- GObject* _tmp64_ = NULL;
- GtkEntry* _tmp65_;
- GtkBuilder* _tmp66_;
- GObject* _tmp67_ = NULL;
- GtkDialog* _tmp68_;
- GtkBuilder* _tmp69_;
- GObject* _tmp70_ = NULL;
- GtkComboBox* _tmp71_;
- GtkComboBox* _tmp72_;
- GtkTreeModel* _tmp73_ = NULL;
- GtkListStore* _tmp74_;
- GtkBuilder* _tmp75_;
- GObject* _tmp76_ = NULL;
- GtkComboBox* _tmp77_;
- GtkComboBox* _tmp78_;
- GtkTreeModel* _tmp79_ = NULL;
- GtkListStore* _tmp80_;
- GtkBuilder* _tmp81_;
- GObject* _tmp82_ = NULL;
- GtkComboBox* _tmp83_;
- GtkComboBox* _tmp84_;
- GtkTreeModel* _tmp85_ = NULL;
- GtkListStore* _tmp86_;
- GtkBuilder* _tmp87_;
- GObject* _tmp88_ = NULL;
- GtkComboBox* _tmp89_;
- GtkComboBox* _tmp90_;
- GtkTreeModel* _tmp91_ = NULL;
- GtkListStore* _tmp92_;
- GtkBuilder* _tmp93_;
- GObject* _tmp94_ = NULL;
- GtkComboBox* _tmp95_;
- GtkComboBox* _tmp96_;
- GtkTreeModel* _tmp97_ = NULL;
- GtkListStore* _tmp98_;
- GtkInfoBar* _tmp99_;
- GtkInfoBar* _tmp100_;
- GtkInfoBar* _tmp101_;
- GtkVBox* _tmp102_;
+ GApplication* _tmp12_ = NULL;
+ GtkApplication* _tmp13_;
+ GtkApplication* app;
+ GtkApplication* _tmp14_;
+ GtkWindow* _tmp15_;
+ GtkBuilder* _tmp16_;
+ GObject* _tmp17_ = NULL;
+ GtkVBox* _tmp18_;
+ GtkBuilder* _tmp19_;
+ GObject* _tmp20_ = NULL;
+ GtkMenuItem* _tmp21_;
+ GtkBuilder* _tmp22_;
+ GObject* _tmp23_ = NULL;
+ GtkMenuItem* _tmp24_;
+ GtkBuilder* _tmp25_;
+ GObject* _tmp26_ = NULL;
+ GtkMenuItem* _tmp27_;
+ GtkBuilder* _tmp28_;
+ GObject* _tmp29_ = NULL;
+ GtkMenuItem* _tmp30_;
+ GtkBuilder* _tmp31_;
+ GObject* _tmp32_ = NULL;
+ GtkMenuItem* _tmp33_;
+ GtkBuilder* _tmp34_;
+ GObject* _tmp35_ = NULL;
+ GtkMenuItem* _tmp36_;
+ GtkBuilder* _tmp37_;
+ GObject* _tmp38_ = NULL;
+ GtkToolButton* _tmp39_;
+ GtkBuilder* _tmp40_;
+ GObject* _tmp41_ = NULL;
+ GtkMenuItem* _tmp42_;
+ GtkBuilder* _tmp43_;
+ GObject* _tmp44_ = NULL;
+ GtkToolButton* _tmp45_;
+ GtkBuilder* _tmp46_;
+ GObject* _tmp47_ = NULL;
+ GtkRadioMenuItem* _tmp48_;
+ GtkBuilder* _tmp49_;
+ GObject* _tmp50_ = NULL;
+ GtkRadioMenuItem* _tmp51_;
+ GtkBuilder* _tmp52_;
+ GObject* _tmp53_ = NULL;
+ GtkRadioMenuItem* _tmp54_;
+ GtkBuilder* _tmp55_;
+ GObject* _tmp56_ = NULL;
+ GtkRadioMenuItem* _tmp57_;
+ GtkBuilder* _tmp58_;
+ GObject* _tmp59_ = NULL;
+ GtkDialog* _tmp60_;
+ GtkBuilder* _tmp61_;
+ GObject* _tmp62_ = NULL;
+ GtkLabel* _tmp63_;
+ GtkBuilder* _tmp64_;
+ GObject* _tmp65_ = NULL;
+ GtkEntry* _tmp66_;
+ GtkBuilder* _tmp67_;
+ GObject* _tmp68_ = NULL;
+ GtkEntry* _tmp69_;
+ GtkBuilder* _tmp70_;
+ GObject* _tmp71_ = NULL;
+ GtkDialog* _tmp72_;
+ GtkBuilder* _tmp73_;
+ GObject* _tmp74_ = NULL;
+ GtkComboBox* _tmp75_;
+ GtkComboBox* _tmp76_;
+ GtkTreeModel* _tmp77_ = NULL;
+ GtkListStore* _tmp78_;
+ GtkBuilder* _tmp79_;
+ GObject* _tmp80_ = NULL;
+ GtkComboBox* _tmp81_;
+ GtkComboBox* _tmp82_;
+ GtkTreeModel* _tmp83_ = NULL;
+ GtkListStore* _tmp84_;
+ GtkBuilder* _tmp85_;
+ GObject* _tmp86_ = NULL;
+ GtkComboBox* _tmp87_;
+ GtkComboBox* _tmp88_;
+ GtkTreeModel* _tmp89_ = NULL;
+ GtkListStore* _tmp90_;
+ GtkBuilder* _tmp91_;
+ GObject* _tmp92_ = NULL;
+ GtkComboBox* _tmp93_;
+ GtkComboBox* _tmp94_;
+ GtkTreeModel* _tmp95_ = NULL;
+ GtkListStore* _tmp96_;
+ GtkBuilder* _tmp97_;
+ GObject* _tmp98_ = NULL;
+ GtkComboBox* _tmp99_;
+ GtkComboBox* _tmp100_;
+ GtkTreeModel* _tmp101_ = NULL;
+ GtkListStore* _tmp102_;
GtkInfoBar* _tmp103_;
- GtkBox* _tmp104_;
- GtkBox* _tmp105_;
+ GtkInfoBar* _tmp104_;
+ GtkInfoBar* _tmp105_;
+ GtkVBox* _tmp106_;
+ GtkInfoBar* _tmp107_;
+ GtkBox* _tmp108_;
+ GtkBox* _tmp109_;
GtkBox* hbox;
- GtkInfoBar* _tmp106_;
- GtkWidget* _tmp107_ = NULL;
- GtkContainer* _tmp108_;
+ GtkInfoBar* _tmp110_;
+ GtkWidget* _tmp111_ = NULL;
+ GtkContainer* _tmp112_;
GtkContainer* content_area;
- GtkContainer* _tmp109_;
- GtkBox* _tmp110_;
- GtkBox* _tmp111_;
- GtkImage* _tmp112_;
- GtkImage* _tmp113_;
+ GtkContainer* _tmp113_;
GtkBox* _tmp114_;
- GtkImage* _tmp115_;
+ GtkBox* _tmp115_;
GtkImage* _tmp116_;
- GtkLabel* _tmp117_;
- GtkLabel* _tmp118_;
- GtkLabel* _tmp119_;
- GtkBox* _tmp120_;
+ GtkImage* _tmp117_;
+ GtkBox* _tmp118_;
+ GtkImage* _tmp119_;
+ GtkImage* _tmp120_;
GtkLabel* _tmp121_;
GtkLabel* _tmp122_;
- GtkInfoBar* _tmp123_;
- GtkWidget* _tmp124_ = NULL;
- GtkButton* _tmp125_;
- GtkInfoBar* _tmp126_;
- const gchar* _tmp127_ = NULL;
+ GtkLabel* _tmp123_;
+ GtkBox* _tmp124_;
+ GtkLabel* _tmp125_;
+ GtkLabel* _tmp126_;
+ GtkInfoBar* _tmp127_;
GtkWidget* _tmp128_ = NULL;
GtkButton* _tmp129_;
+ GtkInfoBar* _tmp130_;
+ const gchar* _tmp131_ = NULL;
+ GtkWidget* _tmp132_ = NULL;
+ GtkButton* _tmp133_;
GtkTreeIter iter = {0};
- GtkListStore* _tmp130_;
- GtkTreeIter _tmp131_ = {0};
- GtkListStore* _tmp132_;
- GtkTreeIter _tmp133_;
- const gchar* _tmp134_ = NULL;
- GtkListStore* _tmp135_;
- GtkTreeIter _tmp136_ = {0};
- GtkListStore* _tmp137_;
- GtkTreeIter _tmp138_;
+ GtkListStore* _tmp134_;
+ GtkTreeIter _tmp135_ = {0};
+ GtkListStore* _tmp136_;
+ GtkTreeIter _tmp137_;
+ const gchar* _tmp138_ = NULL;
GtkListStore* _tmp139_;
GtkTreeIter _tmp140_ = {0};
GtkListStore* _tmp141_;
@@ -3898,93 +3948,104 @@ static void simple_scan_load (SimpleScan* self) {
GtkTreeIter _tmp156_ = {0};
GtkListStore* _tmp157_;
GtkTreeIter _tmp158_;
- GSettings* _tmp159_;
- gint _tmp160_ = 0;
+ GtkListStore* _tmp159_;
+ GtkTreeIter _tmp160_ = {0};
+ GtkListStore* _tmp161_;
+ GtkTreeIter _tmp162_;
+ GSettings* _tmp163_;
+ gint _tmp164_ = 0;
gint dpi;
- gint _tmp161_;
- GtkComboBox* _tmp162_;
- gint _tmp163_;
- GSettings* _tmp164_;
- gint _tmp165_ = 0;
- gint _tmp166_;
- GtkComboBox* _tmp167_;
- gint _tmp168_;
- GtkCellRendererText* _tmp169_;
- GtkCellRendererText* _tmp170_;
- GtkCellRendererText* renderer;
+ gint _tmp165_;
+ GtkComboBox* _tmp166_;
+ gint _tmp167_;
+ GSettings* _tmp168_;
+ gint _tmp169_ = 0;
+ gint _tmp170_;
GtkComboBox* _tmp171_;
- GtkCellRendererText* _tmp172_;
- GtkComboBox* _tmp173_;
+ gint _tmp172_;
+ GtkCellRendererText* _tmp173_;
GtkCellRendererText* _tmp174_;
- GtkCellRendererText* _tmp175_;
+ GtkCellRendererText* renderer;
+ GtkComboBox* _tmp175_;
GtkCellRendererText* _tmp176_;
GtkComboBox* _tmp177_;
GtkCellRendererText* _tmp178_;
- GtkComboBox* _tmp179_;
+ GtkCellRendererText* _tmp179_;
GtkCellRendererText* _tmp180_;
- GSettings* _tmp181_;
- gint _tmp182_ = 0;
- GtkCellRendererText* _tmp183_;
+ GtkComboBox* _tmp181_;
+ GtkCellRendererText* _tmp182_;
+ GtkComboBox* _tmp183_;
GtkCellRendererText* _tmp184_;
- GtkComboBox* _tmp185_;
- GtkCellRendererText* _tmp186_;
- GtkComboBox* _tmp187_;
+ GSettings* _tmp185_;
+ gint _tmp186_ = 0;
+ GtkCellRendererText* _tmp187_;
GtkCellRendererText* _tmp188_;
- GSettings* _tmp189_;
- gint _tmp190_ = 0;
+ GtkComboBox* _tmp189_;
+ GtkCellRendererText* _tmp190_;
+ GtkComboBox* _tmp191_;
+ GtkCellRendererText* _tmp192_;
+ GSettings* _tmp193_;
+ gint _tmp194_ = 0;
gint paper_width;
- GSettings* _tmp191_;
- gint _tmp192_ = 0;
- gint paper_height;
- gint _tmp193_;
- gint _tmp194_;
GSettings* _tmp195_;
- gchar* _tmp196_ = NULL;
+ gint _tmp196_ = 0;
+ gint paper_height;
+ gint _tmp197_;
+ gint _tmp198_;
+ GSettings* _tmp199_;
+ gchar* _tmp200_ = NULL;
gchar* device;
- const gchar* _tmp197_;
- GSettings* _tmp203_;
- gchar* _tmp204_ = NULL;
+ const gchar* _tmp201_;
+ GSettings* _tmp207_;
+ gchar* _tmp208_ = NULL;
gchar* document_type;
- const gchar* _tmp205_;
- Book* _tmp207_;
- BookView* _tmp208_;
- BookView* _tmp209_;
- BookView* _tmp210_;
- GtkVBox* _tmp211_;
+ const gchar* _tmp209_;
+ Book* _tmp211_;
BookView* _tmp212_;
BookView* _tmp213_;
BookView* _tmp214_;
- BookView* _tmp215_;
+ GtkVBox* _tmp215_;
BookView* _tmp216_;
- GSettings* _tmp217_;
- gint _tmp218_ = 0;
- GSettings* _tmp219_;
- gint _tmp220_ = 0;
- gint _tmp221_;
- GSettings* _tmp222_;
- gint _tmp223_ = 0;
- gint _tmp224_;
- GSettings* _tmp225_;
- gint _tmp226_ = 0;
- gint _tmp227_;
- GSettings* _tmp228_;
- gint _tmp229_ = 0;
- gint _tmp230_;
- GSettings* _tmp231_;
- gint _tmp232_ = 0;
- gint _tmp233_;
+ BookView* _tmp217_;
+ BookView* _tmp218_;
+ BookView* _tmp219_;
+ BookView* _tmp220_;
+ GSettings* _tmp221_;
+ gint _tmp222_ = 0;
+ GSettings* _tmp223_;
+ gint _tmp224_ = 0;
+ gint _tmp225_;
+ GSettings* _tmp226_;
+ gint _tmp227_ = 0;
+ gint _tmp228_;
+ GSettings* _tmp229_;
+ gint _tmp230_ = 0;
+ gint _tmp231_;
+ GSettings* _tmp232_;
+ gint _tmp233_ = 0;
gint _tmp234_;
- gint _tmp235_;
- GtkWindow* _tmp236_;
+ GSettings* _tmp235_;
+ gint _tmp236_ = 0;
gint _tmp237_;
gint _tmp238_;
- GSettings* _tmp239_;
- gboolean _tmp240_ = FALSE;
- gboolean _tmp241_;
- Book* _tmp243_;
- guint _tmp244_ = 0U;
- Book* _tmp245_;
- Book* _tmp246_;
+ gint _tmp239_;
+ GtkWindow* _tmp240_;
+ gint _tmp241_;
+ gint _tmp242_;
+ GSettings* _tmp243_;
+ gboolean _tmp244_ = FALSE;
+ gboolean _tmp245_;
+ Book* _tmp247_;
+ guint _tmp248_ = 0U;
+ Book* _tmp249_;
+ Book* _tmp250_;
+ GtkWindow* _tmp251_;
+ const gchar* _tmp252_ = NULL;
+ ProgressBarDialog* _tmp253_;
+ ProgressBarDialog* _tmp254_;
+ Book* _tmp255_;
+ BookView* _tmp256_;
+ DragAndDropHandler* _tmp257_;
GError * _inner_error_ = NULL;
g_return_if_fail (self != NULL);
_tmp0_ = gtk_icon_theme_get_default ();
@@ -4000,11 +4061,11 @@ static void simple_scan_load (SimpleScan* self) {
_tmp3_ = self->priv->builder;
gtk_builder_add_from_file (_tmp3_, filename, &_inner_error_);
if (_inner_error_ != NULL) {
- goto __catch21_g_error;
+ goto __catch20_g_error;
}
}
- goto __finally21;
- __catch21_g_error:
+ goto __finally20;
+ __catch20_g_error:
{
GError* e = NULL;
GError* _tmp4_;
@@ -4015,14 +4076,14 @@ static void simple_scan_load (SimpleScan* self) {
_inner_error_ = NULL;
_tmp4_ = e;
_tmp5_ = _tmp4_->message;
- g_critical ("ui.vala:1262: Unable to load UI %s: %s\n", filename, _tmp5_);
+ g_critical ("ui.vala:1243: Unable to load UI %s: %s\n", filename, _tmp5_);
_tmp6_ = _ ("Files missing");
_tmp7_ = _ ("Please check your installation");
- simple_scan_show_error_dialog (self, _tmp6_, _tmp7_);
+ user_interface_show_error_dialog (self, _tmp6_, _tmp7_);
exit (EXIT_FAILURE);
_g_error_free0 (e);
}
- __finally21:
+ __finally20:
if (_inner_error_ != NULL) {
_g_free0 (filename);
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);
@@ -4036,432 +4097,537 @@ static void simple_scan_load (SimpleScan* self) {
_tmp11_ = _g_object_ref0 (GTK_WINDOW (_tmp10_));
_g_object_unref0 (self->priv->window);
self->priv->window = _tmp11_;
- _tmp12_ = self->priv->builder;
- _tmp13_ = gtk_builder_get_object (_tmp12_, "main_vbox");
- _tmp14_ = _g_object_ref0 (GTK_VBOX (_tmp13_));
+ _tmp12_ = g_application_get_default ();
+ _tmp13_ = _g_object_ref0 (GTK_IS_APPLICATION (_tmp12_) ? ((GtkApplication*) _tmp12_) : NULL);
+ app = _tmp13_;
+ _tmp14_ = app;
+ _tmp15_ = self->priv->window;
+ gtk_application_add_window (_tmp14_, _tmp15_);
+ _tmp16_ = self->priv->builder;
+ _tmp17_ = gtk_builder_get_object (_tmp16_, "main_vbox");
+ _tmp18_ = _g_object_ref0 (GTK_VBOX (_tmp17_));
_g_object_unref0 (self->priv->main_vbox);
- self->priv->main_vbox = _tmp14_;
- _tmp15_ = self->priv->builder;
- _tmp16_ = gtk_builder_get_object (_tmp15_, "page_move_left_menuitem");
- _tmp17_ = _g_object_ref0 (GTK_MENU_ITEM (_tmp16_));
+ self->priv->main_vbox = _tmp18_;
+ _tmp19_ = self->priv->builder;
+ _tmp20_ = gtk_builder_get_object (_tmp19_, "page_move_left_menuitem");
+ _tmp21_ = _g_object_ref0 (GTK_MENU_ITEM (_tmp20_));
_g_object_unref0 (self->priv->page_move_left_menuitem);
- self->priv->page_move_left_menuitem = _tmp17_;
- _tmp18_ = self->priv->builder;
- _tmp19_ = gtk_builder_get_object (_tmp18_, "page_move_right_menuitem");
- _tmp20_ = _g_object_ref0 (GTK_MENU_ITEM (_tmp19_));
+ self->priv->page_move_left_menuitem = _tmp21_;
+ _tmp22_ = self->priv->builder;
+ _tmp23_ = gtk_builder_get_object (_tmp22_, "page_move_right_menuitem");
+ _tmp24_ = _g_object_ref0 (GTK_MENU_ITEM (_tmp23_));
_g_object_unref0 (self->priv->page_move_right_menuitem);
- self->priv->page_move_right_menuitem = _tmp20_;
- _tmp21_ = self->priv->builder;
- _tmp22_ = gtk_builder_get_object (_tmp21_, "page_delete_menuitem");
- _tmp23_ = _g_object_ref0 (GTK_MENU_ITEM (_tmp22_));
+ self->priv->page_move_right_menuitem = _tmp24_;
+ _tmp25_ = self->priv->builder;
+ _tmp26_ = gtk_builder_get_object (_tmp25_, "page_delete_menuitem");
+ _tmp27_ = _g_object_ref0 (GTK_MENU_ITEM (_tmp26_));
_g_object_unref0 (self->priv->page_delete_menuitem);
- self->priv->page_delete_menuitem = _tmp23_;
- _tmp24_ = self->priv->builder;
- _tmp25_ = gtk_builder_get_object (_tmp24_, "crop_rotate_menuitem");
- _tmp26_ = _g_object_ref0 (GTK_MENU_ITEM (_tmp25_));
+ self->priv->page_delete_menuitem = _tmp27_;
+ _tmp28_ = self->priv->builder;
+ _tmp29_ = gtk_builder_get_object (_tmp28_, "crop_rotate_menuitem");
+ _tmp30_ = _g_object_ref0 (GTK_MENU_ITEM (_tmp29_));
_g_object_unref0 (self->priv->crop_rotate_menuitem);
- self->priv->crop_rotate_menuitem = _tmp26_;
- _tmp27_ = self->priv->builder;
- _tmp28_ = gtk_builder_get_object (_tmp27_, "save_menuitem");
- _tmp29_ = _g_object_ref0 (GTK_MENU_ITEM (_tmp28_));
+ self->priv->crop_rotate_menuitem = _tmp30_;
+ _tmp31_ = self->priv->builder;
+ _tmp32_ = gtk_builder_get_object (_tmp31_, "save_menuitem");
+ _tmp33_ = _g_object_ref0 (GTK_MENU_ITEM (_tmp32_));
_g_object_unref0 (self->priv->save_menuitem);
- self->priv->save_menuitem = _tmp29_;
- _tmp30_ = self->priv->builder;
- _tmp31_ = gtk_builder_get_object (_tmp30_, "save_as_menuitem");
- _tmp32_ = _g_object_ref0 (GTK_MENU_ITEM (_tmp31_));
+ self->priv->save_menuitem = _tmp33_;
+ _tmp34_ = self->priv->builder;
+ _tmp35_ = gtk_builder_get_object (_tmp34_, "save_as_menuitem");
+ _tmp36_ = _g_object_ref0 (GTK_MENU_ITEM (_tmp35_));
_g_object_unref0 (self->priv->save_as_menuitem);
- self->priv->save_as_menuitem = _tmp32_;
- _tmp33_ = self->priv->builder;
- _tmp34_ = gtk_builder_get_object (_tmp33_, "save_toolbutton");
- _tmp35_ = _g_object_ref0 (GTK_TOOL_BUTTON (_tmp34_));
+ self->priv->save_as_menuitem = _tmp36_;
+ _tmp37_ = self->priv->builder;
+ _tmp38_ = gtk_builder_get_object (_tmp37_, "save_toolbutton");
+ _tmp39_ = _g_object_ref0 (GTK_TOOL_BUTTON (_tmp38_));
_g_object_unref0 (self->priv->save_toolbutton);
- self->priv->save_toolbutton = _tmp35_;
- _tmp36_ = self->priv->builder;
- _tmp37_ = gtk_builder_get_object (_tmp36_, "stop_scan_menuitem");
- _tmp38_ = _g_object_ref0 (GTK_MENU_ITEM (_tmp37_));
+ self->priv->save_toolbutton = _tmp39_;
+ _tmp40_ = self->priv->builder;
+ _tmp41_ = gtk_builder_get_object (_tmp40_, "stop_scan_menuitem");
+ _tmp42_ = _g_object_ref0 (GTK_MENU_ITEM (_tmp41_));
_g_object_unref0 (self->priv->stop_menuitem);
- self->priv->stop_menuitem = _tmp38_;
- _tmp39_ = self->priv->builder;
- _tmp40_ = gtk_builder_get_object (_tmp39_, "stop_toolbutton");
- _tmp41_ = _g_object_ref0 (GTK_TOOL_BUTTON (_tmp40_));
+ self->priv->stop_menuitem = _tmp42_;
+ _tmp43_ = self->priv->builder;
+ _tmp44_ = gtk_builder_get_object (_tmp43_, "stop_toolbutton");
+ _tmp45_ = _g_object_ref0 (GTK_TOOL_BUTTON (_tmp44_));
_g_object_unref0 (self->priv->stop_toolbutton);
- self->priv->stop_toolbutton = _tmp41_;
- _tmp42_ = self->priv->builder;
- _tmp43_ = gtk_builder_get_object (_tmp42_, "text_toolbutton_menuitem");
- _tmp44_ = _g_object_ref0 (GTK_RADIO_MENU_ITEM (_tmp43_));
+ self->priv->stop_toolbutton = _tmp45_;
+ _tmp46_ = self->priv->builder;
+ _tmp47_ = gtk_builder_get_object (_tmp46_, "text_toolbutton_menuitem");
+ _tmp48_ = _g_object_ref0 (GTK_RADIO_MENU_ITEM (_tmp47_));
_g_object_unref0 (self->priv->text_toolbar_menuitem);
- self->priv->text_toolbar_menuitem = _tmp44_;
- _tmp45_ = self->priv->builder;
- _tmp46_ = gtk_builder_get_object (_tmp45_, "text_menuitem");
- _tmp47_ = _g_object_ref0 (GTK_RADIO_MENU_ITEM (_tmp46_));
+ self->priv->text_toolbar_menuitem = _tmp48_;
+ _tmp49_ = self->priv->builder;
+ _tmp50_ = gtk_builder_get_object (_tmp49_, "text_menuitem");
+ _tmp51_ = _g_object_ref0 (GTK_RADIO_MENU_ITEM (_tmp50_));
_g_object_unref0 (self->priv->text_menu_menuitem);
- self->priv->text_menu_menuitem = _tmp47_;
- _tmp48_ = self->priv->builder;
- _tmp49_ = gtk_builder_get_object (_tmp48_, "photo_toolbutton_menuitem");
- _tmp50_ = _g_object_ref0 (GTK_RADIO_MENU_ITEM (_tmp49_));
+ self->priv->text_menu_menuitem = _tmp51_;
+ _tmp52_ = self->priv->builder;
+ _tmp53_ = gtk_builder_get_object (_tmp52_, "photo_toolbutton_menuitem");
+ _tmp54_ = _g_object_ref0 (GTK_RADIO_MENU_ITEM (_tmp53_));
_g_object_unref0 (self->priv->photo_toolbar_menuitem);
- self->priv->photo_toolbar_menuitem = _tmp50_;
- _tmp51_ = self->priv->builder;
- _tmp52_ = gtk_builder_get_object (_tmp51_, "photo_menuitem");
- _tmp53_ = _g_object_ref0 (GTK_RADIO_MENU_ITEM (_tmp52_));
+ self->priv->photo_toolbar_menuitem = _tmp54_;
+ _tmp55_ = self->priv->builder;
+ _tmp56_ = gtk_builder_get_object (_tmp55_, "photo_menuitem");
+ _tmp57_ = _g_object_ref0 (GTK_RADIO_MENU_ITEM (_tmp56_));
_g_object_unref0 (self->priv->photo_menu_menuitem);
- self->priv->photo_menu_menuitem = _tmp53_;
- _tmp54_ = self->priv->builder;
- _tmp55_ = gtk_builder_get_object (_tmp54_, "authorize_dialog");
- _tmp56_ = _g_object_ref0 (GTK_DIALOG (_tmp55_));
+ self->priv->photo_menu_menuitem = _tmp57_;
+ _tmp58_ = self->priv->builder;
+ _tmp59_ = gtk_builder_get_object (_tmp58_, "authorize_dialog");
+ _tmp60_ = _g_object_ref0 (GTK_DIALOG (_tmp59_));
_g_object_unref0 (self->priv->authorize_dialog);
- self->priv->authorize_dialog = _tmp56_;
- _tmp57_ = self->priv->builder;
- _tmp58_ = gtk_builder_get_object (_tmp57_, "authorize_label");
- _tmp59_ = _g_object_ref0 (GTK_LABEL (_tmp58_));
+ self->priv->authorize_dialog = _tmp60_;
+ _tmp61_ = self->priv->builder;
+ _tmp62_ = gtk_builder_get_object (_tmp61_, "authorize_label");
+ _tmp63_ = _g_object_ref0 (GTK_LABEL (_tmp62_));
_g_object_unref0 (self->priv->authorize_label);
- self->priv->authorize_label = _tmp59_;
- _tmp60_ = self->priv->builder;
- _tmp61_ = gtk_builder_get_object (_tmp60_, "username_entry");
- _tmp62_ = _g_object_ref0 (GTK_ENTRY (_tmp61_));
+ self->priv->authorize_label = _tmp63_;
+ _tmp64_ = self->priv->builder;
+ _tmp65_ = gtk_builder_get_object (_tmp64_, "username_entry");
+ _tmp66_ = _g_object_ref0 (GTK_ENTRY (_tmp65_));
_g_object_unref0 (self->priv->username_entry);
- self->priv->username_entry = _tmp62_;
- _tmp63_ = self->priv->builder;
- _tmp64_ = gtk_builder_get_object (_tmp63_, "password_entry");
- _tmp65_ = _g_object_ref0 (GTK_ENTRY (_tmp64_));
+ self->priv->username_entry = _tmp66_;
+ _tmp67_ = self->priv->builder;
+ _tmp68_ = gtk_builder_get_object (_tmp67_, "password_entry");
+ _tmp69_ = _g_object_ref0 (GTK_ENTRY (_tmp68_));
_g_object_unref0 (self->priv->password_entry);
- self->priv->password_entry = _tmp65_;
- _tmp66_ = self->priv->builder;
- _tmp67_ = gtk_builder_get_object (_tmp66_, "preferences_dialog");
- _tmp68_ = _g_object_ref0 (GTK_DIALOG (_tmp67_));
+ self->priv->password_entry = _tmp69_;
+ _tmp70_ = self->priv->builder;
+ _tmp71_ = gtk_builder_get_object (_tmp70_, "preferences_dialog");
+ _tmp72_ = _g_object_ref0 (GTK_DIALOG (_tmp71_));
_g_object_unref0 (self->priv->preferences_dialog);
- self->priv->preferences_dialog = _tmp68_;
- _tmp69_ = self->priv->builder;
- _tmp70_ = gtk_builder_get_object (_tmp69_, "device_combo");
- _tmp71_ = _g_object_ref0 (GTK_COMBO_BOX (_tmp70_));
+ self->priv->preferences_dialog = _tmp72_;
+ _tmp73_ = self->priv->builder;
+ _tmp74_ = gtk_builder_get_object (_tmp73_, "device_combo");
+ _tmp75_ = _g_object_ref0 (GTK_COMBO_BOX (_tmp74_));
_g_object_unref0 (self->priv->device_combo);
- self->priv->device_combo = _tmp71_;
- _tmp72_ = self->priv->device_combo;
- _tmp73_ = gtk_combo_box_get_model (_tmp72_);
- _tmp74_ = _g_object_ref0 (GTK_LIST_STORE (_tmp73_));
+ self->priv->device_combo = _tmp75_;
+ _tmp76_ = self->priv->device_combo;
+ _tmp77_ = gtk_combo_box_get_model (_tmp76_);
+ _tmp78_ = _g_object_ref0 (GTK_LIST_STORE (_tmp77_));
_g_object_unref0 (self->priv->device_model);
- self->priv->device_model = _tmp74_;
- _tmp75_ = self->priv->builder;
- _tmp76_ = gtk_builder_get_object (_tmp75_, "text_dpi_combo");
- _tmp77_ = _g_object_ref0 (GTK_COMBO_BOX (_tmp76_));
+ self->priv->device_model = _tmp78_;
+ _tmp79_ = self->priv->builder;
+ _tmp80_ = gtk_builder_get_object (_tmp79_, "text_dpi_combo");
+ _tmp81_ = _g_object_ref0 (GTK_COMBO_BOX (_tmp80_));
_g_object_unref0 (self->priv->text_dpi_combo);
- self->priv->text_dpi_combo = _tmp77_;
- _tmp78_ = self->priv->text_dpi_combo;
- _tmp79_ = gtk_combo_box_get_model (_tmp78_);
- _tmp80_ = _g_object_ref0 (GTK_LIST_STORE (_tmp79_));
+ self->priv->text_dpi_combo = _tmp81_;
+ _tmp82_ = self->priv->text_dpi_combo;
+ _tmp83_ = gtk_combo_box_get_model (_tmp82_);
+ _tmp84_ = _g_object_ref0 (GTK_LIST_STORE (_tmp83_));
_g_object_unref0 (self->priv->text_dpi_model);
- self->priv->text_dpi_model = _tmp80_;
- _tmp81_ = self->priv->builder;
- _tmp82_ = gtk_builder_get_object (_tmp81_, "photo_dpi_combo");
- _tmp83_ = _g_object_ref0 (GTK_COMBO_BOX (_tmp82_));
+ self->priv->text_dpi_model = _tmp84_;
+ _tmp85_ = self->priv->builder;
+ _tmp86_ = gtk_builder_get_object (_tmp85_, "photo_dpi_combo");
+ _tmp87_ = _g_object_ref0 (GTK_COMBO_BOX (_tmp86_));
_g_object_unref0 (self->priv->photo_dpi_combo);
- self->priv->photo_dpi_combo = _tmp83_;
- _tmp84_ = self->priv->photo_dpi_combo;
- _tmp85_ = gtk_combo_box_get_model (_tmp84_);
- _tmp86_ = _g_object_ref0 (GTK_LIST_STORE (_tmp85_));
+ self->priv->photo_dpi_combo = _tmp87_;
+ _tmp88_ = self->priv->photo_dpi_combo;
+ _tmp89_ = gtk_combo_box_get_model (_tmp88_);
+ _tmp90_ = _g_object_ref0 (GTK_LIST_STORE (_tmp89_));
_g_object_unref0 (self->priv->photo_dpi_model);
- self->priv->photo_dpi_model = _tmp86_;
- _tmp87_ = self->priv->builder;
- _tmp88_ = gtk_builder_get_object (_tmp87_, "page_side_combo");
- _tmp89_ = _g_object_ref0 (GTK_COMBO_BOX (_tmp88_));
+ self->priv->photo_dpi_model = _tmp90_;
+ _tmp91_ = self->priv->builder;
+ _tmp92_ = gtk_builder_get_object (_tmp91_, "page_side_combo");
+ _tmp93_ = _g_object_ref0 (GTK_COMBO_BOX (_tmp92_));
_g_object_unref0 (self->priv->page_side_combo);
- self->priv->page_side_combo = _tmp89_;
- _tmp90_ = self->priv->page_side_combo;
- _tmp91_ = gtk_combo_box_get_model (_tmp90_);
- _tmp92_ = _g_object_ref0 (GTK_LIST_STORE (_tmp91_));
+ self->priv->page_side_combo = _tmp93_;
+ _tmp94_ = self->priv->page_side_combo;
+ _tmp95_ = gtk_combo_box_get_model (_tmp94_);
+ _tmp96_ = _g_object_ref0 (GTK_LIST_STORE (_tmp95_));
_g_object_unref0 (self->priv->page_side_model);
- self->priv->page_side_model = _tmp92_;
- _tmp93_ = self->priv->builder;
- _tmp94_ = gtk_builder_get_object (_tmp93_, "paper_size_combo");
- _tmp95_ = _g_object_ref0 (GTK_COMBO_BOX (_tmp94_));
+ self->priv->page_side_model = _tmp96_;
+ _tmp97_ = self->priv->builder;
+ _tmp98_ = gtk_builder_get_object (_tmp97_, "paper_size_combo");
+ _tmp99_ = _g_object_ref0 (GTK_COMBO_BOX (_tmp98_));
_g_object_unref0 (self->priv->paper_size_combo);
- self->priv->paper_size_combo = _tmp95_;
- _tmp96_ = self->priv->paper_size_combo;
- _tmp97_ = gtk_combo_box_get_model (_tmp96_);
- _tmp98_ = _g_object_ref0 (GTK_LIST_STORE (_tmp97_));
+ self->priv->paper_size_combo = _tmp99_;
+ _tmp100_ = self->priv->paper_size_combo;
+ _tmp101_ = gtk_combo_box_get_model (_tmp100_);
+ _tmp102_ = _g_object_ref0 (GTK_LIST_STORE (_tmp101_));
_g_object_unref0 (self->priv->paper_size_model);
- self->priv->paper_size_model = _tmp98_;
- _tmp99_ = (GtkInfoBar*) gtk_info_bar_new ();
- _tmp100_ = g_object_ref_sink (_tmp99_);
+ self->priv->paper_size_model = _tmp102_;
+ _tmp103_ = (GtkInfoBar*) gtk_info_bar_new ();
+ _tmp104_ = g_object_ref_sink (_tmp103_);
_g_object_unref0 (self->priv->info_bar);
- self->priv->info_bar = _tmp100_;
- _tmp101_ = self->priv->info_bar;
- g_signal_connect (_tmp101_, "response", (GCallback) _simple_scan_info_bar_response_cb_gtk_info_bar_response, self);
- _tmp102_ = self->priv->main_vbox;
- _tmp103_ = self->priv->info_bar;
- gtk_box_pack_start ((GtkBox*) _tmp102_, (GtkWidget*) _tmp103_, FALSE, TRUE, (guint) 0);
- _tmp104_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
- _tmp105_ = g_object_ref_sink (_tmp104_);
- hbox = _tmp105_;
- _tmp106_ = self->priv->info_bar;
- _tmp107_ = gtk_info_bar_get_content_area (_tmp106_);
- _tmp108_ = _g_object_ref0 (GTK_CONTAINER (_tmp107_));
- content_area = _tmp108_;
- _tmp109_ = content_area;
- _tmp110_ = hbox;
- gtk_container_add (_tmp109_, (GtkWidget*) _tmp110_);
- _tmp111_ = hbox;
- gtk_widget_show ((GtkWidget*) _tmp111_);
- _tmp112_ = (GtkImage*) gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
- _tmp113_ = g_object_ref_sink (_tmp112_);
- _g_object_unref0 (self->priv->info_bar_image);
- self->priv->info_bar_image = _tmp113_;
+ self->priv->info_bar = _tmp104_;
+ _tmp105_ = self->priv->info_bar;
+ g_signal_connect (_tmp105_, "response", (GCallback) _user_interface_info_bar_response_cb_gtk_info_bar_response, self);
+ _tmp106_ = self->priv->main_vbox;
+ _tmp107_ = self->priv->info_bar;
+ gtk_box_pack_start ((GtkBox*) _tmp106_, (GtkWidget*) _tmp107_, FALSE, TRUE, (guint) 0);
+ _tmp108_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+ _tmp109_ = g_object_ref_sink (_tmp108_);
+ hbox = _tmp109_;
+ _tmp110_ = self->priv->info_bar;
+ _tmp111_ = gtk_info_bar_get_content_area (_tmp110_);
+ _tmp112_ = _g_object_ref0 (GTK_CONTAINER (_tmp111_));
+ content_area = _tmp112_;
+ _tmp113_ = content_area;
_tmp114_ = hbox;
- _tmp115_ = self->priv->info_bar_image;
- gtk_box_pack_start (_tmp114_, (GtkWidget*) _tmp115_, FALSE, TRUE, (guint) 0);
- _tmp116_ = self->priv->info_bar_image;
- gtk_widget_show ((GtkWidget*) _tmp116_);
- _tmp117_ = (GtkLabel*) gtk_label_new (NULL);
- _tmp118_ = g_object_ref_sink (_tmp117_);
+ gtk_container_add (_tmp113_, (GtkWidget*) _tmp114_);
+ _tmp115_ = hbox;
+ gtk_widget_show ((GtkWidget*) _tmp115_);
+ _tmp116_ = (GtkImage*) gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
+ _tmp117_ = g_object_ref_sink (_tmp116_);
+ _g_object_unref0 (self->priv->info_bar_image);
+ self->priv->info_bar_image = _tmp117_;
+ _tmp118_ = hbox;
+ _tmp119_ = self->priv->info_bar_image;
+ gtk_box_pack_start (_tmp118_, (GtkWidget*) _tmp119_, FALSE, TRUE, (guint) 0);
+ _tmp120_ = self->priv->info_bar_image;
+ gtk_widget_show ((GtkWidget*) _tmp120_);
+ _tmp121_ = (GtkLabel*) gtk_label_new (NULL);
+ _tmp122_ = g_object_ref_sink (_tmp121_);
_g_object_unref0 (self->priv->info_bar_label);
- self->priv->info_bar_label = _tmp118_;
- _tmp119_ = self->priv->info_bar_label;
- gtk_misc_set_alignment ((GtkMisc*) _tmp119_, 0.0f, 0.5f);
- _tmp120_ = hbox;
- _tmp121_ = self->priv->info_bar_label;
- gtk_box_pack_start (_tmp120_, (GtkWidget*) _tmp121_, TRUE, TRUE, (guint) 0);
- _tmp122_ = self->priv->info_bar_label;
- gtk_widget_show ((GtkWidget*) _tmp122_);
- _tmp123_ = self->priv->info_bar;
- _tmp124_ = gtk_info_bar_add_button (_tmp123_, GTK_STOCK_CLOSE, (gint) GTK_RESPONSE_CLOSE);
- _tmp125_ = _g_object_ref0 (GTK_BUTTON (_tmp124_));
- _g_object_unref0 (self->priv->info_bar_close_button);
- self->priv->info_bar_close_button = _tmp125_;
- _tmp126_ = self->priv->info_bar;
- _tmp127_ = _ ("Change _Scanner");
- _tmp128_ = gtk_info_bar_add_button (_tmp126_, _tmp127_, 1);
+ self->priv->info_bar_label = _tmp122_;
+ _tmp123_ = self->priv->info_bar_label;
+ gtk_misc_set_alignment ((GtkMisc*) _tmp123_, 0.0f, 0.5f);
+ _tmp124_ = hbox;
+ _tmp125_ = self->priv->info_bar_label;
+ gtk_box_pack_start (_tmp124_, (GtkWidget*) _tmp125_, TRUE, TRUE, (guint) 0);
+ _tmp126_ = self->priv->info_bar_label;
+ gtk_widget_show ((GtkWidget*) _tmp126_);
+ _tmp127_ = self->priv->info_bar;
+ _tmp128_ = gtk_info_bar_add_button (_tmp127_, GTK_STOCK_CLOSE, (gint) GTK_RESPONSE_CLOSE);
_tmp129_ = _g_object_ref0 (GTK_BUTTON (_tmp128_));
+ _g_object_unref0 (self->priv->info_bar_close_button);
+ self->priv->info_bar_close_button = _tmp129_;
+ _tmp130_ = self->priv->info_bar;
+ _tmp131_ = _ ("Change _Scanner");
+ _tmp132_ = gtk_info_bar_add_button (_tmp130_, _tmp131_, 1);
+ _tmp133_ = _g_object_ref0 (GTK_BUTTON (_tmp132_));
_g_object_unref0 (self->priv->info_bar_change_scanner_button);
- self->priv->info_bar_change_scanner_button = _tmp129_;
- _tmp130_ = self->priv->paper_size_model;
- gtk_list_store_append (_tmp130_, &_tmp131_);
- iter = _tmp131_;
- _tmp132_ = self->priv->paper_size_model;
- _tmp133_ = iter;
- _tmp134_ = _ ("Automatic");
- gtk_list_store_set (_tmp132_, &_tmp133_, 0, 0, 1, 0, 2, _tmp134_, -1, -1);
- _tmp135_ = self->priv->paper_size_model;
- gtk_list_store_append (_tmp135_, &_tmp136_);
- iter = _tmp136_;
- _tmp137_ = self->priv->paper_size_model;
- _tmp138_ = iter;
- gtk_list_store_set (_tmp137_, &_tmp138_, 0, 1050, 1, 1480, 2, "A6", -1, -1);
+ self->priv->info_bar_change_scanner_button = _tmp133_;
+ _tmp134_ = self->priv->paper_size_model;
+ gtk_list_store_append (_tmp134_, &_tmp135_);
+ iter = _tmp135_;
+ _tmp136_ = self->priv->paper_size_model;
+ _tmp137_ = iter;
+ _tmp138_ = _ ("Automatic");
+ gtk_list_store_set (_tmp136_, &_tmp137_, 0, 0, 1, 0, 2, _tmp138_, -1, -1);
_tmp139_ = self->priv->paper_size_model;
gtk_list_store_append (_tmp139_, &_tmp140_);
iter = _tmp140_;
_tmp141_ = self->priv->paper_size_model;
_tmp142_ = iter;
- gtk_list_store_set (_tmp141_, &_tmp142_, 0, 1480, 1, 2100, 2, "A5", -1, -1);
+ gtk_list_store_set (_tmp141_, &_tmp142_, 0, 1050, 1, 1480, 2, "A6", -1, -1);
_tmp143_ = self->priv->paper_size_model;
gtk_list_store_append (_tmp143_, &_tmp144_);
iter = _tmp144_;
_tmp145_ = self->priv->paper_size_model;
_tmp146_ = iter;
- gtk_list_store_set (_tmp145_, &_tmp146_, 0, 2100, 1, 2970, 2, "A4", -1, -1);
+ gtk_list_store_set (_tmp145_, &_tmp146_, 0, 1480, 1, 2100, 2, "A5", -1, -1);
_tmp147_ = self->priv->paper_size_model;
gtk_list_store_append (_tmp147_, &_tmp148_);
iter = _tmp148_;
_tmp149_ = self->priv->paper_size_model;
_tmp150_ = iter;
- gtk_list_store_set (_tmp149_, &_tmp150_, 0, 2159, 1, 2794, 2, "Letter", -1, -1);
+ gtk_list_store_set (_tmp149_, &_tmp150_, 0, 2100, 1, 2970, 2, "A4", -1, -1);
_tmp151_ = self->priv->paper_size_model;
gtk_list_store_append (_tmp151_, &_tmp152_);
iter = _tmp152_;
_tmp153_ = self->priv->paper_size_model;
_tmp154_ = iter;
- gtk_list_store_set (_tmp153_, &_tmp154_, 0, 2159, 1, 3556, 2, "Legal", -1, -1);
+ gtk_list_store_set (_tmp153_, &_tmp154_, 0, 2159, 1, 2794, 2, "Letter", -1, -1);
_tmp155_ = self->priv->paper_size_model;
gtk_list_store_append (_tmp155_, &_tmp156_);
iter = _tmp156_;
_tmp157_ = self->priv->paper_size_model;
_tmp158_ = iter;
- gtk_list_store_set (_tmp157_, &_tmp158_, 0, 1016, 1, 1524, 2, "4×6", -1, -1);
- _tmp159_ = self->priv->settings;
- _tmp160_ = g_settings_get_int (_tmp159_, "text-dpi");
- dpi = _tmp160_;
- _tmp161_ = dpi;
- if (_tmp161_ <= 0) {
- dpi = SIMPLE_SCAN_DEFAULT_TEXT_DPI;
- }
- _tmp162_ = self->priv->text_dpi_combo;
- _tmp163_ = dpi;
- simple_scan_set_dpi_combo (self, _tmp162_, SIMPLE_SCAN_DEFAULT_TEXT_DPI, _tmp163_);
- _tmp164_ = self->priv->settings;
- _tmp165_ = g_settings_get_int (_tmp164_, "photo-dpi");
- dpi = _tmp165_;
- _tmp166_ = dpi;
- if (_tmp166_ <= 0) {
- dpi = SIMPLE_SCAN_DEFAULT_PHOTO_DPI;
- }
- _tmp167_ = self->priv->photo_dpi_combo;
- _tmp168_ = dpi;
- simple_scan_set_dpi_combo (self, _tmp167_, SIMPLE_SCAN_DEFAULT_PHOTO_DPI, _tmp168_);
- _tmp169_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
- _tmp170_ = g_object_ref_sink (_tmp169_);
- renderer = _tmp170_;
- _tmp171_ = self->priv->device_combo;
- _tmp172_ = renderer;
- gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp171_, (GtkCellRenderer*) _tmp172_, TRUE);
- _tmp173_ = self->priv->device_combo;
- _tmp174_ = renderer;
- gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp173_, (GtkCellRenderer*) _tmp174_, "text", 1);
- _tmp175_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
- _tmp176_ = g_object_ref_sink (_tmp175_);
- _g_object_unref0 (renderer);
- renderer = _tmp176_;
- _tmp177_ = self->priv->page_side_combo;
+ gtk_list_store_set (_tmp157_, &_tmp158_, 0, 2159, 1, 3556, 2, "Legal", -1, -1);
+ _tmp159_ = self->priv->paper_size_model;
+ gtk_list_store_append (_tmp159_, &_tmp160_);
+ iter = _tmp160_;
+ _tmp161_ = self->priv->paper_size_model;
+ _tmp162_ = iter;
+ gtk_list_store_set (_tmp161_, &_tmp162_, 0, 1016, 1, 1524, 2, "4×6", -1, -1);
+ _tmp163_ = self->priv->settings;
+ _tmp164_ = g_settings_get_int (_tmp163_, "text-dpi");
+ dpi = _tmp164_;
+ _tmp165_ = dpi;
+ if (_tmp165_ <= 0) {
+ dpi = USER_INTERFACE_DEFAULT_TEXT_DPI;
+ }
+ _tmp166_ = self->priv->text_dpi_combo;
+ _tmp167_ = dpi;
+ user_interface_set_dpi_combo (self, _tmp166_, USER_INTERFACE_DEFAULT_TEXT_DPI, _tmp167_);
+ _tmp168_ = self->priv->settings;
+ _tmp169_ = g_settings_get_int (_tmp168_, "photo-dpi");
+ dpi = _tmp169_;
+ _tmp170_ = dpi;
+ if (_tmp170_ <= 0) {
+ dpi = USER_INTERFACE_DEFAULT_PHOTO_DPI;
+ }
+ _tmp171_ = self->priv->photo_dpi_combo;
+ _tmp172_ = dpi;
+ user_interface_set_dpi_combo (self, _tmp171_, USER_INTERFACE_DEFAULT_PHOTO_DPI, _tmp172_);
+ _tmp173_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
+ _tmp174_ = g_object_ref_sink (_tmp173_);
+ renderer = _tmp174_;
+ _tmp175_ = self->priv->device_combo;
+ _tmp176_ = renderer;
+ gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp175_, (GtkCellRenderer*) _tmp176_, TRUE);
+ _tmp177_ = self->priv->device_combo;
_tmp178_ = renderer;
- gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp177_, (GtkCellRenderer*) _tmp178_, TRUE);
- _tmp179_ = self->priv->page_side_combo;
- _tmp180_ = renderer;
- gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp179_, (GtkCellRenderer*) _tmp180_, "text", 1);
- _tmp181_ = self->priv->settings;
- _tmp182_ = g_settings_get_enum (_tmp181_, "page-side");
- simple_scan_set_page_side (self, (ScanType) _tmp182_);
- _tmp183_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
- _tmp184_ = g_object_ref_sink (_tmp183_);
+ gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp177_, (GtkCellRenderer*) _tmp178_, "text", 1);
+ _tmp179_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
+ _tmp180_ = g_object_ref_sink (_tmp179_);
+ _g_object_unref0 (renderer);
+ renderer = _tmp180_;
+ _tmp181_ = self->priv->page_side_combo;
+ _tmp182_ = renderer;
+ gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp181_, (GtkCellRenderer*) _tmp182_, TRUE);
+ _tmp183_ = self->priv->page_side_combo;
+ _tmp184_ = renderer;
+ gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp183_, (GtkCellRenderer*) _tmp184_, "text", 1);
+ _tmp185_ = self->priv->settings;
+ _tmp186_ = g_settings_get_enum (_tmp185_, "page-side");
+ user_interface_set_page_side (self, (ScanType) _tmp186_);
+ _tmp187_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
+ _tmp188_ = g_object_ref_sink (_tmp187_);
_g_object_unref0 (renderer);
- renderer = _tmp184_;
- _tmp185_ = self->priv->paper_size_combo;
- _tmp186_ = renderer;
- gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp185_, (GtkCellRenderer*) _tmp186_, TRUE);
- _tmp187_ = self->priv->paper_size_combo;
- _tmp188_ = renderer;
- gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp187_, (GtkCellRenderer*) _tmp188_, "text", 2);
- _tmp189_ = self->priv->settings;
- _tmp190_ = g_settings_get_int (_tmp189_, "paper-width");
- paper_width = _tmp190_;
- _tmp191_ = self->priv->settings;
- _tmp192_ = g_settings_get_int (_tmp191_, "paper-height");
- paper_height = _tmp192_;
- _tmp193_ = paper_width;
- _tmp194_ = paper_height;
- simple_scan_set_paper_size (self, _tmp193_, _tmp194_);
+ renderer = _tmp188_;
+ _tmp189_ = self->priv->paper_size_combo;
+ _tmp190_ = renderer;
+ gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp189_, (GtkCellRenderer*) _tmp190_, TRUE);
+ _tmp191_ = self->priv->paper_size_combo;
+ _tmp192_ = renderer;
+ gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp191_, (GtkCellRenderer*) _tmp192_, "text", 2);
+ _tmp193_ = self->priv->settings;
+ _tmp194_ = g_settings_get_int (_tmp193_, "paper-width");
+ paper_width = _tmp194_;
_tmp195_ = self->priv->settings;
- _tmp196_ = g_settings_get_string (_tmp195_, "selected-device");
- device = _tmp196_;
- _tmp197_ = device;
- if (_tmp197_ != NULL) {
- const gchar* _tmp198_;
- GtkTreeIter _tmp199_ = {0};
- gboolean _tmp200_ = FALSE;
- _tmp198_ = device;
- _tmp200_ = simple_scan_find_scan_device (self, _tmp198_, &_tmp199_);
- iter = _tmp199_;
- if (_tmp200_) {
- GtkComboBox* _tmp201_;
- GtkTreeIter _tmp202_;
- _tmp201_ = self->priv->device_combo;
- _tmp202_ = iter;
- gtk_combo_box_set_active_iter (_tmp201_, &_tmp202_);
+ _tmp196_ = g_settings_get_int (_tmp195_, "paper-height");
+ paper_height = _tmp196_;
+ _tmp197_ = paper_width;
+ _tmp198_ = paper_height;
+ user_interface_set_paper_size (self, _tmp197_, _tmp198_);
+ _tmp199_ = self->priv->settings;
+ _tmp200_ = g_settings_get_string (_tmp199_, "selected-device");
+ device = _tmp200_;
+ _tmp201_ = device;
+ if (_tmp201_ != NULL) {
+ const gchar* _tmp202_;
+ GtkTreeIter _tmp203_ = {0};
+ gboolean _tmp204_ = FALSE;
+ _tmp202_ = device;
+ _tmp204_ = user_interface_find_scan_device (self, _tmp202_, &_tmp203_);
+ iter = _tmp203_;
+ if (_tmp204_) {
+ GtkComboBox* _tmp205_;
+ GtkTreeIter _tmp206_;
+ _tmp205_ = self->priv->device_combo;
+ _tmp206_ = iter;
+ gtk_combo_box_set_active_iter (_tmp205_, &_tmp206_);
}
}
- _tmp203_ = self->priv->settings;
- _tmp204_ = g_settings_get_string (_tmp203_, "document-type");
- document_type = _tmp204_;
- _tmp205_ = document_type;
- if (_tmp205_ != NULL) {
- const gchar* _tmp206_;
- _tmp206_ = document_type;
- simple_scan_set_document_hint (self, _tmp206_);
- }
- _tmp207_ = self->priv->book;
- _tmp208_ = book_view_new (_tmp207_);
- _tmp209_ = g_object_ref_sink (_tmp208_);
+ _tmp207_ = self->priv->settings;
+ _tmp208_ = g_settings_get_string (_tmp207_, "document-type");
+ document_type = _tmp208_;
+ _tmp209_ = document_type;
+ if (_tmp209_ != NULL) {
+ const gchar* _tmp210_;
+ _tmp210_ = document_type;
+ user_interface_set_document_hint (self, _tmp210_);
+ }
+ _tmp211_ = self->priv->book;
+ _tmp212_ = book_view_new (_tmp211_);
+ _tmp213_ = g_object_ref_sink (_tmp212_);
_g_object_unref0 (self->priv->book_view);
- self->priv->book_view = _tmp209_;
- _tmp210_ = self->priv->book_view;
- gtk_container_set_border_width ((GtkContainer*) _tmp210_, (guint) 18);
- _tmp211_ = self->priv->main_vbox;
- _tmp212_ = self->priv->book_view;
- gtk_box_pack_end ((GtkBox*) _tmp211_, (GtkWidget*) _tmp212_, TRUE, TRUE, (guint) 0);
- _tmp213_ = self->priv->book_view;
- g_signal_connect (_tmp213_, "page-selected", (GCallback) _simple_scan_page_selected_cb_book_view_page_selected, self);
+ self->priv->book_view = _tmp213_;
_tmp214_ = self->priv->book_view;
- g_signal_connect (_tmp214_, "show-page", (GCallback) _simple_scan_show_page_cb_book_view_show_page, self);
- _tmp215_ = self->priv->book_view;
- g_signal_connect (_tmp215_, "show-menu", (GCallback) _simple_scan_show_page_menu_cb_book_view_show_menu, self);
+ gtk_container_set_border_width ((GtkContainer*) _tmp214_, (guint) 18);
+ _tmp215_ = self->priv->main_vbox;
_tmp216_ = self->priv->book_view;
- gtk_widget_show ((GtkWidget*) _tmp216_);
- _tmp217_ = self->priv->settings;
- _tmp218_ = g_settings_get_enum (_tmp217_, "scan-direction");
- self->priv->default_page_scan_direction = (ScanDirection) _tmp218_;
- _tmp219_ = self->priv->settings;
- _tmp220_ = g_settings_get_int (_tmp219_, "page-width");
- self->priv->default_page_width = _tmp220_;
- _tmp221_ = self->priv->default_page_width;
- if (_tmp221_ <= 0) {
+ gtk_box_pack_end ((GtkBox*) _tmp215_, (GtkWidget*) _tmp216_, TRUE, TRUE, (guint) 0);
+ _tmp217_ = self->priv->book_view;
+ g_signal_connect (_tmp217_, "page-selected", (GCallback) _user_interface_page_selected_cb_book_view_page_selected, self);
+ _tmp218_ = self->priv->book_view;
+ g_signal_connect (_tmp218_, "show-page", (GCallback) _user_interface_show_page_cb_book_view_show_page, self);
+ _tmp219_ = self->priv->book_view;
+ g_signal_connect (_tmp219_, "show-menu", (GCallback) _user_interface_show_page_menu_cb_book_view_show_menu, self);
+ _tmp220_ = self->priv->book_view;
+ gtk_widget_show ((GtkWidget*) _tmp220_);
+ _tmp221_ = self->priv->settings;
+ _tmp222_ = g_settings_get_enum (_tmp221_, "scan-direction");
+ self->priv->default_page_scan_direction = (ScanDirection) _tmp222_;
+ _tmp223_ = self->priv->settings;
+ _tmp224_ = g_settings_get_int (_tmp223_, "page-width");
+ self->priv->default_page_width = _tmp224_;
+ _tmp225_ = self->priv->default_page_width;
+ if (_tmp225_ <= 0) {
self->priv->default_page_width = 595;
}
- _tmp222_ = self->priv->settings;
- _tmp223_ = g_settings_get_int (_tmp222_, "page-height");
- self->priv->default_page_height = _tmp223_;
- _tmp224_ = self->priv->default_page_height;
- if (_tmp224_ <= 0) {
+ _tmp226_ = self->priv->settings;
+ _tmp227_ = g_settings_get_int (_tmp226_, "page-height");
+ self->priv->default_page_height = _tmp227_;
+ _tmp228_ = self->priv->default_page_height;
+ if (_tmp228_ <= 0) {
self->priv->default_page_height = 842;
}
- _tmp225_ = self->priv->settings;
- _tmp226_ = g_settings_get_int (_tmp225_, "page-dpi");
- self->priv->default_page_dpi = _tmp226_;
- _tmp227_ = self->priv->default_page_dpi;
- if (_tmp227_ <= 0) {
+ _tmp229_ = self->priv->settings;
+ _tmp230_ = g_settings_get_int (_tmp229_, "page-dpi");
+ self->priv->default_page_dpi = _tmp230_;
+ _tmp231_ = self->priv->default_page_dpi;
+ if (_tmp231_ <= 0) {
self->priv->default_page_dpi = 72;
}
- _tmp228_ = self->priv->settings;
- _tmp229_ = g_settings_get_int (_tmp228_, "window-width");
- self->priv->window_width = _tmp229_;
- _tmp230_ = self->priv->window_width;
- if (_tmp230_ <= 0) {
+ _tmp232_ = self->priv->settings;
+ _tmp233_ = g_settings_get_int (_tmp232_, "window-width");
+ self->priv->window_width = _tmp233_;
+ _tmp234_ = self->priv->window_width;
+ if (_tmp234_ <= 0) {
self->priv->window_width = 600;
}
- _tmp231_ = self->priv->settings;
- _tmp232_ = g_settings_get_int (_tmp231_, "window-height");
- self->priv->window_height = _tmp232_;
- _tmp233_ = self->priv->window_height;
- if (_tmp233_ <= 0) {
+ _tmp235_ = self->priv->settings;
+ _tmp236_ = g_settings_get_int (_tmp235_, "window-height");
+ self->priv->window_height = _tmp236_;
+ _tmp237_ = self->priv->window_height;
+ if (_tmp237_ <= 0) {
self->priv->window_height = 400;
}
- _tmp234_ = self->priv->window_width;
- _tmp235_ = self->priv->window_height;
- g_debug ("ui.vala:1408: Restoring window to %dx%d pixels", _tmp234_, _tmp235_);
- _tmp236_ = self->priv->window;
- _tmp237_ = self->priv->window_width;
- _tmp238_ = self->priv->window_height;
- gtk_window_set_default_size (_tmp236_, _tmp237_, _tmp238_);
- _tmp239_ = self->priv->settings;
- _tmp240_ = g_settings_get_boolean (_tmp239_, "window-is-maximized");
- self->priv->window_is_maximized = _tmp240_;
- _tmp241_ = self->priv->window_is_maximized;
- if (_tmp241_) {
- GtkWindow* _tmp242_;
- g_debug ("ui.vala:1413: Restoring window to maximized");
- _tmp242_ = self->priv->window;
- gtk_window_maximize (_tmp242_);
- }
- _tmp243_ = self->priv->book;
- _tmp244_ = book_get_n_pages (_tmp243_);
- if (_tmp244_ == ((guint) 0)) {
- simple_scan_add_default_page (self);
- }
- _tmp245_ = self->priv->book;
- book_set_needs_saving (_tmp245_, FALSE);
- _tmp246_ = self->priv->book;
- g_signal_connect (_tmp246_, "needs-saving-changed", (GCallback) _simple_scan_needs_saving_cb_book_needs_saving_changed, self);
+ _tmp238_ = self->priv->window_width;
+ _tmp239_ = self->priv->window_height;
+ g_debug ("ui.vala:1391: Restoring window to %dx%d pixels", _tmp238_, _tmp239_);
+ _tmp240_ = self->priv->window;
+ _tmp241_ = self->priv->window_width;
+ _tmp242_ = self->priv->window_height;
+ gtk_window_set_default_size (_tmp240_, _tmp241_, _tmp242_);
+ _tmp243_ = self->priv->settings;
+ _tmp244_ = g_settings_get_boolean (_tmp243_, "window-is-maximized");
+ self->priv->window_is_maximized = _tmp244_;
+ _tmp245_ = self->priv->window_is_maximized;
+ if (_tmp245_) {
+ GtkWindow* _tmp246_;
+ g_debug ("ui.vala:1396: Restoring window to maximized");
+ _tmp246_ = self->priv->window;
+ gtk_window_maximize (_tmp246_);
+ }
+ _tmp247_ = self->priv->book;
+ _tmp248_ = book_get_n_pages (_tmp247_);
+ if (_tmp248_ == ((guint) 0)) {
+ user_interface_add_default_page (self);
+ }
+ _tmp249_ = self->priv->book;
+ book_set_needs_saving (_tmp249_, FALSE);
+ _tmp250_ = self->priv->book;
+ g_signal_connect (_tmp250_, "needs-saving-changed", (GCallback) _user_interface_needs_saving_cb_book_needs_saving_changed, self);
+ _tmp251_ = self->priv->window;
+ _tmp252_ = _ ("Saving document...");
+ _tmp253_ = progress_bar_dialog_new (_tmp251_, _tmp252_);
+ _tmp254_ = g_object_ref_sink (_tmp253_);
+ _g_object_unref0 (self->priv->progress_dialog);
+ self->priv->progress_dialog = _tmp254_;
+ _tmp255_ = self->priv->book;
+ g_signal_connect (_tmp255_, "saving", (GCallback) _user_interface_book_saving_cb_book_saving, self);
+ _tmp256_ = self->priv->book_view;
+ _tmp257_ = drag_and_drop_handler_new (_tmp256_);
+ _drag_and_drop_handler_unref0 (self->priv->dnd_handler);
+ self->priv->dnd_handler = _tmp257_;
_g_free0 (document_type);
_g_free0 (device);
_g_object_unref0 (renderer);
_g_object_unref0 (content_area);
_g_object_unref0 (hbox);
+ _g_object_unref0 (app);
_g_free0 (filename);
}
+static gboolean ___lambda2_ (UserInterface* self) {
+ gboolean result = FALSE;
+ ProgressBarDialog* _tmp0_;
+ _tmp0_ = self->priv->progress_dialog;
+ gtk_widget_hide ((GtkWidget*) _tmp0_);
+ result = FALSE;
+ return result;
+}
+
+
+static gboolean ____lambda2__gsource_func (gpointer self) {
+ gboolean result;
+ result = ___lambda2_ (self);
+ return result;
+}
+
+
+static void user_interface_book_saving_cb (UserInterface* self, gint page_number) {
+ Book* _tmp1_;
+ guint _tmp2_ = 0U;
+ gint total;
+ gint _tmp3_;
+ gint _tmp4_;
+ gdouble fraction;
+ gdouble _tmp5_;
+ gboolean complete;
+ gboolean _tmp6_;
+ const gchar* _tmp7_ = NULL;
+ gint _tmp8_;
+ gint _tmp9_;
+ gchar* _tmp10_ = NULL;
+ gchar* message;
+ ProgressBarDialog* _tmp11_;
+ gdouble _tmp12_;
+ ProgressBarDialog* _tmp13_;
+ g_return_if_fail (self != NULL);
+ while (TRUE) {
+ gboolean _tmp0_ = FALSE;
+ _tmp0_ = gtk_events_pending ();
+ if (!_tmp0_) {
+ break;
+ }
+ gtk_main_iteration ();
+ }
+ _tmp1_ = self->priv->book;
+ _tmp2_ = book_get_n_pages (_tmp1_);
+ total = (gint) _tmp2_;
+ _tmp3_ = page_number;
+ _tmp4_ = total;
+ fraction = (_tmp3_ + 1.0) / _tmp4_;
+ _tmp5_ = fraction;
+ complete = _tmp5_ == 1.0;
+ _tmp6_ = complete;
+ if (_tmp6_) {
+ g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 500, ____lambda2__gsource_func, user_interface_ref (self), user_interface_unref);
+ }
+ _tmp7_ = _ ("Saving page %d out of %d");
+ _tmp8_ = page_number;
+ _tmp9_ = total;
+ _tmp10_ = g_strdup_printf (_tmp7_, _tmp8_ + 1, _tmp9_);
+ message = _tmp10_;
+ _tmp11_ = self->priv->progress_dialog;
+ _tmp12_ = fraction;
+ progress_bar_dialog_set_fraction (_tmp11_, _tmp12_);
+ _tmp13_ = self->priv->progress_dialog;
+ progress_bar_dialog_set_message (_tmp13_, message);
+ _g_free0 (message);
+}
+
+
+void user_interface_show_progress_dialog (UserInterface* self) {
+ ProgressBarDialog* _tmp0_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = self->priv->progress_dialog;
+ gtk_widget_show ((GtkWidget*) _tmp0_);
+}
+
+
+void user_interface_hide_progress_dialog (UserInterface* self) {
+ ProgressBarDialog* _tmp0_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = self->priv->progress_dialog;
+ gtk_widget_hide ((GtkWidget*) _tmp0_);
+}
+
+
static gpointer _book_ref0 (gpointer self) {
return self ? book_ref (self) : NULL;
}
-Book* simple_scan_get_book (SimpleScan* self) {
+Book* user_interface_get_book (UserInterface* self) {
Book* result = NULL;
Book* _tmp0_;
Book* _tmp1_;
@@ -4473,7 +4639,7 @@ Book* simple_scan_get_book (SimpleScan* self) {
}
-void simple_scan_set_selected_page (SimpleScan* self, Page* page) {
+void user_interface_set_selected_page (UserInterface* self, Page* page) {
BookView* _tmp0_;
Page* _tmp1_;
g_return_if_fail (self != NULL);
@@ -4484,7 +4650,7 @@ void simple_scan_set_selected_page (SimpleScan* self, Page* page) {
}
-Page* simple_scan_get_selected_page (SimpleScan* self) {
+Page* user_interface_get_selected_page (UserInterface* self) {
Page* result = NULL;
BookView* _tmp0_;
Page* _tmp1_ = NULL;
@@ -4496,7 +4662,7 @@ Page* simple_scan_get_selected_page (SimpleScan* self) {
}
-void simple_scan_set_scanning (SimpleScan* self, gboolean scanning) {
+void user_interface_set_scanning (UserInterface* self, gboolean scanning) {
gboolean _tmp0_;
GtkMenuItem* _tmp1_;
gboolean _tmp2_;
@@ -4519,7 +4685,7 @@ void simple_scan_set_scanning (SimpleScan* self, gboolean scanning) {
}
-void simple_scan_show_error (SimpleScan* self, const gchar* error_title, const gchar* error_text, gboolean change_scanner_hint) {
+void user_interface_show_error (UserInterface* self, const gchar* error_title, const gchar* error_text, gboolean change_scanner_hint) {
const gchar* _tmp0_;
gchar* _tmp1_;
const gchar* _tmp2_;
@@ -4539,11 +4705,11 @@ void simple_scan_show_error (SimpleScan* self, const gchar* error_title, const g
self->priv->error_text = _tmp3_;
_tmp4_ = change_scanner_hint;
self->priv->error_change_scanner_hint = _tmp4_;
- simple_scan_update_info_bar (self);
+ user_interface_update_info_bar (self);
}
-void simple_scan_start (SimpleScan* self) {
+void user_interface_start (UserInterface* self) {
GtkWindow* _tmp0_;
g_return_if_fail (self != NULL);
_tmp0_ = self->priv->window;
@@ -4571,42 +4737,42 @@ static void g_cclosure_user_marshal_VOID__STRING_SCAN_OPTIONS (GClosure * closur
}
-static void value_simple_scan_init (GValue* value) {
+static void value_user_interface_init (GValue* value) {
value->data[0].v_pointer = NULL;
}
-static void value_simple_scan_free_value (GValue* value) {
+static void value_user_interface_free_value (GValue* value) {
if (value->data[0].v_pointer) {
- simple_scan_unref (value->data[0].v_pointer);
+ user_interface_unref (value->data[0].v_pointer);
}
}
-static void value_simple_scan_copy_value (const GValue* src_value, GValue* dest_value) {
+static void value_user_interface_copy_value (const GValue* src_value, GValue* dest_value) {
if (src_value->data[0].v_pointer) {
- dest_value->data[0].v_pointer = simple_scan_ref (src_value->data[0].v_pointer);
+ dest_value->data[0].v_pointer = user_interface_ref (src_value->data[0].v_pointer);
} else {
dest_value->data[0].v_pointer = NULL;
}
}
-static gpointer value_simple_scan_peek_pointer (const GValue* value) {
+static gpointer value_user_interface_peek_pointer (const GValue* value) {
return value->data[0].v_pointer;
}
-static gchar* value_simple_scan_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
+static gchar* value_user_interface_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
if (collect_values[0].v_pointer) {
- SimpleScan* object;
+ UserInterface* object;
object = collect_values[0].v_pointer;
if (object->parent_instance.g_class == NULL) {
return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
}
- value->data[0].v_pointer = simple_scan_ref (object);
+ value->data[0].v_pointer = user_interface_ref (object);
} else {
value->data[0].v_pointer = NULL;
}
@@ -4614,8 +4780,8 @@ static gchar* value_simple_scan_collect_value (GValue* value, guint n_collect_va
}
-static gchar* value_simple_scan_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
- SimpleScan** object_p;
+static gchar* value_user_interface_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
+ UserInterface** object_p;
object_p = collect_values[0].v_pointer;
if (!object_p) {
return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
@@ -4625,78 +4791,78 @@ static gchar* value_simple_scan_lcopy_value (const GValue* value, guint n_collec
} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
*object_p = value->data[0].v_pointer;
} else {
- *object_p = simple_scan_ref (value->data[0].v_pointer);
+ *object_p = user_interface_ref (value->data[0].v_pointer);
}
return NULL;
}
-GParamSpec* param_spec_simple_scan (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
- ParamSpecSimpleScan* spec;
- g_return_val_if_fail (g_type_is_a (object_type, TYPE_SIMPLE_SCAN), NULL);
+GParamSpec* param_spec_user_interface (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
+ ParamSpecUserInterface* spec;
+ g_return_val_if_fail (g_type_is_a (object_type, TYPE_USER_INTERFACE), NULL);
spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
G_PARAM_SPEC (spec)->value_type = object_type;
return G_PARAM_SPEC (spec);
}
-gpointer value_get_simple_scan (const GValue* value) {
- g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SIMPLE_SCAN), NULL);
+gpointer value_get_user_interface (const GValue* value) {
+ g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_USER_INTERFACE), NULL);
return value->data[0].v_pointer;
}
-void value_set_simple_scan (GValue* value, gpointer v_object) {
- SimpleScan* old;
- g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SIMPLE_SCAN));
+void value_set_user_interface (GValue* value, gpointer v_object) {
+ UserInterface* old;
+ g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_USER_INTERFACE));
old = value->data[0].v_pointer;
if (v_object) {
- g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_SIMPLE_SCAN));
+ g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_USER_INTERFACE));
g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
value->data[0].v_pointer = v_object;
- simple_scan_ref (value->data[0].v_pointer);
+ user_interface_ref (value->data[0].v_pointer);
} else {
value->data[0].v_pointer = NULL;
}
if (old) {
- simple_scan_unref (old);
+ user_interface_unref (old);
}
}
-void value_take_simple_scan (GValue* value, gpointer v_object) {
- SimpleScan* old;
- g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SIMPLE_SCAN));
+void value_take_user_interface (GValue* value, gpointer v_object) {
+ UserInterface* old;
+ g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_USER_INTERFACE));
old = value->data[0].v_pointer;
if (v_object) {
- g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_SIMPLE_SCAN));
+ g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_USER_INTERFACE));
g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
value->data[0].v_pointer = v_object;
} else {
value->data[0].v_pointer = NULL;
}
if (old) {
- simple_scan_unref (old);
+ user_interface_unref (old);
}
}
-static void simple_scan_class_init (SimpleScanClass * klass) {
- simple_scan_parent_class = g_type_class_peek_parent (klass);
- SIMPLE_SCAN_CLASS (klass)->finalize = simple_scan_finalize;
- g_type_class_add_private (klass, sizeof (SimpleScanPrivate));
- g_signal_new ("start_scan", TYPE_SIMPLE_SCAN, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_SCAN_OPTIONS, G_TYPE_NONE, 2, G_TYPE_STRING, TYPE_SCAN_OPTIONS);
- g_signal_new ("stop_scan", TYPE_SIMPLE_SCAN, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
- g_signal_new ("email", TYPE_SIMPLE_SCAN, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
- g_signal_new ("quit", TYPE_SIMPLE_SCAN, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+static void user_interface_class_init (UserInterfaceClass * klass) {
+ user_interface_parent_class = g_type_class_peek_parent (klass);
+ USER_INTERFACE_CLASS (klass)->finalize = user_interface_finalize;
+ g_type_class_add_private (klass, sizeof (UserInterfacePrivate));
+ g_signal_new ("start_scan", TYPE_USER_INTERFACE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_SCAN_OPTIONS, G_TYPE_NONE, 2, G_TYPE_STRING, TYPE_SCAN_OPTIONS);
+ g_signal_new ("stop_scan", TYPE_USER_INTERFACE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+ g_signal_new ("email", TYPE_USER_INTERFACE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
}
-static void simple_scan_instance_init (SimpleScan * self) {
+static void user_interface_instance_init (UserInterface * self) {
gchar* _tmp0_;
const gchar* _tmp1_ = NULL;
gchar* _tmp2_;
- self->priv = SIMPLE_SCAN_GET_PRIVATE (self);
+ self->priv = USER_INTERFACE_GET_PRIVATE (self);
+ self->priv->dnd_handler = NULL;
self->priv->book_uri = NULL;
_tmp0_ = g_strdup ("photo");
self->priv->document_hint = _tmp0_;
@@ -4708,9 +4874,9 @@ static void simple_scan_instance_init (SimpleScan * self) {
}
-static void simple_scan_finalize (SimpleScan* obj) {
- SimpleScan * self;
- self = SIMPLE_SCAN (obj);
+static void user_interface_finalize (UserInterface* obj) {
+ UserInterface * self;
+ self = USER_INTERFACE (obj);
_g_object_unref0 (self->priv->settings);
_g_object_unref0 (self->priv->builder);
_g_object_unref0 (self->priv->window);
@@ -4749,6 +4915,8 @@ static void simple_scan_finalize (SimpleScan* obj) {
_g_object_unref0 (self->priv->page_side_model);
_g_object_unref0 (self->priv->paper_size_model);
_g_object_unref0 (self->priv->save_dialog);
+ _g_object_unref0 (self->priv->progress_dialog);
+ _drag_and_drop_handler_unref0 (self->priv->dnd_handler);
_g_free0 (self->priv->error_title);
_g_free0 (self->priv->error_text);
_book_unref0 (self->priv->book);
@@ -4759,38 +4927,585 @@ static void simple_scan_finalize (SimpleScan* obj) {
}
-GType simple_scan_get_type (void) {
- static volatile gsize simple_scan_type_id__volatile = 0;
- if (g_once_init_enter (&simple_scan_type_id__volatile)) {
- static const GTypeValueTable g_define_type_value_table = { value_simple_scan_init, value_simple_scan_free_value, value_simple_scan_copy_value, value_simple_scan_peek_pointer, "p", value_simple_scan_collect_value, "p", value_simple_scan_lcopy_value };
- static const GTypeInfo g_define_type_info = { sizeof (SimpleScanClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) simple_scan_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SimpleScan), 0, (GInstanceInitFunc) simple_scan_instance_init, &g_define_type_value_table };
+GType user_interface_get_type (void) {
+ static volatile gsize user_interface_type_id__volatile = 0;
+ if (g_once_init_enter (&user_interface_type_id__volatile)) {
+ static const GTypeValueTable g_define_type_value_table = { value_user_interface_init, value_user_interface_free_value, value_user_interface_copy_value, value_user_interface_peek_pointer, "p", value_user_interface_collect_value, "p", value_user_interface_lcopy_value };
+ static const GTypeInfo g_define_type_info = { sizeof (UserInterfaceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) user_interface_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UserInterface), 0, (GInstanceInitFunc) user_interface_instance_init, &g_define_type_value_table };
+ static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+ GType user_interface_type_id;
+ user_interface_type_id = g_type_register_fundamental (g_type_fundamental_next (), "UserInterface", &g_define_type_info, &g_define_type_fundamental_info, 0);
+ g_once_init_leave (&user_interface_type_id__volatile, user_interface_type_id);
+ }
+ return user_interface_type_id__volatile;
+}
+
+
+gpointer user_interface_ref (gpointer instance) {
+ UserInterface* self;
+ self = instance;
+ g_atomic_int_inc (&self->ref_count);
+ return instance;
+}
+
+
+void user_interface_unref (gpointer instance) {
+ UserInterface* self;
+ self = instance;
+ if (g_atomic_int_dec_and_test (&self->ref_count)) {
+ USER_INTERFACE_GET_CLASS (self)->finalize (self);
+ g_type_free_instance ((GTypeInstance *) self);
+ }
+}
+
+
+ProgressBarDialog* progress_bar_dialog_construct (GType object_type, GtkWindow* parent, const gchar* title) {
+ ProgressBarDialog * self = NULL;
+ GtkProgressBar* _tmp0_;
+ GtkProgressBar* _tmp1_;
+ GtkBox* _tmp2_;
+ GtkBox* _tmp3_;
+ GtkBox* hbox;
+ GtkBox* _tmp4_;
+ GtkBox* _tmp5_;
+ GtkBox* vbox;
+ GtkProgressBar* _tmp6_;
+ GtkProgressBar* _tmp7_;
+ GtkProgressBar* _tmp8_;
+ GtkProgressBar* _tmp9_;
+ const gchar* _tmp10_;
+ GtkWindow* _tmp11_;
+ GtkProgressBar* _tmp12_;
+ g_return_val_if_fail (parent != NULL, NULL);
+ g_return_val_if_fail (title != NULL, NULL);
+ self = (ProgressBarDialog*) g_object_new (object_type, NULL);
+ _tmp0_ = (GtkProgressBar*) gtk_progress_bar_new ();
+ _tmp1_ = g_object_ref_sink (_tmp0_);
+ _g_object_unref0 (self->priv->bar);
+ self->priv->bar = _tmp1_;
+ _tmp2_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
+ _tmp3_ = g_object_ref_sink (_tmp2_);
+ hbox = _tmp3_;
+ _tmp4_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
+ _tmp5_ = g_object_ref_sink (_tmp4_);
+ vbox = _tmp5_;
+ gtk_widget_set_hexpand ((GtkWidget*) hbox, TRUE);
+ _tmp6_ = self->priv->bar;
+ gtk_progress_bar_set_text (_tmp6_, "");
+ _tmp7_ = self->priv->bar;
+ gtk_progress_bar_set_show_text (_tmp7_, TRUE);
+ _tmp8_ = self->priv->bar;
+ gtk_widget_set_size_request ((GtkWidget*) _tmp8_, 225, 25);
+ gtk_widget_set_size_request ((GtkWidget*) self, 250, 50);
+ _tmp9_ = self->priv->bar;
+ gtk_box_pack_start (vbox, (GtkWidget*) _tmp9_, TRUE, FALSE, (guint) 0);
+ gtk_box_pack_start (hbox, (GtkWidget*) vbox, TRUE, FALSE, (guint) 0);
+ gtk_container_add ((GtkContainer*) self, (GtkWidget*) hbox);
+ _tmp10_ = title;
+ gtk_window_set_title ((GtkWindow*) self, _tmp10_);
+ _tmp11_ = parent;
+ gtk_window_set_transient_for ((GtkWindow*) self, _tmp11_);
+ gtk_window_set_position ((GtkWindow*) self, GTK_WIN_POS_CENTER_ON_PARENT);
+ gtk_window_set_modal ((GtkWindow*) self, TRUE);
+ gtk_window_set_resizable ((GtkWindow*) self, FALSE);
+ gtk_widget_show ((GtkWidget*) hbox);
+ gtk_widget_show ((GtkWidget*) vbox);
+ _tmp12_ = self->priv->bar;
+ gtk_widget_show ((GtkWidget*) _tmp12_);
+ _g_object_unref0 (vbox);
+ _g_object_unref0 (hbox);
+ return self;
+}
+
+
+ProgressBarDialog* progress_bar_dialog_new (GtkWindow* parent, const gchar* title) {
+ return progress_bar_dialog_construct (TYPE_PROGRESS_BAR_DIALOG, parent, title);
+}
+
+
+void progress_bar_dialog_set_fraction (ProgressBarDialog* self, gdouble percent) {
+ GtkProgressBar* _tmp0_;
+ gdouble _tmp1_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = self->priv->bar;
+ _tmp1_ = percent;
+ gtk_progress_bar_set_fraction (_tmp0_, _tmp1_);
+}
+
+
+void progress_bar_dialog_set_message (ProgressBarDialog* self, const gchar* message) {
+ GtkProgressBar* _tmp0_;
+ const gchar* _tmp1_;
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (message != NULL);
+ _tmp0_ = self->priv->bar;
+ _tmp1_ = message;
+ gtk_progress_bar_set_text (_tmp0_, _tmp1_);
+}
+
+
+static void progress_bar_dialog_class_init (ProgressBarDialogClass * klass) {
+ progress_bar_dialog_parent_class = g_type_class_peek_parent (klass);
+ g_type_class_add_private (klass, sizeof (ProgressBarDialogPrivate));
+ G_OBJECT_CLASS (klass)->finalize = progress_bar_dialog_finalize;
+}
+
+
+static void progress_bar_dialog_instance_init (ProgressBarDialog * self) {
+ self->priv = PROGRESS_BAR_DIALOG_GET_PRIVATE (self);
+}
+
+
+static void progress_bar_dialog_finalize (GObject* obj) {
+ ProgressBarDialog * self;
+ self = PROGRESS_BAR_DIALOG (obj);
+ _g_object_unref0 (self->priv->bar);
+ G_OBJECT_CLASS (progress_bar_dialog_parent_class)->finalize (obj);
+}
+
+
+GType progress_bar_dialog_get_type (void) {
+ static volatile gsize progress_bar_dialog_type_id__volatile = 0;
+ if (g_once_init_enter (&progress_bar_dialog_type_id__volatile)) {
+ static const GTypeInfo g_define_type_info = { sizeof (ProgressBarDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) progress_bar_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProgressBarDialog), 0, (GInstanceInitFunc) progress_bar_dialog_instance_init, NULL };
+ GType progress_bar_dialog_type_id;
+ progress_bar_dialog_type_id = g_type_register_static (GTK_TYPE_WINDOW, "ProgressBarDialog", &g_define_type_info, 0);
+ g_once_init_leave (&progress_bar_dialog_type_id__volatile, progress_bar_dialog_type_id);
+ }
+ return progress_bar_dialog_type_id__volatile;
+}
+
+
+static GType drag_and_drop_handler_target_type_get_type (void) {
+ static volatile gsize drag_and_drop_handler_target_type_type_id__volatile = 0;
+ if (g_once_init_enter (&drag_and_drop_handler_target_type_type_id__volatile)) {
+ static const GEnumValue values[] = {{DRAG_AND_DROP_HANDLER_TARGET_TYPE_IMAGE, "DRAG_AND_DROP_HANDLER_TARGET_TYPE_IMAGE", "image"}, {DRAG_AND_DROP_HANDLER_TARGET_TYPE_URI, "DRAG_AND_DROP_HANDLER_TARGET_TYPE_URI", "uri"}, {0, NULL, NULL}};
+ GType drag_and_drop_handler_target_type_type_id;
+ drag_and_drop_handler_target_type_type_id = g_enum_register_static ("DragAndDropHandlerTargetType", values);
+ g_once_init_leave (&drag_and_drop_handler_target_type_type_id__volatile, drag_and_drop_handler_target_type_type_id);
+ }
+ return drag_and_drop_handler_target_type_type_id__volatile;
+}
+
+
+static void _drag_and_drop_handler_on_drag_data_get_gtk_widget_drag_data_get (GtkWidget* _sender, GdkDragContext* context, GtkSelectionData* selection_data, guint info, guint time_, gpointer self) {
+ drag_and_drop_handler_on_drag_data_get (self, context, selection_data, info, time_);
+}
+
+
+DragAndDropHandler* drag_and_drop_handler_construct (GType object_type, BookView* book_view) {
+ DragAndDropHandler* self = NULL;
+ BookView* _tmp0_;
+ BookView* _tmp1_;
+ BookView* _tmp2_;
+ GtkWidget* _tmp3_ = NULL;
+ GtkWidget* event_source;
+ g_return_val_if_fail (book_view != NULL, NULL);
+ self = (DragAndDropHandler*) g_type_create_instance (object_type);
+ _tmp0_ = book_view;
+ _tmp1_ = _g_object_ref0 (_tmp0_);
+ _g_object_unref0 (self->priv->book_view);
+ self->priv->book_view = _tmp1_;
+ _tmp2_ = book_view;
+ _tmp3_ = book_view_get_event_source (_tmp2_);
+ event_source = _tmp3_;
+ drag_and_drop_handler_set_targets (self, event_source);
+ g_signal_connect (event_source, "drag-data-get", (GCallback) _drag_and_drop_handler_on_drag_data_get_gtk_widget_drag_data_get, self);
+ _g_object_unref0 (event_source);
+ return self;
+}
+
+
+DragAndDropHandler* drag_and_drop_handler_new (BookView* book_view) {
+ return drag_and_drop_handler_construct (TYPE_DRAG_AND_DROP_HANDLER, book_view);
+}
+
+
+static void drag_and_drop_handler_set_targets (DragAndDropHandler* self, GtkWidget* event_source) {
+ GtkTargetEntry* _tmp0_ = NULL;
+ GtkTargetEntry* table;
+ gint table_length1;
+ gint _table_size_;
+ GtkTargetList* _tmp1_;
+ GtkTargetList* targets;
+ GtkWidget* _tmp2_;
+ GtkWidget* _tmp3_;
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (event_source != NULL);
+ _tmp0_ = g_new0 (GtkTargetEntry, 0);
+ table = _tmp0_;
+ table_length1 = 0;
+ _table_size_ = table_length1;
+ _tmp1_ = gtk_target_list_new (table, table_length1);
+ targets = _tmp1_;
+ gtk_target_list_add_uri_targets (targets, (guint) DRAG_AND_DROP_HANDLER_TARGET_TYPE_URI);
+ gtk_target_list_add_image_targets (targets, (guint) DRAG_AND_DROP_HANDLER_TARGET_TYPE_IMAGE, TRUE);
+ _tmp2_ = event_source;
+ gtk_drag_source_set (_tmp2_, GDK_BUTTON1_MASK, table, table_length1, GDK_ACTION_COPY);
+ _tmp3_ = event_source;
+ gtk_drag_source_set_target_list (_tmp3_, targets);
+ _gtk_target_list_unref0 (targets);
+ table = (g_free (table), NULL);
+}
+
+
+static void drag_and_drop_handler_on_drag_data_get (DragAndDropHandler* self, GdkDragContext* context, GtkSelectionData* selection, guint target_type, guint time) {
+ BookView* _tmp0_;
+ Page* _tmp1_ = NULL;
+ Page* page;
+ Page* _tmp2_;
+ guint _tmp3_;
+ GError * _inner_error_ = NULL;
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (context != NULL);
+ g_return_if_fail (selection != NULL);
+ _tmp0_ = self->priv->book_view;
+ _tmp1_ = book_view_get_selected (_tmp0_);
+ page = _tmp1_;
+ _tmp2_ = page;
+ g_return_if_fail (_tmp2_ != NULL);
+ _tmp3_ = target_type;
+ switch (_tmp3_) {
+ case DRAG_AND_DROP_HANDLER_TARGET_TYPE_IMAGE:
+ {
+ Page* _tmp4_;
+ GdkPixbuf* _tmp5_ = NULL;
+ GdkPixbuf* image;
+ GtkSelectionData* _tmp6_;
+ GdkPixbuf* _tmp7_;
+ _tmp4_ = page;
+ _tmp5_ = page_get_image (_tmp4_, TRUE);
+ image = _tmp5_;
+ _tmp6_ = selection;
+ _tmp7_ = image;
+ gtk_selection_data_set_pixbuf (_tmp6_, _tmp7_);
+ g_debug ("ui.vala:1562: Saving page to pixbuf");
+ _g_object_unref0 (image);
+ break;
+ }
+ case DRAG_AND_DROP_HANDLER_TARGET_TYPE_URI:
+ {
+ gchar* _tmp8_;
+ gchar* filetype;
+ const gchar* _tmp9_;
+ gchar* _tmp10_ = NULL;
+ gchar* path;
+ const gchar* _tmp11_;
+ const gchar* _tmp12_;
+ GFile* _tmp13_ = NULL;
+ GFile* file;
+ GFile* _tmp14_;
+ gchar* _tmp15_ = NULL;
+ gchar* uri;
+ _tmp8_ = g_strdup ("png");
+ filetype = _tmp8_;
+ _tmp9_ = filetype;
+ _tmp10_ = get_temporary_filename ("scanned-page", _tmp9_);
+ path = _tmp10_;
+ _tmp11_ = path;
+ g_return_if_fail (_tmp11_ != NULL);
+ _tmp12_ = path;
+ _tmp13_ = g_file_new_for_path (_tmp12_);
+ file = _tmp13_;
+ _tmp14_ = file;
+ _tmp15_ = g_file_get_uri (_tmp14_);
+ uri = _tmp15_;
+ {
+ Page* _tmp16_;
+ const gchar* _tmp17_;
+ GFile* _tmp18_;
+ GtkSelectionData* _tmp19_;
+ const gchar* _tmp20_;
+ gchar* _tmp21_;
+ gchar** _tmp22_ = NULL;
+ gchar** _tmp23_;
+ gint _tmp23__length1;
+ const gchar* _tmp24_;
+ _tmp16_ = page;
+ _tmp17_ = filetype;
+ _tmp18_ = file;
+ page_save (_tmp16_, _tmp17_, _tmp18_, &_inner_error_);
+ if (_inner_error_ != NULL) {
+ goto __catch21_g_error;
+ }
+ _tmp19_ = selection;
+ _tmp20_ = uri;
+ _tmp21_ = g_strdup (_tmp20_);
+ _tmp22_ = g_new0 (gchar*, 1 + 1);
+ _tmp22_[0] = _tmp21_;
+ _tmp23_ = _tmp22_;
+ _tmp23__length1 = 1;
+ gtk_selection_data_set_uris (_tmp19_, _tmp23_);
+ _tmp23_ = (_vala_array_free (_tmp23_, _tmp23__length1, (GDestroyNotify) g_free), NULL);
+ _tmp24_ = uri;
+ g_debug ("ui.vala:1577: Saving page to %s", _tmp24_);
+ }
+ goto __finally21;
+ __catch21_g_error:
+ {
+ GError* e = NULL;
+ GError* _tmp25_;
+ const gchar* _tmp26_;
+ e = _inner_error_;
+ _inner_error_ = NULL;
+ _tmp25_ = e;
+ _tmp26_ = _tmp25_->message;
+ g_warning ("ui.vala:1581: Unable to save file using drag-drop %s", _tmp26_);
+ _g_error_free0 (e);
+ }
+ __finally21:
+ if (_inner_error_ != NULL) {
+ _g_free0 (uri);
+ _g_object_unref0 (file);
+ _g_free0 (path);
+ _g_free0 (filetype);
+ _page_unref0 (page);
+ 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);
+ g_clear_error (&_inner_error_);
+ return;
+ }
+ _g_free0 (uri);
+ _g_object_unref0 (file);
+ _g_free0 (path);
+ _g_free0 (filetype);
+ break;
+ }
+ default:
+ {
+ guint _tmp27_;
+ _tmp27_ = target_type;
+ g_warning ("ui.vala:1586: Invalid DND target type %u", _tmp27_);
+ break;
+ }
+ }
+ _page_unref0 (page);
+}
+
+
+static void value_drag_and_drop_handler_init (GValue* value) {
+ value->data[0].v_pointer = NULL;
+}
+
+
+static void value_drag_and_drop_handler_free_value (GValue* value) {
+ if (value->data[0].v_pointer) {
+ drag_and_drop_handler_unref (value->data[0].v_pointer);
+ }
+}
+
+
+static void value_drag_and_drop_handler_copy_value (const GValue* src_value, GValue* dest_value) {
+ if (src_value->data[0].v_pointer) {
+ dest_value->data[0].v_pointer = drag_and_drop_handler_ref (src_value->data[0].v_pointer);
+ } else {
+ dest_value->data[0].v_pointer = NULL;
+ }
+}
+
+
+static gpointer value_drag_and_drop_handler_peek_pointer (const GValue* value) {
+ return value->data[0].v_pointer;
+}
+
+
+static gchar* value_drag_and_drop_handler_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
+ if (collect_values[0].v_pointer) {
+ DragAndDropHandler* object;
+ object = collect_values[0].v_pointer;
+ if (object->parent_instance.g_class == NULL) {
+ return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+ } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+ return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+ }
+ value->data[0].v_pointer = drag_and_drop_handler_ref (object);
+ } else {
+ value->data[0].v_pointer = NULL;
+ }
+ return NULL;
+}
+
+
+static gchar* value_drag_and_drop_handler_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
+ DragAndDropHandler** object_p;
+ object_p = collect_values[0].v_pointer;
+ if (!object_p) {
+ return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+ }
+ if (!value->data[0].v_pointer) {
+ *object_p = NULL;
+ } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+ *object_p = value->data[0].v_pointer;
+ } else {
+ *object_p = drag_and_drop_handler_ref (value->data[0].v_pointer);
+ }
+ return NULL;
+}
+
+
+GParamSpec* param_spec_drag_and_drop_handler (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
+ ParamSpecDragAndDropHandler* spec;
+ g_return_val_if_fail (g_type_is_a (object_type, TYPE_DRAG_AND_DROP_HANDLER), NULL);
+ spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+ G_PARAM_SPEC (spec)->value_type = object_type;
+ return G_PARAM_SPEC (spec);
+}
+
+
+gpointer value_get_drag_and_drop_handler (const GValue* value) {
+ g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_DRAG_AND_DROP_HANDLER), NULL);
+ return value->data[0].v_pointer;
+}
+
+
+void value_set_drag_and_drop_handler (GValue* value, gpointer v_object) {
+ DragAndDropHandler* old;
+ g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_DRAG_AND_DROP_HANDLER));
+ old = value->data[0].v_pointer;
+ if (v_object) {
+ g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_DRAG_AND_DROP_HANDLER));
+ g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
+ value->data[0].v_pointer = v_object;
+ drag_and_drop_handler_ref (value->data[0].v_pointer);
+ } else {
+ value->data[0].v_pointer = NULL;
+ }
+ if (old) {
+ drag_and_drop_handler_unref (old);
+ }
+}
+
+
+void value_take_drag_and_drop_handler (GValue* value, gpointer v_object) {
+ DragAndDropHandler* old;
+ g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_DRAG_AND_DROP_HANDLER));
+ old = value->data[0].v_pointer;
+ if (v_object) {
+ g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_DRAG_AND_DROP_HANDLER));
+ g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
+ value->data[0].v_pointer = v_object;
+ } else {
+ value->data[0].v_pointer = NULL;
+ }
+ if (old) {
+ drag_and_drop_handler_unref (old);
+ }
+}
+
+
+static void drag_and_drop_handler_class_init (DragAndDropHandlerClass * klass) {
+ drag_and_drop_handler_parent_class = g_type_class_peek_parent (klass);
+ DRAG_AND_DROP_HANDLER_CLASS (klass)->finalize = drag_and_drop_handler_finalize;
+ g_type_class_add_private (klass, sizeof (DragAndDropHandlerPrivate));
+}
+
+
+static void drag_and_drop_handler_instance_init (DragAndDropHandler * self) {
+ self->priv = DRAG_AND_DROP_HANDLER_GET_PRIVATE (self);
+ self->ref_count = 1;
+}
+
+
+static void drag_and_drop_handler_finalize (DragAndDropHandler* obj) {
+ DragAndDropHandler * self;
+ self = DRAG_AND_DROP_HANDLER (obj);
+ _g_object_unref0 (self->priv->book_view);
+}
+
+
+GType drag_and_drop_handler_get_type (void) {
+ static volatile gsize drag_and_drop_handler_type_id__volatile = 0;
+ if (g_once_init_enter (&drag_and_drop_handler_type_id__volatile)) {
+ static const GTypeValueTable g_define_type_value_table = { value_drag_and_drop_handler_init, value_drag_and_drop_handler_free_value, value_drag_and_drop_handler_copy_value, value_drag_and_drop_handler_peek_pointer, "p", value_drag_and_drop_handler_collect_value, "p", value_drag_and_drop_handler_lcopy_value };
+ static const GTypeInfo g_define_type_info = { sizeof (DragAndDropHandlerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) drag_and_drop_handler_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DragAndDropHandler), 0, (GInstanceInitFunc) drag_and_drop_handler_instance_init, &g_define_type_value_table };
static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
- GType simple_scan_type_id;
- simple_scan_type_id = g_type_register_fundamental (g_type_fundamental_next (), "SimpleScan", &g_define_type_info, &g_define_type_fundamental_info, 0);
- g_once_init_leave (&simple_scan_type_id__volatile, simple_scan_type_id);
+ GType drag_and_drop_handler_type_id;
+ drag_and_drop_handler_type_id = g_type_register_fundamental (g_type_fundamental_next (), "DragAndDropHandler", &g_define_type_info, &g_define_type_fundamental_info, 0);
+ g_once_init_leave (&drag_and_drop_handler_type_id__volatile, drag_and_drop_handler_type_id);
}
- return simple_scan_type_id__volatile;
+ return drag_and_drop_handler_type_id__volatile;
}
-gpointer simple_scan_ref (gpointer instance) {
- SimpleScan* self;
+gpointer drag_and_drop_handler_ref (gpointer instance) {
+ DragAndDropHandler* self;
self = instance;
g_atomic_int_inc (&self->ref_count);
return instance;
}
-void simple_scan_unref (gpointer instance) {
- SimpleScan* self;
+void drag_and_drop_handler_unref (gpointer instance) {
+ DragAndDropHandler* self;
self = instance;
if (g_atomic_int_dec_and_test (&self->ref_count)) {
- SIMPLE_SCAN_GET_CLASS (self)->finalize (self);
+ DRAG_AND_DROP_HANDLER_GET_CLASS (self)->finalize (self);
g_type_free_instance ((GTypeInstance *) self);
}
}
+gchar* get_temporary_filename (const gchar* prefix, const gchar* extension) {
+ gchar* result = NULL;
+ const gchar* _tmp0_;
+ const gchar* _tmp1_;
+ gchar* _tmp2_ = NULL;
+ gchar* filename;
+ gchar* path = NULL;
+ GError * _inner_error_ = NULL;
+ g_return_val_if_fail (prefix != NULL, NULL);
+ g_return_val_if_fail (extension != NULL, NULL);
+ _tmp0_ = prefix;
+ _tmp1_ = extension;
+ _tmp2_ = g_strdup_printf ("%sXXXXXX.%s", _tmp0_, _tmp1_);
+ filename = _tmp2_;
+ {
+ const gchar* _tmp3_;
+ gchar* _tmp4_ = NULL;
+ gint _tmp5_ = 0;
+ gint fd;
+ gint _tmp6_;
+ _tmp3_ = filename;
+ _tmp5_ = g_file_open_tmp (_tmp3_, &_tmp4_, &_inner_error_);
+ _g_free0 (path);
+ path = _tmp4_;
+ fd = _tmp5_;
+ if (_inner_error_ != NULL) {
+ goto __catch22_g_error;
+ }
+ _tmp6_ = fd;
+ close (_tmp6_);
+ }
+ goto __finally22;
+ __catch22_g_error:
+ {
+ GError* e = NULL;
+ GError* _tmp7_;
+ const gchar* _tmp8_;
+ e = _inner_error_;
+ _inner_error_ = NULL;
+ _tmp7_ = e;
+ _tmp8_ = _tmp7_->message;
+ g_warning ("ui.vala:1607: Error saving email attachment: %s", _tmp8_);
+ result = NULL;
+ _g_error_free0 (e);
+ _g_free0 (path);
+ _g_free0 (filename);
+ return result;
+ }
+ __finally22:
+ if (_inner_error_ != NULL) {
+ _g_free0 (path);
+ _g_free0 (filename);
+ 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);
+ g_clear_error (&_inner_error_);
+ return NULL;
+ }
+ result = path;
+ _g_free0 (filename);
+ return result;
+}
+
+
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
if ((array != NULL) && (destroy_func != NULL)) {
int i;
diff --git a/src/ui.vala b/src/ui.vala
index db19d77..41b33b1 100644
--- a/src/ui.vala
+++ b/src/ui.vala
@@ -9,7 +9,7 @@
* license.
*/
-public class SimpleScan
+public class UserInterface
{
private const int DEFAULT_TEXT_DPI = 150;
private const int DEFAULT_PHOTO_DPI = 300;
@@ -60,6 +60,8 @@ public class SimpleScan
private bool user_selected_device;
private Gtk.FileChooserDialog? save_dialog;
+ private ProgressBarDialog progress_dialog;
+ private DragAndDropHandler dnd_handler = null;
private bool have_error;
private string error_title;
@@ -88,9 +90,8 @@ public class SimpleScan
public signal void start_scan (string? device, ScanOptions options);
public signal void stop_scan ();
public signal void email (string profile);
- public signal void quit ();
- public SimpleScan ()
+ public UserInterface ()
{
book = new Book ();
book.page_removed.connect (page_removed_cb);
@@ -455,12 +456,14 @@ public class SimpleScan
else if (uri_lower.has_suffix (".tif") || uri_lower.has_suffix (".tiff"))
format = "tiff";
+ show_progress_dialog ();
try
{
book.save (format, file);
}
catch (Error e)
{
+ hide_progress_dialog ();
warning ("Error saving file: %s", e.message);
show_error (/* Title of error dialog when save failed */
_("Failed to save file"),
@@ -771,28 +774,6 @@ public class SimpleScan
updating_page_menu = false;
}
- // FIXME: Duplicated from simple-scan.vala
- private string? get_temporary_filename (string prefix, string extension)
- {
- /* NOTE: I'm not sure if this is a 100% safe strategy to use g_file_open_tmp(), close and
- * use the filename but it appears to work in practise */
-
- var filename = "%sXXXXXX.%s".printf (prefix, extension);
- string path;
- try
- {
- var fd = FileUtils.open_tmp (filename, out path);
- Posix.close (fd);
- }
- catch (Error e)
- {
- warning ("Error saving email attachment: %s", e.message);
- return null;
- }
-
- return path;
- }
-
private void show_page_cb (BookView view, Page page)
{
var path = get_temporary_filename ("scanned-page", "tiff");
@@ -1118,7 +1099,7 @@ public class SimpleScan
settings.set_int ("page-height", default_page_height);
settings.set_int ("page-dpi", default_page_dpi);
- quit ();
+ window.destroy ();
return true;
}
@@ -1269,6 +1250,8 @@ public class SimpleScan
builder.connect_signals (this);
window = (Gtk.Window) builder.get_object ("simple_scan_window");
+ var app = Application.get_default () as Gtk.Application;
+ app.add_window (window);
main_vbox = (Gtk.VBox) builder.get_object ("main_vbox");
page_move_left_menuitem = (Gtk.MenuItem) builder.get_object ("page_move_left_menuitem");
page_move_right_menuitem = (Gtk.MenuItem) builder.get_object ("page_move_right_menuitem");
@@ -1418,6 +1401,41 @@ public class SimpleScan
add_default_page ();
book.set_needs_saving (false);
book.needs_saving_changed.connect (needs_saving_cb);
+
+ progress_dialog = new ProgressBarDialog (window, _("Saving document..."));
+ book.saving.connect (book_saving_cb);
+
+ dnd_handler = new DragAndDropHandler (book_view);
+ }
+
+ private void book_saving_cb (int page_number)
+ {
+ /* Prevent GUI from freezing */
+ while (Gtk.events_pending ())
+ Gtk.main_iteration ();
+
+ var total = (int) book.get_n_pages ();
+ var fraction = (page_number + 1.0) / total;
+ var complete = fraction == 1.0;
+ if (complete)
+ Timeout.add(500, () => {
+ progress_dialog.hide();
+ return false;
+ });
+ var message = _("Saving page %d out of %d").printf (page_number + 1, total);
+
+ progress_dialog.set_fraction (fraction);
+ progress_dialog.set_message (message);
+ }
+
+ public void show_progress_dialog ()
+ {
+ progress_dialog.show ();
+ }
+
+ public void hide_progress_dialog ()
+ {
+ progress_dialog.hide ();
}
public Book get_book ()
@@ -1457,3 +1475,139 @@ public class SimpleScan
window.show ();
}
}
+
+class ProgressBarDialog : Gtk.Window
+{
+ Gtk.ProgressBar bar;
+
+ public ProgressBarDialog (Gtk.Window parent, string title)
+ {
+ bar = new Gtk.ProgressBar ();
+ var hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 5);
+ var vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 5);
+ hbox.set_hexpand (true);
+
+ bar.set_text ("");
+ bar.set_show_text (true);
+ bar.set_size_request (225, 25);
+ set_size_request (250, 50);
+
+ vbox.pack_start (bar, true, false, 0);
+ hbox.pack_start (vbox, true, false, 0);
+ add (hbox);
+ set_title (title);
+
+ set_transient_for (parent);
+ set_position (Gtk.WindowPosition.CENTER_ON_PARENT);
+ set_modal (true);
+ set_resizable (false);
+
+ hbox.show ();
+ vbox.show ();
+ bar.show ();
+ }
+
+ public void set_fraction (double percent)
+ {
+ bar.set_fraction (percent);
+ }
+
+ public void set_message (string message)
+ {
+ bar.set_text (message);
+ }
+}
+
+class DragAndDropHandler
+{
+ private enum TargetType
+ {
+ IMAGE,
+ URI
+ }
+
+ private BookView book_view;
+
+ public DragAndDropHandler (BookView book_view)
+ {
+ this.book_view = book_view;
+ var event_source = book_view.get_event_source ();
+
+ set_targets (event_source);
+ event_source.drag_data_get.connect (on_drag_data_get);
+ }
+
+ private void set_targets (Gtk.Widget event_source)
+ {
+ var table = new Gtk.TargetEntry [0];
+ var targets = new Gtk.TargetList (table);
+ targets.add_uri_targets (TargetType.URI);
+ targets.add_image_targets (TargetType.IMAGE, true);
+
+ Gtk.drag_source_set (event_source, Gdk.ModifierType.BUTTON1_MASK, table, Gdk.DragAction.COPY);
+ Gtk.drag_source_set_target_list (event_source, targets);
+ }
+
+ private void on_drag_data_get (Gdk.DragContext context, Gtk.SelectionData selection, uint target_type, uint time)
+ {
+ var page = book_view.get_selected ();
+ return_if_fail (page != null);
+
+ switch (target_type)
+ {
+ case TargetType.IMAGE:
+ var image = page.get_image (true);
+ selection.set_pixbuf (image);
+
+ debug ("Saving page to pixbuf");
+ break;
+
+ case TargetType.URI:
+ var filetype = "png";
+ var path = get_temporary_filename ("scanned-page", filetype);
+ return_if_fail (path != null);
+
+ var file = File.new_for_path (path);
+ var uri = file.get_uri ();
+
+ try
+ {
+ page.save (filetype, file);
+ selection.set_uris ({ uri });
+ debug ("Saving page to %s", uri);
+ }
+ catch (Error e)
+ {
+ warning ("Unable to save file using drag-drop %s", e.message);
+ }
+ break;
+
+ default:
+ warning ("Invalid DND target type %u", target_type);
+ break;
+ }
+ }
+}
+
+// FIXME: Duplicated from simple-scan.vala
+private string? get_temporary_filename (string prefix, string extension)
+{
+ /* NOTE: I'm not sure if this is a 100% safe strategy to use g_file_open_tmp(), close and
+ * use the filename but it appears to work in practise */
+
+ var filename = "%sXXXXXX.%s".printf (prefix, extension);
+ string path;
+ try
+ {
+ var fd = FileUtils.open_tmp (filename, out path);
+ Posix.close (fd);
+ }
+ catch (Error e)
+ {
+ warning ("Error saving email attachment: %s", e.message);
+ return null;
+ }
+
+ return path;
+}
+