summaryrefslogtreecommitdiff
path: root/src/scanner.c
diff options
context:
space:
mode:
authorAlessio Treglia <alessio@debian.org>2013-01-15 00:46:35 +0000
committerAlessio Treglia <alessio@debian.org>2013-01-15 00:46:35 +0000
commitb99db4e5834bb8668c249bb7ce30af9a4d23527e (patch)
tree59506788a14a1d2fdabc08516882b19981260a6d /src/scanner.c
parent026e231507aa5dae486255b6450b410f37e3abb0 (diff)
Imported Upstream version 3.6.0upstream/3.6.0
Diffstat (limited to 'src/scanner.c')
-rw-r--r--src/scanner.c631
1 files changed, 376 insertions, 255 deletions
diff --git a/src/scanner.c b/src/scanner.c
index e80ae99..8319ee3 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -1,4 +1,4 @@
-/* scanner.c generated by valac 0.16.1, the Vala compiler
+/* scanner.c generated by valac 0.17.7, the Vala compiler
* generated from scanner.vala, do not modify */
/*
@@ -261,6 +261,7 @@ typedef struct _NotifyGotPageInfo NotifyGotPageInfo;
typedef struct _NotifyGotPageInfoClass NotifyGotPageInfoClass;
typedef struct _NotifyGotPageInfoPrivate NotifyGotPageInfoPrivate;
#define _scan_page_info_unref0(var) ((var == NULL) ? NULL : (var = (scan_page_info_unref (var), NULL)))
+typedef struct _ScannerPrivate ScannerPrivate;
#define TYPE_NOTIFY_PAGE_DONE (notify_page_done_get_type ())
#define NOTIFY_PAGE_DONE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NOTIFY_PAGE_DONE, NotifyPageDone))
@@ -284,7 +285,6 @@ typedef struct _NotifyGotLine NotifyGotLine;
typedef struct _NotifyGotLineClass NotifyGotLineClass;
typedef struct _NotifyGotLinePrivate NotifyGotLinePrivate;
#define _scan_line_unref0(var) ((var == NULL) ? NULL : (var = (scan_line_unref (var), NULL)))
-typedef struct _ScannerPrivate ScannerPrivate;
#define _g_async_queue_unref0(var) ((var == NULL) ? NULL : (var = (g_async_queue_unref (var), NULL)))
#define __g_list_free__scan_job_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__scan_job_unref0_ (var), NULL)))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
@@ -397,6 +397,7 @@ struct _ScanJob {
GTypeInstance parent_instance;
volatile int ref_count;
ScanJobPrivate * priv;
+ gint id;
gchar* device;
gdouble dpi;
ScanMode scan_mode;
@@ -587,9 +588,23 @@ struct _NotifyGotPageInfoClass {
};
struct _NotifyGotPageInfoPrivate {
+ gint job_id;
ScanPageInfo* info;
};
+struct _Scanner {
+ GTypeInstance parent_instance;
+ volatile int ref_count;
+ ScannerPrivate * priv;
+ gint first_job_id;
+ gint job_id;
+};
+
+struct _ScannerClass {
+ GTypeClass parent_class;
+ void (*finalize) (Scanner *self);
+};
+
struct _NotifyPageDone {
Notify parent_instance;
NotifyPageDonePrivate * priv;
@@ -599,6 +614,10 @@ struct _NotifyPageDoneClass {
NotifyClass parent_class;
};
+struct _NotifyPageDonePrivate {
+ gint job_id;
+};
+
struct _NotifyGotLine {
Notify parent_instance;
NotifyGotLinePrivate * priv;
@@ -609,20 +628,10 @@ struct _NotifyGotLineClass {
};
struct _NotifyGotLinePrivate {
+ gint job_id;
ScanLine* line;
};
-struct _Scanner {
- GTypeInstance parent_instance;
- volatile int ref_count;
- ScannerPrivate * priv;
-};
-
-struct _ScannerClass {
- GTypeClass parent_class;
- void (*finalize) (Scanner *self);
-};
-
struct _ScannerPrivate {
GThread* thread;
GAsyncQueue* request_queue;
@@ -875,24 +884,26 @@ GType notify_got_page_info_get_type (void) G_GNUC_CONST;
enum {
NOTIFY_GOT_PAGE_INFO_DUMMY_PROPERTY
};
-NotifyGotPageInfo* notify_got_page_info_new (ScanPageInfo* info);
-NotifyGotPageInfo* notify_got_page_info_construct (GType object_type, ScanPageInfo* info);
+NotifyGotPageInfo* notify_got_page_info_new (gint job_id, ScanPageInfo* info);
+NotifyGotPageInfo* notify_got_page_info_construct (GType object_type, gint job_id, ScanPageInfo* info);
static void notify_got_page_info_real_run (Notify* base, Scanner* scanner);
static void notify_got_page_info_finalize (Notify* obj);
GType notify_page_done_get_type (void) G_GNUC_CONST;
+#define NOTIFY_PAGE_DONE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_NOTIFY_PAGE_DONE, NotifyPageDonePrivate))
enum {
NOTIFY_PAGE_DONE_DUMMY_PROPERTY
};
+NotifyPageDone* notify_page_done_new (gint job_id);
+NotifyPageDone* notify_page_done_construct (GType object_type, gint job_id);
static void notify_page_done_real_run (Notify* base, Scanner* scanner);
-NotifyPageDone* notify_page_done_new (void);
-NotifyPageDone* notify_page_done_construct (GType object_type);
+static void notify_page_done_finalize (Notify* obj);
GType notify_got_line_get_type (void) G_GNUC_CONST;
#define NOTIFY_GOT_LINE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_NOTIFY_GOT_LINE, NotifyGotLinePrivate))
enum {
NOTIFY_GOT_LINE_DUMMY_PROPERTY
};
-NotifyGotLine* notify_got_line_new (ScanLine* line);
-NotifyGotLine* notify_got_line_construct (GType object_type, ScanLine* line);
+NotifyGotLine* notify_got_line_new (gint job_id, ScanLine* line);
+NotifyGotLine* notify_got_line_construct (GType object_type, gint job_id, ScanLine* line);
static void notify_got_line_real_run (Notify* base, Scanner* scanner);
static void notify_got_line_finalize (Notify* obj);
#define SCANNER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_SCANNER, ScannerPrivate))
@@ -1087,7 +1098,7 @@ static void scan_device_instance_init (ScanDevice * self) {
static void scan_device_finalize (ScanDevice* obj) {
ScanDevice * self;
- self = SCAN_DEVICE (obj);
+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SCAN_DEVICE, ScanDevice);
_g_free0 (self->name);
_g_free0 (self->label);
}
@@ -1260,7 +1271,7 @@ static void scan_page_info_instance_init (ScanPageInfo * self) {
static void scan_page_info_finalize (ScanPageInfo* obj) {
ScanPageInfo * self;
- self = SCAN_PAGE_INFO (obj);
+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SCAN_PAGE_INFO, ScanPageInfo);
_g_free0 (self->device);
}
@@ -1432,7 +1443,7 @@ static void scan_line_instance_init (ScanLine * self) {
static void scan_line_finalize (ScanLine* obj) {
ScanLine * self;
- self = SCAN_LINE (obj);
+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SCAN_LINE, ScanLine);
self->data = (g_free (self->data), NULL);
}
@@ -1628,7 +1639,7 @@ static void scan_options_instance_init (ScanOptions * self) {
static void scan_options_finalize (ScanOptions* obj) {
ScanOptions * self;
- self = SCAN_OPTIONS (obj);
+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SCAN_OPTIONS, ScanOptions);
}
@@ -1799,7 +1810,7 @@ static void scan_job_instance_init (ScanJob * self) {
static void scan_job_finalize (ScanJob* obj) {
ScanJob * self;
- self = SCAN_JOB (obj);
+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SCAN_JOB, ScanJob);
_g_free0 (self->device);
}
@@ -1971,7 +1982,7 @@ static void request_instance_init (Request * self) {
static void request_finalize (Request* obj) {
Request * self;
- self = REQUEST (obj);
+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_REQUEST, Request);
}
@@ -2097,7 +2108,7 @@ static void request_start_scan_instance_init (RequestStartScan * self) {
static void request_start_scan_finalize (Request* obj) {
RequestStartScan * self;
- self = REQUEST_START_SCAN (obj);
+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_REQUEST_START_SCAN, RequestStartScan);
_scan_job_unref0 (self->job);
REQUEST_CLASS (request_start_scan_parent_class)->finalize (obj);
}
@@ -2283,7 +2294,7 @@ static void credentials_instance_init (Credentials * self) {
static void credentials_finalize (Credentials* obj) {
Credentials * self;
- self = CREDENTIALS (obj);
+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_CREDENTIALS, Credentials);
_g_free0 (self->username);
_g_free0 (self->password);
}
@@ -2480,7 +2491,7 @@ static void notify_instance_init (Notify * self) {
static void notify_finalize (Notify* obj) {
Notify * self;
- self = NOTIFY (obj);
+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_NOTIFY, Notify);
}
@@ -2616,7 +2627,7 @@ static void notify_update_devices_instance_init (NotifyUpdateDevices * self) {
static void notify_update_devices_finalize (Notify* obj) {
NotifyUpdateDevices * self;
- self = NOTIFY_UPDATE_DEVICES (obj);
+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_NOTIFY_UPDATE_DEVICES, NotifyUpdateDevices);
__g_list_free__scan_device_unref0_0 (self->priv->devices);
NOTIFY_CLASS (notify_update_devices_parent_class)->finalize (obj);
}
@@ -2680,7 +2691,7 @@ static void notify_request_authorization_instance_init (NotifyRequestAuthorizati
static void notify_request_authorization_finalize (Notify* obj) {
NotifyRequestAuthorization * self;
- self = NOTIFY_REQUEST_AUTHORIZATION (obj);
+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_NOTIFY_REQUEST_AUTHORIZATION, NotifyRequestAuthorization);
_g_free0 (self->priv->resource);
NOTIFY_CLASS (notify_request_authorization_parent_class)->finalize (obj);
}
@@ -2749,7 +2760,7 @@ static void notify_scan_failed_instance_init (NotifyScanFailed * self) {
static void notify_scan_failed_finalize (Notify* obj) {
NotifyScanFailed * self;
- self = NOTIFY_SCAN_FAILED (obj);
+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_NOTIFY_SCAN_FAILED, NotifyScanFailed);
_g_free0 (self->priv->error_string);
NOTIFY_CLASS (notify_scan_failed_parent_class)->finalize (obj);
}
@@ -2860,34 +2871,59 @@ static gpointer _scan_page_info_ref0 (gpointer self) {
}
-NotifyGotPageInfo* notify_got_page_info_construct (GType object_type, ScanPageInfo* info) {
+NotifyGotPageInfo* notify_got_page_info_construct (GType object_type, gint job_id, ScanPageInfo* info) {
NotifyGotPageInfo* self = NULL;
- ScanPageInfo* _tmp0_;
+ gint _tmp0_;
ScanPageInfo* _tmp1_;
+ ScanPageInfo* _tmp2_;
g_return_val_if_fail (info != NULL, NULL);
self = (NotifyGotPageInfo*) notify_construct (object_type);
- _tmp0_ = info;
- _tmp1_ = _scan_page_info_ref0 (_tmp0_);
+ _tmp0_ = job_id;
+ self->priv->job_id = _tmp0_;
+ _tmp1_ = info;
+ _tmp2_ = _scan_page_info_ref0 (_tmp1_);
_scan_page_info_unref0 (self->priv->info);
- self->priv->info = _tmp1_;
+ self->priv->info = _tmp2_;
return self;
}
-NotifyGotPageInfo* notify_got_page_info_new (ScanPageInfo* info) {
- return notify_got_page_info_construct (TYPE_NOTIFY_GOT_PAGE_INFO, info);
+NotifyGotPageInfo* notify_got_page_info_new (gint job_id, ScanPageInfo* info) {
+ return notify_got_page_info_construct (TYPE_NOTIFY_GOT_PAGE_INFO, job_id, info);
}
static void notify_got_page_info_real_run (Notify* base, Scanner* scanner) {
NotifyGotPageInfo * self;
- Scanner* _tmp0_;
- ScanPageInfo* _tmp1_;
+ gboolean _tmp0_ = FALSE;
+ gint _tmp1_;
+ Scanner* _tmp2_;
+ gint _tmp3_;
+ gboolean _tmp7_;
self = (NotifyGotPageInfo*) base;
g_return_if_fail (scanner != NULL);
- _tmp0_ = scanner;
- _tmp1_ = self->priv->info;
- g_signal_emit_by_name (_tmp0_, "got-page-info", _tmp1_);
+ _tmp1_ = self->priv->job_id;
+ _tmp2_ = scanner;
+ _tmp3_ = _tmp2_->first_job_id;
+ if (_tmp1_ >= _tmp3_) {
+ gint _tmp4_;
+ Scanner* _tmp5_;
+ gint _tmp6_;
+ _tmp4_ = self->priv->job_id;
+ _tmp5_ = scanner;
+ _tmp6_ = _tmp5_->job_id;
+ _tmp0_ = _tmp4_ < _tmp6_;
+ } else {
+ _tmp0_ = FALSE;
+ }
+ _tmp7_ = _tmp0_;
+ if (_tmp7_) {
+ Scanner* _tmp8_;
+ ScanPageInfo* _tmp9_;
+ _tmp8_ = scanner;
+ _tmp9_ = self->priv->info;
+ g_signal_emit_by_name (_tmp8_, "got-page-info", _tmp9_);
+ }
}
@@ -2906,7 +2942,7 @@ static void notify_got_page_info_instance_init (NotifyGotPageInfo * self) {
static void notify_got_page_info_finalize (Notify* obj) {
NotifyGotPageInfo * self;
- self = NOTIFY_GOT_PAGE_INFO (obj);
+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_NOTIFY_GOT_PAGE_INFO, NotifyGotPageInfo);
_scan_page_info_unref0 (self->priv->info);
NOTIFY_CLASS (notify_got_page_info_parent_class)->finalize (obj);
}
@@ -2924,35 +2960,70 @@ GType notify_got_page_info_get_type (void) {
}
-static void notify_page_done_real_run (Notify* base, Scanner* scanner) {
- NotifyPageDone * self;
- Scanner* _tmp0_;
- self = (NotifyPageDone*) base;
- g_return_if_fail (scanner != NULL);
- _tmp0_ = scanner;
- g_signal_emit_by_name (_tmp0_, "page-done");
-}
-
-
-NotifyPageDone* notify_page_done_construct (GType object_type) {
+NotifyPageDone* notify_page_done_construct (GType object_type, gint job_id) {
NotifyPageDone* self = NULL;
+ gint _tmp0_;
self = (NotifyPageDone*) notify_construct (object_type);
+ _tmp0_ = job_id;
+ self->priv->job_id = _tmp0_;
return self;
}
-NotifyPageDone* notify_page_done_new (void) {
- return notify_page_done_construct (TYPE_NOTIFY_PAGE_DONE);
+NotifyPageDone* notify_page_done_new (gint job_id) {
+ return notify_page_done_construct (TYPE_NOTIFY_PAGE_DONE, job_id);
+}
+
+
+static void notify_page_done_real_run (Notify* base, Scanner* scanner) {
+ NotifyPageDone * self;
+ gboolean _tmp0_ = FALSE;
+ gint _tmp1_;
+ Scanner* _tmp2_;
+ gint _tmp3_;
+ gboolean _tmp7_;
+ self = (NotifyPageDone*) base;
+ g_return_if_fail (scanner != NULL);
+ _tmp1_ = self->priv->job_id;
+ _tmp2_ = scanner;
+ _tmp3_ = _tmp2_->first_job_id;
+ if (_tmp1_ >= _tmp3_) {
+ gint _tmp4_;
+ Scanner* _tmp5_;
+ gint _tmp6_;
+ _tmp4_ = self->priv->job_id;
+ _tmp5_ = scanner;
+ _tmp6_ = _tmp5_->job_id;
+ _tmp0_ = _tmp4_ < _tmp6_;
+ } else {
+ _tmp0_ = FALSE;
+ }
+ _tmp7_ = _tmp0_;
+ if (_tmp7_) {
+ Scanner* _tmp8_;
+ _tmp8_ = scanner;
+ g_signal_emit_by_name (_tmp8_, "page-done");
+ }
}
static void notify_page_done_class_init (NotifyPageDoneClass * klass) {
notify_page_done_parent_class = g_type_class_peek_parent (klass);
+ NOTIFY_CLASS (klass)->finalize = notify_page_done_finalize;
+ g_type_class_add_private (klass, sizeof (NotifyPageDonePrivate));
NOTIFY_CLASS (klass)->run = notify_page_done_real_run;
}
static void notify_page_done_instance_init (NotifyPageDone * self) {
+ self->priv = NOTIFY_PAGE_DONE_GET_PRIVATE (self);
+}
+
+
+static void notify_page_done_finalize (Notify* obj) {
+ NotifyPageDone * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_NOTIFY_PAGE_DONE, NotifyPageDone);
+ NOTIFY_CLASS (notify_page_done_parent_class)->finalize (obj);
}
@@ -2973,34 +3044,59 @@ static gpointer _scan_line_ref0 (gpointer self) {
}
-NotifyGotLine* notify_got_line_construct (GType object_type, ScanLine* line) {
+NotifyGotLine* notify_got_line_construct (GType object_type, gint job_id, ScanLine* line) {
NotifyGotLine* self = NULL;
- ScanLine* _tmp0_;
+ gint _tmp0_;
ScanLine* _tmp1_;
+ ScanLine* _tmp2_;
g_return_val_if_fail (line != NULL, NULL);
self = (NotifyGotLine*) notify_construct (object_type);
- _tmp0_ = line;
- _tmp1_ = _scan_line_ref0 (_tmp0_);
+ _tmp0_ = job_id;
+ self->priv->job_id = _tmp0_;
+ _tmp1_ = line;
+ _tmp2_ = _scan_line_ref0 (_tmp1_);
_scan_line_unref0 (self->priv->line);
- self->priv->line = _tmp1_;
+ self->priv->line = _tmp2_;
return self;
}
-NotifyGotLine* notify_got_line_new (ScanLine* line) {
- return notify_got_line_construct (TYPE_NOTIFY_GOT_LINE, line);
+NotifyGotLine* notify_got_line_new (gint job_id, ScanLine* line) {
+ return notify_got_line_construct (TYPE_NOTIFY_GOT_LINE, job_id, line);
}
static void notify_got_line_real_run (Notify* base, Scanner* scanner) {
NotifyGotLine * self;
- Scanner* _tmp0_;
- ScanLine* _tmp1_;
+ gboolean _tmp0_ = FALSE;
+ gint _tmp1_;
+ Scanner* _tmp2_;
+ gint _tmp3_;
+ gboolean _tmp7_;
self = (NotifyGotLine*) base;
g_return_if_fail (scanner != NULL);
- _tmp0_ = scanner;
- _tmp1_ = self->priv->line;
- g_signal_emit_by_name (_tmp0_, "got-line", _tmp1_);
+ _tmp1_ = self->priv->job_id;
+ _tmp2_ = scanner;
+ _tmp3_ = _tmp2_->first_job_id;
+ if (_tmp1_ >= _tmp3_) {
+ gint _tmp4_;
+ Scanner* _tmp5_;
+ gint _tmp6_;
+ _tmp4_ = self->priv->job_id;
+ _tmp5_ = scanner;
+ _tmp6_ = _tmp5_->job_id;
+ _tmp0_ = _tmp4_ < _tmp6_;
+ } else {
+ _tmp0_ = FALSE;
+ }
+ _tmp7_ = _tmp0_;
+ if (_tmp7_) {
+ Scanner* _tmp8_;
+ ScanLine* _tmp9_;
+ _tmp8_ = scanner;
+ _tmp9_ = self->priv->line;
+ g_signal_emit_by_name (_tmp8_, "got-line", _tmp9_);
+ }
}
@@ -3019,7 +3115,7 @@ static void notify_got_line_instance_init (NotifyGotLine * self) {
static void notify_got_line_finalize (Notify* obj) {
NotifyGotLine * self;
- self = NOTIFY_GOT_LINE (obj);
+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_NOTIFY_GOT_LINE, NotifyGotLine);
_scan_line_unref0 (self->priv->line);
NOTIFY_CLASS (notify_got_line_parent_class)->finalize (obj);
}
@@ -3178,7 +3274,6 @@ static void scanner_set_scanning (Scanner* self, gboolean is_scanning) {
NotifyScanningChanged* _tmp12_;
_tmp10_ = is_scanning;
self->priv->scanning = _tmp10_;
- g_signal_emit_by_name (self, "scanning-changed");
_tmp11_ = notify_scanning_changed_new ();
_tmp12_ = _tmp11_;
scanner_notify (self, (Notify*) _tmp12_);
@@ -3483,7 +3578,7 @@ static void scanner_do_redetect (Scanner* self) {
_tmp2_ = status;
_tmp3_ = sane_status_to_string (_tmp2_);
_tmp4_ = _tmp3_;
- g_debug ("scanner.vala:317: sane_get_devices () -> %s", _tmp4_);
+ g_debug ("scanner.vala:334: sane_get_devices () -> %s", _tmp4_);
_g_free0 (_tmp4_);
_tmp5_ = status;
if (_tmp5_ != SANE_STATUS_GOOD) {
@@ -3491,7 +3586,7 @@ static void scanner_do_redetect (Scanner* self) {
const gchar* _tmp7_ = NULL;
_tmp6_ = status;
_tmp7_ = sane_strstatus (_tmp6_);
- g_warning ("scanner.vala:320: Unable to get SANE devices: %s", _tmp7_);
+ g_warning ("scanner.vala:337: Unable to get SANE devices: %s", _tmp7_);
self->priv->need_redetect = FALSE;
self->priv->state = SCAN_STATE_IDLE;
return;
@@ -3594,7 +3689,7 @@ static void scanner_do_redetect (Scanner* self) {
_tmp27_ = i;
_tmp28_ = _tmp26_[_tmp27_];
_tmp29_ = _tmp28_->type;
- g_debug ("scanner.vala:329: Device: name=\"%s\" vendor=\"%s\" model=\"%s\" type=" \
+ g_debug ("scanner.vala:346: Device: name=\"%s\" vendor=\"%s\" model=\"%s\" type=" \
"\"%s\"", _tmp17_, _tmp21_, _tmp25_, _tmp29_);
_tmp30_ = scan_device_new ();
scan_device = _tmp30_;
@@ -3710,7 +3805,7 @@ static gboolean scanner_set_default_option (Scanner* self, SANE_Handle handle, S
_tmp6_ = status;
_tmp7_ = sane_status_to_string (_tmp6_);
_tmp8_ = _tmp7_;
- g_debug ("scanner.vala:371: sane_control_option (%d, SANE_ACTION_SET_AUTO) -> %s", (gint) _tmp5_, _tmp8_);
+ g_debug ("scanner.vala:388: sane_control_option (%d, SANE_ACTION_SET_AUTO) -> %s", (gint) _tmp5_, _tmp8_);
_g_free0 (_tmp8_);
_tmp9_ = status;
if (_tmp9_ != SANE_STATUS_GOOD) {
@@ -3722,7 +3817,7 @@ static gboolean scanner_set_default_option (Scanner* self, SANE_Handle handle, S
_tmp11_ = _tmp10_->name;
_tmp12_ = status;
_tmp13_ = sane_strstatus (_tmp12_);
- g_warning ("scanner.vala:373: Error setting default option %s: %s", _tmp11_, _tmp13_);
+ g_warning ("scanner.vala:390: Error setting default option %s: %s", _tmp11_, _tmp13_);
}
_tmp14_ = status;
result = _tmp14_ == SANE_STATUS_GOOD;
@@ -3782,7 +3877,7 @@ static void scanner_set_bool_option (Scanner* self, SANE_Handle handle, SANE_Opt
_tmp14_ = sane_status_to_string (_tmp13_);
_tmp15_ = _tmp14_;
_tmp16_ = _tmp9_;
- g_debug ("scanner.vala:385: sane_control_option (%d, SANE_ACTION_SET_VALUE, %s) " \
+ g_debug ("scanner.vala:402: sane_control_option (%d, SANE_ACTION_SET_VALUE, %s) " \
"-> (%s, %s)", (gint) _tmp11_, _tmp12_, _tmp15_, _tmp16_);
_g_free0 (_tmp15_);
if (_result_) {
@@ -3962,7 +4057,7 @@ static void scanner_set_int_option (Scanner* self, SANE_Handle handle, SANE_Opti
_tmp54_ = sane_status_to_string (status);
_tmp55_ = _tmp54_;
_tmp56_ = v;
- g_debug ("scanner.vala:422: sane_control_option (%d, SANE_ACTION_SET_VALUE, %d) " \
+ g_debug ("scanner.vala:439: sane_control_option (%d, SANE_ACTION_SET_VALUE, %d) " \
"-> (%s, %d)", (gint) _tmp52_, _tmp53_, _tmp55_, (gint) _tmp56_);
_g_free0 (_tmp55_);
_tmp57_ = v;
@@ -4136,7 +4231,7 @@ static void scanner_set_fixed_option (Scanner* self, SANE_Handle handle, SANE_Op
_tmp50_ = sane_status_to_string (status);
_tmp51_ = _tmp50_;
_tmp52_ = SANE_UNFIX (v_fixed);
- g_debug ("scanner.vala:462: sane_control_option (%d, SANE_ACTION_SET_VALUE, %f) " \
+ g_debug ("scanner.vala:479: sane_control_option (%d, SANE_ACTION_SET_VALUE, %f) " \
"-> (%s, %f)", (gint) _tmp48_, _tmp49_, _tmp51_, _tmp52_);
_g_free0 (_tmp51_);
_tmp53_ = SANE_UNFIX (v_fixed);
@@ -4279,7 +4374,7 @@ static gboolean scanner_set_string_option (Scanner* self, SANE_Handle handle, SA
_tmp34_ = sane_status_to_string (status);
_tmp35_ = _tmp34_;
_tmp36_ = _vala_result;
- g_debug ("scanner.vala:480: sane_control_option (%d, SANE_ACTION_SET_VALUE, \"%s" \
+ g_debug ("scanner.vala:497: sane_control_option (%d, SANE_ACTION_SET_VALUE, \"%s" \
"\") -> (%s, \"%s\")", (gint) _tmp32_, _tmp33_, _tmp35_, _tmp36_);
_g_free0 (_tmp35_);
result = status == SANE_STATUS_GOOD;
@@ -5156,7 +5251,7 @@ static void scanner_log_option (Scanner* self, SANE_Int index, SANE_Option_Descr
}
}
_tmp214_ = s;
- g_debug ("scanner.vala:668: %s", _tmp214_);
+ g_debug ("scanner.vala:685: %s", _tmp214_);
_tmp215_ = option;
_tmp216_ = _tmp215_->desc;
if (_tmp216_ != NULL) {
@@ -5164,7 +5259,7 @@ static void scanner_log_option (Scanner* self, SANE_Int index, SANE_Option_Descr
const gchar* _tmp218_;
_tmp217_ = option;
_tmp218_ = _tmp217_->desc;
- g_debug ("scanner.vala:671: Description: %s", _tmp218_);
+ g_debug ("scanner.vala:688: Description: %s", _tmp218_);
}
_g_free0 (s);
}
@@ -5353,10 +5448,10 @@ static void scanner_close_device (Scanner* self) {
SANE_Handle _tmp2_;
_tmp1_ = self->priv->handle;
sane_cancel (_tmp1_);
- g_debug ("scanner.vala:698: sane_cancel ()");
+ g_debug ("scanner.vala:715: sane_cancel ()");
_tmp2_ = self->priv->handle;
sane_close (_tmp2_);
- g_debug ("scanner.vala:701: sane_close ()");
+ g_debug ("scanner.vala:718: sane_close ()");
self->priv->have_handle = FALSE;
_g_hash_table_unref0 (self->priv->options);
self->priv->options = NULL;
@@ -5459,11 +5554,11 @@ static gboolean scanner_handle_requests (Scanner* self) {
_request_unref0 (request);
return result;
}
- g_debug ("scanner.vala:736: Processing request");
+ g_debug ("scanner.vala:753: Processing request");
_tmp14_ = request_count;
request_count = _tmp14_ + 1;
_tmp15_ = request;
- if (IS_REQUEST_START_SCAN (_tmp15_)) {
+ if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp15_, TYPE_REQUEST_START_SCAN)) {
Request* _tmp16_;
RequestStartScan* _tmp17_;
RequestStartScan* r;
@@ -5471,7 +5566,7 @@ static gboolean scanner_handle_requests (Scanner* self) {
ScanJob* _tmp19_;
ScanJob* _tmp20_;
_tmp16_ = request;
- _tmp17_ = _request_ref0 (REQUEST_START_SCAN (_tmp16_));
+ _tmp17_ = _request_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp16_, TYPE_REQUEST_START_SCAN, RequestStartScan));
r = _tmp17_;
_tmp18_ = r;
_tmp19_ = _tmp18_->job;
@@ -5481,12 +5576,12 @@ static gboolean scanner_handle_requests (Scanner* self) {
} else {
Request* _tmp21_;
_tmp21_ = request;
- if (IS_REQUEST_CANCEL (_tmp21_)) {
+ if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp21_, TYPE_REQUEST_CANCEL)) {
scanner_fail_scan (self, (gint) SANE_STATUS_CANCELLED, "Scan cancelled - do not report this error");
} else {
Request* _tmp22_;
_tmp22_ = request;
- if (IS_REQUEST_QUIT (_tmp22_)) {
+ if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp22_, TYPE_REQUEST_QUIT)) {
scanner_close_device (self);
result = FALSE;
_request_unref0 (request);
@@ -5536,7 +5631,7 @@ static void scanner_do_open (Scanner* self) {
g_return_if_fail (self != NULL);
_tmp0_ = self->priv->job_queue;
_tmp1_ = _tmp0_->data;
- _tmp2_ = _scan_job_ref0 (SCAN_JOB ((ScanJob*) _tmp1_));
+ _tmp2_ = _scan_job_ref0 (G_TYPE_CHECK_INSTANCE_CAST ((ScanJob*) _tmp1_, TYPE_SCAN_JOB, ScanJob));
job = _tmp2_;
self->priv->line_count = 0;
self->priv->pass_number = 0;
@@ -5567,7 +5662,7 @@ static void scanner_do_open (Scanner* self) {
_tmp12_ = _tmp11_->device;
if (_tmp12_ == NULL) {
const gchar* _tmp13_ = NULL;
- g_warning ("scanner.vala:771: No scan device available");
+ g_warning ("scanner.vala:788: No scan device available");
_tmp13_ = _ ("No scanners available. Please connect a scanner.");
scanner_fail_scan (self, 0, _tmp13_);
_scan_job_unref0 (job);
@@ -5589,7 +5684,7 @@ static void scanner_do_open (Scanner* self) {
}
_tmp18_ = self->priv->handle;
sane_close (_tmp18_);
- g_debug ("scanner.vala:788: sane_close ()");
+ g_debug ("scanner.vala:805: sane_close ()");
self->priv->have_handle = FALSE;
}
_g_free0 (self->priv->current_device);
@@ -5610,7 +5705,7 @@ static void scanner_do_open (Scanner* self) {
_tmp28_ = status;
_tmp29_ = sane_status_to_string (_tmp28_);
_tmp30_ = _tmp29_;
- g_debug ("scanner.vala:797: sane_open (\"%s\") -> %s", _tmp27_, _tmp30_);
+ g_debug ("scanner.vala:814: sane_open (\"%s\") -> %s", _tmp27_, _tmp30_);
_g_free0 (_tmp30_);
_tmp31_ = status;
if (_tmp31_ != SANE_STATUS_GOOD) {
@@ -5620,7 +5715,7 @@ static void scanner_do_open (Scanner* self) {
const gchar* _tmp35_ = NULL;
_tmp32_ = status;
_tmp33_ = sane_strstatus (_tmp32_);
- g_warning ("scanner.vala:801: Unable to get open device: %s", _tmp33_);
+ g_warning ("scanner.vala:818: Unable to get open device: %s", _tmp33_);
_tmp34_ = status;
_tmp35_ = _ ("Unable to connect to scanner");
scanner_fail_scan (self, (gint) _tmp34_, _tmp35_);
@@ -5668,14 +5763,14 @@ static void scanner_do_get_option (Scanner* self) {
g_return_if_fail (self != NULL);
_tmp0_ = self->priv->job_queue;
_tmp1_ = _tmp0_->data;
- _tmp2_ = _scan_job_ref0 (SCAN_JOB ((ScanJob*) _tmp1_));
+ _tmp2_ = _scan_job_ref0 (G_TYPE_CHECK_INSTANCE_CAST ((ScanJob*) _tmp1_, TYPE_SCAN_JOB, ScanJob));
job = _tmp2_;
_tmp3_ = self->priv->handle;
_tmp4_ = self->priv->option_index;
_tmp5_ = sane_get_option_descriptor (_tmp3_, _tmp4_);
option = _tmp5_;
_tmp6_ = self->priv->option_index;
- g_debug ("scanner.vala:818: sane_get_option_descriptor (%d)", (gint) _tmp6_);
+ g_debug ("scanner.vala:835: sane_get_option_descriptor (%d)", (gint) _tmp6_);
_tmp7_ = self->priv->option_index;
index = _tmp7_;
_tmp8_ = self->priv->option_index;
@@ -5874,7 +5969,7 @@ static void scanner_do_get_option (Scanner* self) {
_tmp54__length1 = flatbed_sources_length1;
_tmp55_ = scanner_set_constrained_string_option (self, _tmp51_, _tmp52_, _tmp53_, _tmp54_, _tmp54__length1, NULL);
if (!_tmp55_) {
- g_warning ("scanner.vala:872: Unable to set single page source, please file a bug");
+ g_warning ("scanner.vala:889: Unable to set single page source, please file a bug");
}
}
break;
@@ -5907,7 +6002,7 @@ static void scanner_do_get_option (Scanner* self) {
_tmp64__length1 = adf_sources_length1;
_tmp65_ = scanner_set_constrained_string_option (self, _tmp61_, _tmp62_, _tmp63_, _tmp64_, _tmp64__length1, NULL);
if (!(!_tmp65_)) {
- g_warning ("scanner.vala:877: Unable to set front ADF source, please file a bug");
+ g_warning ("scanner.vala:894: Unable to set front ADF source, please file a bug");
}
}
break;
@@ -5940,7 +6035,7 @@ static void scanner_do_get_option (Scanner* self) {
_tmp74__length1 = adf_sources_length1;
_tmp75_ = scanner_set_constrained_string_option (self, _tmp71_, _tmp72_, _tmp73_, _tmp74_, _tmp74__length1, NULL);
if (!_tmp75_) {
- g_warning ("scanner.vala:882: Unable to set back ADF source, please file a bug");
+ g_warning ("scanner.vala:899: Unable to set back ADF source, please file a bug");
}
}
break;
@@ -5973,7 +6068,7 @@ static void scanner_do_get_option (Scanner* self) {
_tmp84__length1 = adf_sources_length1;
_tmp85_ = scanner_set_constrained_string_option (self, _tmp81_, _tmp82_, _tmp83_, _tmp84_, _tmp84__length1, NULL);
if (!_tmp85_) {
- g_warning ("scanner.vala:887: Unable to set duplex ADF source, please file a bug");
+ g_warning ("scanner.vala:904: Unable to set duplex ADF source, please file a bug");
}
}
break;
@@ -6122,7 +6217,7 @@ static void scanner_do_get_option (Scanner* self) {
_tmp130__length1 = color_scan_modes_length1;
_tmp131_ = scanner_set_constrained_string_option (self, _tmp127_, _tmp128_, _tmp129_, _tmp130_, _tmp130__length1, NULL);
if (!_tmp131_) {
- g_warning ("scanner.vala:933: Unable to set Color mode, please file a bug");
+ g_warning ("scanner.vala:950: Unable to set Color mode, please file a bug");
}
break;
}
@@ -6141,7 +6236,7 @@ static void scanner_do_get_option (Scanner* self) {
_tmp135__length1 = gray_scan_modes_length1;
_tmp136_ = scanner_set_constrained_string_option (self, _tmp132_, _tmp133_, _tmp134_, _tmp135_, _tmp135__length1, NULL);
if (!_tmp136_) {
- g_warning ("scanner.vala:937: Unable to set Gray mode, please file a bug");
+ g_warning ("scanner.vala:954: Unable to set Gray mode, please file a bug");
}
break;
}
@@ -6160,7 +6255,7 @@ static void scanner_do_get_option (Scanner* self) {
_tmp140__length1 = lineart_scan_modes_length1;
_tmp141_ = scanner_set_constrained_string_option (self, _tmp137_, _tmp138_, _tmp139_, _tmp140_, _tmp140__length1, NULL);
if (!_tmp141_) {
- g_warning ("scanner.vala:941: Unable to set Lineart mode, please file a bug");
+ g_warning ("scanner.vala:958: Unable to set Lineart mode, please file a bug");
}
break;
}
@@ -6264,7 +6359,7 @@ static void scanner_do_get_option (Scanner* self) {
_tmp178__length1 = disable_compression_names_length1;
_tmp179_ = scanner_set_constrained_string_option (self, _tmp175_, _tmp176_, _tmp177_, _tmp178_, _tmp178__length1, NULL);
if (!_tmp179_) {
- g_warning ("scanner.vala:977: Unable to disable compression, please file a bug");
+ g_warning ("scanner.vala:994: Unable to disable compression, please file a bug");
}
disable_compression_names = (_vala_array_free (disable_compression_names, disable_compression_names_length1, (GDestroyNotify) g_free), NULL);
}
@@ -6654,7 +6749,7 @@ static void scanner_do_get_option (Scanner* self) {
_tmp342_ = _tmp341_->name;
_tmp343_ = g_strdup (_tmp342_);
_tmp344_ = index;
- g_hash_table_insert (_tmp340_, _tmp343_, GINT_TO_POINTER ((gint) _tmp344_));
+ g_hash_table_insert (_tmp340_, _tmp343_, (gpointer) ((gintptr) ((gint) _tmp344_)));
_scan_job_unref0 (job);
}
@@ -6674,7 +6769,7 @@ static SANE_Option_Descriptor* scanner_get_option_by_name (Scanner* self, SANE_H
_tmp0_ = self->priv->options;
_tmp1_ = name;
_tmp2_ = g_hash_table_lookup (_tmp0_, _tmp1_);
- _vala_index = GPOINTER_TO_INT (_tmp2_);
+ _vala_index = (gint) ((gintptr) _tmp2_);
_tmp3_ = _vala_index;
if (_tmp3_ == 0) {
result = NULL;
@@ -6741,7 +6836,7 @@ static void scanner_do_start (Scanner* self) {
_tmp6_ = status;
_tmp7_ = sane_status_to_string (_tmp6_);
_tmp8_ = _tmp7_;
- g_debug ("scanner.vala:1124: sane_start (page=%d, pass=%d) -> %s", _tmp4_, _tmp5_, _tmp8_);
+ g_debug ("scanner.vala:1141: sane_start (page=%d, pass=%d) -> %s", _tmp4_, _tmp5_, _tmp8_);
_g_free0 (_tmp8_);
_tmp9_ = status;
if (_tmp9_ == SANE_STATUS_GOOD) {
@@ -6758,7 +6853,7 @@ static void scanner_do_start (Scanner* self) {
const gchar* _tmp14_ = NULL;
_tmp11_ = status;
_tmp12_ = sane_strstatus (_tmp11_);
- g_warning ("scanner.vala:1131: Unable to start device: %s", _tmp12_);
+ g_warning ("scanner.vala:1148: Unable to start device: %s", _tmp12_);
_tmp13_ = status;
_tmp14_ = _ ("Unable to start scan");
scanner_fail_scan (self, (gint) _tmp13_, _tmp14_);
@@ -6881,11 +6976,11 @@ static void scanner_do_get_parameters (Scanner* self) {
gchar* _tmp67_;
gint _tmp68_;
gint _tmp69_;
- SANE_Parameters _tmp74_;
- gint _tmp75_;
+ SANE_Parameters _tmp76_;
+ gint _tmp77_;
gint buffer_size;
- gint _tmp76_;
- guchar* _tmp77_ = NULL;
+ gint _tmp78_;
+ guchar* _tmp79_ = NULL;
g_return_if_fail (self != NULL);
_tmp0_ = self->priv->handle;
_tmp2_ = sane_get_parameters (_tmp0_, &_tmp1_);
@@ -6894,7 +6989,7 @@ static void scanner_do_get_parameters (Scanner* self) {
_tmp3_ = status;
_tmp4_ = sane_status_to_string (_tmp3_);
_tmp5_ = _tmp4_;
- g_debug ("scanner.vala:1141: sane_get_parameters () -> %s", _tmp5_);
+ g_debug ("scanner.vala:1158: sane_get_parameters () -> %s", _tmp5_);
_g_free0 (_tmp5_);
_tmp6_ = status;
if (_tmp6_ != SANE_STATUS_GOOD) {
@@ -6904,7 +6999,7 @@ static void scanner_do_get_parameters (Scanner* self) {
const gchar* _tmp10_ = NULL;
_tmp7_ = status;
_tmp8_ = sane_strstatus (_tmp7_);
- g_warning ("scanner.vala:1144: Unable to get device parameters: %s", _tmp8_);
+ g_warning ("scanner.vala:1161: Unable to get device parameters: %s", _tmp8_);
_tmp9_ = status;
_tmp10_ = _ ("Error communicating with scanner");
scanner_fail_scan (self, (gint) _tmp9_, _tmp10_);
@@ -6912,7 +7007,7 @@ static void scanner_do_get_parameters (Scanner* self) {
}
_tmp11_ = self->priv->job_queue;
_tmp12_ = _tmp11_->data;
- _tmp13_ = _scan_job_ref0 (SCAN_JOB ((ScanJob*) _tmp12_));
+ _tmp13_ = _scan_job_ref0 (G_TYPE_CHECK_INSTANCE_CAST ((ScanJob*) _tmp12_, TYPE_SCAN_JOB, ScanJob));
job = _tmp13_;
_tmp15_ = self->priv->parameters;
_tmp16_ = _tmp15_.last_frame;
@@ -6934,7 +7029,7 @@ static void scanner_do_get_parameters (Scanner* self) {
_tmp27_ = _tmp26_.lines;
_tmp28_ = self->priv->parameters;
_tmp29_ = _tmp28_.depth;
- g_debug ("scanner.vala:1153: Parameters: format=%s last_frame=%s bytes_per_line=" \
+ g_debug ("scanner.vala:1170: Parameters: format=%s last_frame=%s bytes_per_line=" \
"%d pixels_per_line=%d lines=%d depth=%d", _tmp20_, _tmp21_, _tmp23_, _tmp25_, _tmp27_, _tmp29_);
_g_free0 (_tmp20_);
_tmp30_ = scan_page_info_new ();
@@ -7014,26 +7109,30 @@ static void scanner_do_get_parameters (Scanner* self) {
_tmp68_ = self->priv->page_number;
_tmp69_ = self->priv->notified_page;
if (_tmp68_ != _tmp69_) {
- ScanPageInfo* _tmp70_;
- NotifyGotPageInfo* _tmp71_;
- NotifyGotPageInfo* _tmp72_;
- gint _tmp73_;
- _tmp70_ = info;
- _tmp71_ = notify_got_page_info_new (_tmp70_);
- _tmp72_ = _tmp71_;
- scanner_notify (self, (Notify*) _tmp72_);
- _notify_unref0 (_tmp72_);
- _tmp73_ = self->priv->page_number;
- self->priv->notified_page = _tmp73_;
- }
- _tmp74_ = self->priv->parameters;
- _tmp75_ = _tmp74_.bytes_per_line;
- buffer_size = _tmp75_ + 1;
- _tmp76_ = buffer_size;
- _tmp77_ = g_new0 (guchar, _tmp76_);
+ ScanJob* _tmp70_;
+ gint _tmp71_;
+ ScanPageInfo* _tmp72_;
+ NotifyGotPageInfo* _tmp73_;
+ NotifyGotPageInfo* _tmp74_;
+ gint _tmp75_;
+ _tmp70_ = job;
+ _tmp71_ = _tmp70_->id;
+ _tmp72_ = info;
+ _tmp73_ = notify_got_page_info_new (_tmp71_, _tmp72_);
+ _tmp74_ = _tmp73_;
+ scanner_notify (self, (Notify*) _tmp74_);
+ _notify_unref0 (_tmp74_);
+ _tmp75_ = self->priv->page_number;
+ self->priv->notified_page = _tmp75_;
+ }
+ _tmp76_ = self->priv->parameters;
+ _tmp77_ = _tmp76_.bytes_per_line;
+ buffer_size = _tmp77_ + 1;
+ _tmp78_ = buffer_size;
+ _tmp79_ = g_new0 (guchar, _tmp78_);
self->priv->buffer = (g_free (self->priv->buffer), NULL);
- self->priv->buffer = _tmp77_;
- self->priv->buffer_length1 = _tmp76_;
+ self->priv->buffer = _tmp79_;
+ self->priv->buffer_length1 = _tmp78_;
self->priv->_buffer_size_ = self->priv->buffer_length1;
self->priv->n_used = 0;
self->priv->line_count = 0;
@@ -7045,56 +7144,64 @@ static void scanner_do_get_parameters (Scanner* self) {
static void scanner_do_complete_page (Scanner* self) {
- NotifyPageDone* _tmp0_;
- NotifyPageDone* _tmp1_;
- GList* _tmp2_;
- gconstpointer _tmp3_;
- ScanJob* _tmp4_;
+ GList* _tmp0_;
+ gconstpointer _tmp1_;
+ ScanJob* _tmp2_;
ScanJob* job;
- SANE_Parameters _tmp5_;
- gboolean _tmp6_;
- ScanJob* _tmp8_;
- ScanType _tmp9_;
- SANE_Handle _tmp13_;
+ ScanJob* _tmp3_;
+ gint _tmp4_;
+ NotifyPageDone* _tmp5_;
+ NotifyPageDone* _tmp6_;
+ SANE_Parameters _tmp7_;
+ gboolean _tmp8_;
+ ScanJob* _tmp10_;
+ ScanType _tmp11_;
+ SANE_Handle _tmp17_;
g_return_if_fail (self != NULL);
- _tmp0_ = notify_page_done_new ();
- _tmp1_ = _tmp0_;
- scanner_notify (self, (Notify*) _tmp1_);
- _notify_unref0 (_tmp1_);
- _tmp2_ = self->priv->job_queue;
- _tmp3_ = _tmp2_->data;
- _tmp4_ = _scan_job_ref0 (SCAN_JOB ((ScanJob*) _tmp3_));
- job = _tmp4_;
- _tmp5_ = self->priv->parameters;
- _tmp6_ = _tmp5_.last_frame;
- if (!_tmp6_) {
- gint _tmp7_;
- _tmp7_ = self->priv->pass_number;
- self->priv->pass_number = _tmp7_ + 1;
+ _tmp0_ = self->priv->job_queue;
+ _tmp1_ = _tmp0_->data;
+ _tmp2_ = _scan_job_ref0 (G_TYPE_CHECK_INSTANCE_CAST ((ScanJob*) _tmp1_, TYPE_SCAN_JOB, ScanJob));
+ job = _tmp2_;
+ _tmp3_ = job;
+ _tmp4_ = _tmp3_->id;
+ _tmp5_ = notify_page_done_new (_tmp4_);
+ _tmp6_ = _tmp5_;
+ scanner_notify (self, (Notify*) _tmp6_);
+ _notify_unref0 (_tmp6_);
+ _tmp7_ = self->priv->parameters;
+ _tmp8_ = _tmp7_.last_frame;
+ if (!_tmp8_) {
+ gint _tmp9_;
+ _tmp9_ = self->priv->pass_number;
+ self->priv->pass_number = _tmp9_ + 1;
self->priv->state = SCAN_STATE_START;
_scan_job_unref0 (job);
return;
}
- _tmp8_ = job;
- _tmp9_ = _tmp8_->type;
- if (_tmp9_ != SCAN_TYPE_SINGLE) {
- gint _tmp10_;
- NotifyPageDone* _tmp11_;
- NotifyPageDone* _tmp12_;
- _tmp10_ = self->priv->page_number;
- self->priv->page_number = _tmp10_ + 1;
+ _tmp10_ = job;
+ _tmp11_ = _tmp10_->type;
+ if (_tmp11_ != SCAN_TYPE_SINGLE) {
+ gint _tmp12_;
+ ScanJob* _tmp13_;
+ gint _tmp14_;
+ NotifyPageDone* _tmp15_;
+ NotifyPageDone* _tmp16_;
+ _tmp12_ = self->priv->page_number;
+ self->priv->page_number = _tmp12_ + 1;
self->priv->pass_number = 0;
- _tmp11_ = notify_page_done_new ();
- _tmp12_ = _tmp11_;
- scanner_notify (self, (Notify*) _tmp12_);
- _notify_unref0 (_tmp12_);
+ _tmp13_ = job;
+ _tmp14_ = _tmp13_->id;
+ _tmp15_ = notify_page_done_new (_tmp14_);
+ _tmp16_ = _tmp15_;
+ scanner_notify (self, (Notify*) _tmp16_);
+ _notify_unref0 (_tmp16_);
self->priv->state = SCAN_STATE_START;
_scan_job_unref0 (job);
return;
}
- _tmp13_ = self->priv->handle;
- sane_cancel (_tmp13_);
- g_debug ("scanner.vala:1213: sane_cancel ()");
+ _tmp17_ = self->priv->handle;
+ sane_cancel (_tmp17_);
+ g_debug ("scanner.vala:1230: sane_cancel ()");
scanner_do_complete_document (self);
_scan_job_unref0 (job);
}
@@ -7139,7 +7246,7 @@ static void scanner_do_read (Scanner* self) {
g_return_if_fail (self != NULL);
_tmp0_ = self->priv->job_queue;
_tmp1_ = _tmp0_->data;
- _tmp2_ = _scan_job_ref0 (SCAN_JOB ((ScanJob*) _tmp1_));
+ _tmp2_ = _scan_job_ref0 (G_TYPE_CHECK_INSTANCE_CAST ((ScanJob*) _tmp1_, TYPE_SCAN_JOB, ScanJob));
job = _tmp2_;
_tmp3_ = self->priv->buffer;
_tmp3__length1 = self->priv->buffer_length1;
@@ -7160,7 +7267,7 @@ static void scanner_do_read (Scanner* self) {
_tmp14_ = sane_status_to_string (_tmp13_);
_tmp15_ = _tmp14_;
_tmp16_ = n_read;
- g_debug ("scanner.vala:1228: sane_read (%d) -> (%s, %d)", _tmp12_, _tmp15_, (gint) _tmp16_);
+ g_debug ("scanner.vala:1245: sane_read (%d) -> (%s, %d)", _tmp12_, _tmp15_, (gint) _tmp16_);
_g_free0 (_tmp15_);
_tmp17_ = status;
if (_tmp17_ == SANE_STATUS_EOF) {
@@ -7190,13 +7297,13 @@ static void scanner_do_read (Scanner* self) {
_tmp25_ = self->priv->line_count;
_tmp26_ = self->priv->parameters;
_tmp27_ = _tmp26_.lines;
- g_warning ("scanner.vala:1234: Scan completed with %d lines, expected %d lines", _tmp25_, _tmp27_);
+ g_warning ("scanner.vala:1251: Scan completed with %d lines, expected %d lines", _tmp25_, _tmp27_);
}
_tmp28_ = self->priv->n_used;
if (_tmp28_ > 0) {
gint _tmp29_;
_tmp29_ = self->priv->n_used;
- g_warning ("scanner.vala:1236: Scan complete with %d bytes of unused data", _tmp29_);
+ g_warning ("scanner.vala:1253: Scan complete with %d bytes of unused data", _tmp29_);
}
scanner_do_complete_page (self);
_scan_job_unref0 (job);
@@ -7210,7 +7317,7 @@ static void scanner_do_read (Scanner* self) {
const gchar* _tmp34_ = NULL;
_tmp31_ = status;
_tmp32_ = sane_strstatus (_tmp31_);
- g_warning ("scanner.vala:1244: Unable to read frame from device: %s", _tmp32_);
+ g_warning ("scanner.vala:1261: Unable to read frame from device: %s", _tmp32_);
_tmp33_ = status;
_tmp34_ = _ ("Error communicating with scanner");
scanner_fail_scan (self, (gint) _tmp33_, _tmp34_);
@@ -7286,9 +7393,11 @@ static void scanner_do_read (Scanner* self) {
gboolean _tmp109_;
gboolean _tmp112_;
gboolean _tmp115_;
- ScanLine* _tmp160_;
- NotifyGotLine* _tmp161_;
- NotifyGotLine* _tmp162_;
+ ScanJob* _tmp160_;
+ gint _tmp161_;
+ ScanLine* _tmp162_;
+ NotifyGotLine* _tmp163_;
+ NotifyGotLine* _tmp164_;
_tmp45_ = scan_line_new ();
line = _tmp45_;
_tmp46_ = self->priv->parameters;
@@ -7642,11 +7751,13 @@ static void scanner_do_read (Scanner* self) {
_tmp159_ = _tmp158_->width;
_tmp157_->data_length = ((_tmp159_ * 2) + 7) / 8;
}
- _tmp160_ = line;
- _tmp161_ = notify_got_line_new (_tmp160_);
- _tmp162_ = _tmp161_;
- scanner_notify (self, (Notify*) _tmp162_);
- _notify_unref0 (_tmp162_);
+ _tmp160_ = job;
+ _tmp161_ = _tmp160_->id;
+ _tmp162_ = line;
+ _tmp163_ = notify_got_line_new (_tmp161_, _tmp162_);
+ _tmp164_ = _tmp163_;
+ scanner_notify (self, (Notify*) _tmp164_);
+ _notify_unref0 (_tmp164_);
_scan_line_unref0 (line);
}
_scan_job_unref0 (job);
@@ -7682,7 +7793,7 @@ static void* scanner_scan_thread (Scanner* self) {
_tmp2_ = status;
_tmp3_ = sane_status_to_string (_tmp2_);
_tmp4_ = _tmp3_;
- g_debug ("scanner.vala:1361: sane_init () -> %s", _tmp4_);
+ g_debug ("scanner.vala:1378: sane_init () -> %s", _tmp4_);
_g_free0 (_tmp4_);
_tmp5_ = status;
if (_tmp5_ != SANE_STATUS_GOOD) {
@@ -7690,7 +7801,7 @@ static void* scanner_scan_thread (Scanner* self) {
const gchar* _tmp7_ = NULL;
_tmp6_ = status;
_tmp7_ = sane_strstatus (_tmp6_);
- g_warning ("scanner.vala:1364: Unable to initialize SANE backend: %s", _tmp7_);
+ g_warning ("scanner.vala:1381: Unable to initialize SANE backend: %s", _tmp7_);
result = NULL;
return result;
}
@@ -7700,7 +7811,7 @@ static void* scanner_scan_thread (Scanner* self) {
_tmp11_ = SANE_VERSION_MINOR (_tmp10_);
_tmp12_ = version_code;
_tmp13_ = SANE_VERSION_BUILD (_tmp12_);
- g_debug ("scanner.vala:1367: SANE version %d.%d.%d", _tmp9_, _tmp11_, _tmp13_);
+ g_debug ("scanner.vala:1384: SANE version %d.%d.%d", _tmp9_, _tmp11_, _tmp13_);
scanner_redetect (self);
while (TRUE) {
gboolean _tmp14_ = FALSE;
@@ -7763,6 +7874,7 @@ static void* scanner_scan_thread (Scanner* self) {
static gpointer _scanner_scan_thread_gthread_func (gpointer self) {
gpointer result;
result = scanner_scan_thread (self);
+ scanner_unref (self);
return result;
}
@@ -7773,7 +7885,7 @@ void scanner_start (Scanner* self) {
{
GThread* _tmp0_ = NULL;
GThread* _tmp1_;
- _tmp0_ = g_thread_create (_scanner_scan_thread_gthread_func, self, TRUE, &_inner_error_);
+ _tmp0_ = g_thread_create (_scanner_scan_thread_gthread_func, scanner_ref (self), TRUE, &_inner_error_);
_tmp1_ = _tmp0_;
if (_inner_error_ != NULL) {
goto __catch14_g_error;
@@ -7790,7 +7902,7 @@ void scanner_start (Scanner* self) {
_inner_error_ = NULL;
_tmp2_ = e;
_tmp3_ = _tmp2_->message;
- g_critical ("scanner.vala:1418: Unable to create thread: %s", _tmp3_);
+ g_critical ("scanner.vala:1435: Unable to create thread: %s", _tmp3_);
_g_error_free0 (e);
}
__finally14:
@@ -7812,7 +7924,7 @@ void scanner_redetect (Scanner* self) {
return;
}
self->priv->need_redetect = TRUE;
- g_debug ("scanner.vala:1428: Requesting redetection of scan devices");
+ g_debug ("scanner.vala:1445: Requesting redetection of scan devices");
_tmp1_ = self->priv->request_queue;
_tmp2_ = request_redetect_new ();
g_async_queue_push (_tmp1_, (Request*) _tmp2_);
@@ -7947,28 +8059,30 @@ void scanner_scan (Scanner* self, const gchar* device, ScanOptions* options) {
RequestStartScan* request;
ScanJob* _tmp21_;
ScanJob* _tmp22_;
- const gchar* _tmp23_;
- gchar* _tmp24_;
- ScanJob* _tmp25_;
- ScanOptions* _tmp26_;
- gint _tmp27_;
- ScanJob* _tmp28_;
- ScanOptions* _tmp29_;
- ScanMode _tmp30_;
- ScanJob* _tmp31_;
- ScanOptions* _tmp32_;
- gint _tmp33_;
- ScanJob* _tmp34_;
- ScanOptions* _tmp35_;
- ScanType _tmp36_;
- ScanJob* _tmp37_;
- ScanOptions* _tmp38_;
- gint _tmp39_;
- ScanJob* _tmp40_;
- ScanOptions* _tmp41_;
- gint _tmp42_;
- GAsyncQueue* _tmp43_;
- Request* _tmp44_;
+ gint _tmp23_;
+ ScanJob* _tmp24_;
+ const gchar* _tmp25_;
+ gchar* _tmp26_;
+ ScanJob* _tmp27_;
+ ScanOptions* _tmp28_;
+ gint _tmp29_;
+ ScanJob* _tmp30_;
+ ScanOptions* _tmp31_;
+ ScanMode _tmp32_;
+ ScanJob* _tmp33_;
+ ScanOptions* _tmp34_;
+ gint _tmp35_;
+ ScanJob* _tmp36_;
+ ScanOptions* _tmp37_;
+ ScanType _tmp38_;
+ ScanJob* _tmp39_;
+ ScanOptions* _tmp40_;
+ gint _tmp41_;
+ ScanJob* _tmp42_;
+ ScanOptions* _tmp43_;
+ gint _tmp44_;
+ GAsyncQueue* _tmp45_;
+ Request* _tmp46_;
g_return_if_fail (self != NULL);
g_return_if_fail (options != NULL);
_tmp1_ = device;
@@ -7996,7 +8110,7 @@ void scanner_scan (Scanner* self, const gchar* device, ScanOptions* options) {
_tmp17_ = _tmp16_->paper_width;
_tmp18_ = options;
_tmp19_ = _tmp18_->paper_height;
- g_debug ("scanner.vala:1474: Scanner.scan (\"%s\", dpi=%d, scan_mode=%s, depth=%" \
+ g_debug ("scanner.vala:1491: Scanner.scan (\"%s\", dpi=%d, scan_mode=%s, depth=%" \
"d, type=%s, paper_width=%d, paper_height=%d)", _tmp3_, _tmp5_, _tmp9_, _tmp11_, _tmp15_, _tmp17_, _tmp19_);
_g_free0 (_tmp15_);
_g_free0 (_tmp9_);
@@ -8006,48 +8120,55 @@ void scanner_scan (Scanner* self, const gchar* device, ScanOptions* options) {
_scan_job_unref0 (request->job);
request->job = _tmp21_;
_tmp22_ = request->job;
- _tmp23_ = device;
- _tmp24_ = g_strdup (_tmp23_);
- _g_free0 (_tmp22_->device);
- _tmp22_->device = _tmp24_;
- _tmp25_ = request->job;
- _tmp26_ = options;
- _tmp27_ = _tmp26_->dpi;
- _tmp25_->dpi = (gdouble) _tmp27_;
- _tmp28_ = request->job;
- _tmp29_ = options;
- _tmp30_ = _tmp29_->scan_mode;
- _tmp28_->scan_mode = _tmp30_;
- _tmp31_ = request->job;
- _tmp32_ = options;
- _tmp33_ = _tmp32_->depth;
- _tmp31_->depth = _tmp33_;
- _tmp34_ = request->job;
- _tmp35_ = options;
- _tmp36_ = _tmp35_->type;
- _tmp34_->type = _tmp36_;
- _tmp37_ = request->job;
- _tmp38_ = options;
- _tmp39_ = _tmp38_->paper_width;
- _tmp37_->page_width = _tmp39_;
- _tmp40_ = request->job;
- _tmp41_ = options;
- _tmp42_ = _tmp41_->paper_height;
- _tmp40_->page_height = _tmp42_;
- _tmp43_ = self->priv->request_queue;
- _tmp44_ = _request_ref0 ((Request*) request);
- g_async_queue_push (_tmp43_, _tmp44_);
+ _tmp23_ = self->job_id;
+ self->job_id = _tmp23_ + 1;
+ _tmp22_->id = _tmp23_;
+ _tmp24_ = request->job;
+ _tmp25_ = device;
+ _tmp26_ = g_strdup (_tmp25_);
+ _g_free0 (_tmp24_->device);
+ _tmp24_->device = _tmp26_;
+ _tmp27_ = request->job;
+ _tmp28_ = options;
+ _tmp29_ = _tmp28_->dpi;
+ _tmp27_->dpi = (gdouble) _tmp29_;
+ _tmp30_ = request->job;
+ _tmp31_ = options;
+ _tmp32_ = _tmp31_->scan_mode;
+ _tmp30_->scan_mode = _tmp32_;
+ _tmp33_ = request->job;
+ _tmp34_ = options;
+ _tmp35_ = _tmp34_->depth;
+ _tmp33_->depth = _tmp35_;
+ _tmp36_ = request->job;
+ _tmp37_ = options;
+ _tmp38_ = _tmp37_->type;
+ _tmp36_->type = _tmp38_;
+ _tmp39_ = request->job;
+ _tmp40_ = options;
+ _tmp41_ = _tmp40_->paper_width;
+ _tmp39_->page_width = _tmp41_;
+ _tmp42_ = request->job;
+ _tmp43_ = options;
+ _tmp44_ = _tmp43_->paper_height;
+ _tmp42_->page_height = _tmp44_;
+ _tmp45_ = self->priv->request_queue;
+ _tmp46_ = _request_ref0 ((Request*) request);
+ g_async_queue_push (_tmp45_, _tmp46_);
_request_unref0 (request);
}
void scanner_cancel (Scanner* self) {
- GAsyncQueue* _tmp0_;
- RequestCancel* _tmp1_;
+ gint _tmp0_;
+ GAsyncQueue* _tmp1_;
+ RequestCancel* _tmp2_;
g_return_if_fail (self != NULL);
- _tmp0_ = self->priv->request_queue;
- _tmp1_ = request_cancel_new ();
- g_async_queue_push (_tmp0_, (Request*) _tmp1_);
+ _tmp0_ = self->job_id;
+ self->first_job_id = _tmp0_;
+ _tmp1_ = self->priv->request_queue;
+ _tmp2_ = request_cancel_new ();
+ g_async_queue_push (_tmp1_, (Request*) _tmp2_);
}
@@ -8056,7 +8177,7 @@ void scanner_free (Scanner* self) {
RequestQuit* _tmp1_;
GThread* _tmp2_;
g_return_if_fail (self != NULL);
- g_debug ("scanner.vala:1496: Stopping scan thread");
+ g_debug ("scanner.vala:1515: Stopping scan thread");
_tmp0_ = self->priv->request_queue;
_tmp1_ = request_quit_new ();
g_async_queue_push (_tmp0_, (Request*) _tmp1_);
@@ -8067,7 +8188,7 @@ void scanner_free (Scanner* self) {
g_thread_join (_tmp3_);
}
sane_exit ();
- g_debug ("scanner.vala:1504: sane_exit ()");
+ g_debug ("scanner.vala:1523: sane_exit ()");
}
@@ -8265,7 +8386,7 @@ static void scanner_instance_init (Scanner * self) {
static void scanner_finalize (Scanner* obj) {
Scanner * self;
- self = SCANNER (obj);
+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SCANNER, Scanner);
_g_async_queue_unref0 (self->priv->request_queue);
_g_async_queue_unref0 (self->priv->notify_queue);
_g_async_queue_unref0 (self->priv->authorize_queue);