diff options
Diffstat (limited to 'src/simple-scan.c')
-rw-r--r-- | src/simple-scan.c | 286 |
1 files changed, 256 insertions, 30 deletions
diff --git a/src/simple-scan.c b/src/simple-scan.c index 9ca5f9c..d76395e 100644 --- a/src/simple-scan.c +++ b/src/simple-scan.c @@ -1,4 +1,4 @@ -/* simple-scan.c generated by valac 0.14.0, the Vala compiler +/* simple-scan.c generated by valac 0.15.2, the Vala compiler * generated from simple-scan.vala, do not modify */ /* @@ -18,16 +18,17 @@ #include <stdlib.h> #include <string.h> #include <stdio.h> +#include "colord.h" #include <float.h> #include <math.h> -#include <sane/sane.h> +#include "sane/sane.h" #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 "config.h" #include <gobject/gvaluecollector.h> @@ -133,13 +134,13 @@ typedef struct _PageClass PageClass; #define TYPE_SCAN_DIRECTION (scan_direction_get_type ()) #define _page_unref0(var) ((var == NULL) ? NULL : (var = (page_unref (var), NULL))) +#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) typedef struct _ScanPageInfoPrivate ScanPageInfoPrivate; typedef struct _ScanOptionsPrivate ScanOptionsPrivate; #define TYPE_SCAN_MODE (scan_mode_get_type ()) #define TYPE_SCAN_TYPE (scan_type_get_type ()) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) #define _fclose0(var) ((var == NULL) ? NULL : (var = (fclose (var), NULL))) #define _g_match_info_free0(var) ((var == NULL) ? NULL : (var = (g_match_info_free (var), NULL))) #define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL))) @@ -890,9 +891,234 @@ static void application_scanner_new_page_cb (Application* self, Scanner* scanner static gchar* application_get_profile_for_device (Application* self, const gchar* device_name) { gchar* result = NULL; + const gchar* _tmp0_; + gchar* _tmp1_ = NULL; + gchar* device_id; + const gchar* _tmp2_; + CdClient* _tmp3_; + CdClient* client; + CdDevice* device = NULL; + CdDevice* _tmp18_; + CdProfile* _tmp19_ = NULL; + CdProfile* profile; + CdProfile* _tmp20_; + CdProfile* _tmp26_; + const gchar* _tmp27_; + const gchar* _tmp28_; + CdProfile* _tmp30_; + const gchar* _tmp31_; + const gchar* _tmp32_; + const gchar* _tmp33_; + CdProfile* _tmp34_; + const gchar* _tmp35_; + const gchar* _tmp36_; + gchar* _tmp37_; + GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, NULL); g_return_val_if_fail (device_name != NULL, NULL); - result = NULL; + _tmp0_ = device_name; + _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_); + _tmp3_ = cd_client_new (); + client = _tmp3_; + { + CdClient* _tmp4_; + _tmp4_ = client; + cd_client_connect_sync (_tmp4_, NULL, &_inner_error_); + if (_inner_error_ != NULL) { + goto __catch3_g_error; + } + } + goto __finally3; + __catch3_g_error: + { + GError* e = NULL; + GError* _tmp5_; + const gchar* _tmp6_; + e = _inner_error_; + _inner_error_ = NULL; + _tmp5_ = e; + _tmp6_ = _tmp5_->message; + g_debug ("simple-scan.vala:179: Failed to connect to colord: %s", _tmp6_); + result = NULL; + _g_error_free0 (e); + _g_object_unref0 (client); + _g_free0 (device_id); + return result; + } + __finally3: + if (_inner_error_ != NULL) { + _g_object_unref0 (client); + _g_free0 (device_id); + 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; + } + { + CdClient* _tmp7_; + const gchar* _tmp8_; + CdDevice* _tmp9_ = NULL; + CdDevice* _tmp10_; + _tmp7_ = client; + _tmp8_ = device_id; + _tmp9_ = cd_client_find_device_by_property_sync (_tmp7_, CD_DEVICE_PROPERTY_SERIAL, _tmp8_, NULL, &_inner_error_); + _tmp10_ = _tmp9_; + if (_inner_error_ != NULL) { + goto __catch4_g_error; + } + _g_object_unref0 (device); + device = _tmp10_; + } + goto __finally4; + __catch4_g_error: + { + GError* e = NULL; + const gchar* _tmp11_; + GError* _tmp12_; + const gchar* _tmp13_; + e = _inner_error_; + _inner_error_ = NULL; + _tmp11_ = device_name; + _tmp12_ = e; + _tmp13_ = _tmp12_->message; + g_debug ("simple-scan.vala:190: Unable to find colord device %s: %s", _tmp11_, _tmp13_); + result = NULL; + _g_error_free0 (e); + _g_object_unref0 (device); + _g_object_unref0 (client); + _g_free0 (device_id); + return result; + } + __finally4: + if (_inner_error_ != NULL) { + _g_object_unref0 (device); + _g_object_unref0 (client); + _g_free0 (device_id); + 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; + } + { + CdDevice* _tmp14_; + _tmp14_ = device; + cd_device_connect_sync (_tmp14_, NULL, &_inner_error_); + if (_inner_error_ != NULL) { + goto __catch5_g_error; + } + } + goto __finally5; + __catch5_g_error: + { + GError* e = NULL; + const gchar* _tmp15_; + GError* _tmp16_; + const gchar* _tmp17_; + e = _inner_error_; + _inner_error_ = NULL; + _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_); + result = NULL; + _g_error_free0 (e); + _g_object_unref0 (device); + _g_object_unref0 (client); + _g_free0 (device_id); + return result; + } + __finally5: + if (_inner_error_ != NULL) { + _g_object_unref0 (device); + _g_object_unref0 (client); + _g_free0 (device_id); + 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; + } + _tmp18_ = device; + _tmp19_ = cd_device_get_default_profile (_tmp18_); + profile = _tmp19_; + _tmp20_ = profile; + if (_tmp20_ == NULL) { + const gchar* _tmp21_; + _tmp21_ = device_name; + g_debug ("simple-scan.vala:207: No default color profile for device: %s", _tmp21_); + result = NULL; + _g_object_unref0 (profile); + _g_object_unref0 (device); + _g_object_unref0 (client); + _g_free0 (device_id); + return result; + } + { + CdProfile* _tmp22_; + _tmp22_ = profile; + cd_profile_connect_sync (_tmp22_, NULL, &_inner_error_); + if (_inner_error_ != NULL) { + goto __catch6_g_error; + } + } + goto __finally6; + __catch6_g_error: + { + GError* e = NULL; + const gchar* _tmp23_; + GError* _tmp24_; + const gchar* _tmp25_; + e = _inner_error_; + _inner_error_ = NULL; + _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_); + result = NULL; + _g_error_free0 (e); + _g_object_unref0 (profile); + _g_object_unref0 (device); + _g_object_unref0 (client); + _g_free0 (device_id); + return result; + } + __finally6: + if (_inner_error_ != NULL) { + _g_object_unref0 (profile); + _g_object_unref0 (device); + _g_object_unref0 (client); + _g_free0 (device_id); + 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; + } + _tmp26_ = profile; + _tmp27_ = cd_profile_get_filename (_tmp26_); + _tmp28_ = _tmp27_; + if (_tmp28_ == NULL) { + const gchar* _tmp29_; + _tmp29_ = device_name; + g_debug ("simple-scan.vala:223: No icc color profile for the device %s", _tmp29_); + result = NULL; + _g_object_unref0 (profile); + _g_object_unref0 (device); + _g_object_unref0 (client); + _g_free0 (device_id); + return result; + } + _tmp30_ = profile; + _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_); + _tmp34_ = profile; + _tmp35_ = cd_profile_get_filename (_tmp34_); + _tmp36_ = _tmp35_; + _tmp37_ = g_strdup (_tmp36_); + result = _tmp37_; + _g_object_unref0 (profile); + _g_object_unref0 (device); + _g_object_unref0 (client); + _g_free0 (device_id); return result; } @@ -1151,13 +1377,13 @@ static gchar* application_get_temporary_filename (Application* self, const gchar path = _tmp4_; fd = _tmp5_; if (_inner_error_ != NULL) { - goto __catch3_g_error; + goto __catch7_g_error; } _tmp6_ = fd; close (_tmp6_); } - goto __finally3; - __catch3_g_error: + goto __finally7; + __catch7_g_error: { GError* e = NULL; GError* _tmp7_; @@ -1173,7 +1399,7 @@ static gchar* application_get_temporary_filename (Application* self, const gchar _g_free0 (filename); return result; } - __finally3: + __finally7: if (_inner_error_ != NULL) { _g_free0 (path); _g_free0 (filename); @@ -1227,11 +1453,11 @@ static void application_email_cb (Application* self, SimpleScan* ui, const gchar _tmp7_ = file; book_save (_tmp6_, "pdf", _tmp7_, &_inner_error_); if (_inner_error_ != NULL) { - goto __catch4_g_error; + goto __catch8_g_error; } } - goto __finally4; - __catch4_g_error: + goto __finally8; + __catch8_g_error: { GError* e = NULL; GError* _tmp8_; @@ -1247,7 +1473,7 @@ static void application_email_cb (Application* self, SimpleScan* ui, const gchar _g_free0 (command_line); return; } - __finally4: + __finally8: if (_inner_error_ != NULL) { _g_object_unref0 (file); _g_free0 (path); @@ -1329,11 +1555,11 @@ static void application_email_cb (Application* self, SimpleScan* ui, const gchar page_save (_tmp28_, "jpeg", _tmp29_, &_inner_error_); _page_unref0 (_tmp28_); if (_inner_error_ != NULL) { - goto __catch5_g_error; + goto __catch9_g_error; } } - goto __finally5; - __catch5_g_error: + goto __finally9; + __catch9_g_error: { GError* e = NULL; GError* _tmp30_; @@ -1349,7 +1575,7 @@ static void application_email_cb (Application* self, SimpleScan* ui, const gchar _g_free0 (command_line); return; } - __finally5: + __finally9: if (_inner_error_ != NULL) { _g_object_unref0 (file); _g_free0 (path); @@ -1385,11 +1611,11 @@ static void application_email_cb (Application* self, SimpleScan* ui, const gchar _tmp39_ = command_line; g_spawn_command_line_async (_tmp39_, &_inner_error_); if (_inner_error_ != NULL) { - goto __catch6_g_error; + goto __catch10_g_error; } } - goto __finally6; - __catch6_g_error: + goto __finally10; + __catch10_g_error: { GError* e = NULL; GError* _tmp40_; @@ -1401,7 +1627,7 @@ static void application_email_cb (Application* self, SimpleScan* ui, const gchar g_warning ("simple-scan.vala:399: Unable to start email: %s", _tmp41_); _g_error_free0 (e); } - __finally6: + __finally10: if (_inner_error_ != NULL) { _g_free0 (command_line); 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); @@ -2025,11 +2251,11 @@ gint application_main (gchar** args, int args_length1) { _tmp5_ = c; g_option_context_parse (_tmp5_, &args_length1, &args, &_inner_error_); if (_inner_error_ != NULL) { - goto __catch7_g_error; + goto __catch11_g_error; } } - goto __finally7; - __catch7_g_error: + goto __finally11; + __catch11_g_error: { GError* e = NULL; FILE* _tmp6_; @@ -2060,7 +2286,7 @@ gint application_main (gchar** args, int args_length1) { _g_option_context_free0 (c); return result; } - __finally7: + __finally11: if (_inner_error_ != NULL) { _g_option_context_free0 (c); 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); @@ -2083,7 +2309,7 @@ gint application_main (gchar** args, int args_length1) { _tmp17_ = application_fix_pdf_filename; application_fix_pdf (_tmp17_, &_inner_error_); if (_inner_error_ != NULL) { - goto __catch8_g_error; + goto __catch12_g_error; } { gint i; @@ -2119,14 +2345,14 @@ gint application_main (gchar** args, int args_length1) { _tmp25_ = _tmp23_[_tmp24_]; application_fix_pdf (_tmp25_, &_inner_error_); if (_inner_error_ != NULL) { - goto __catch8_g_error; + goto __catch12_g_error; } } } } } - goto __finally8; - __catch8_g_error: + goto __finally12; + __catch12_g_error: { GError* e = NULL; FILE* _tmp26_; @@ -2143,7 +2369,7 @@ gint application_main (gchar** args, int args_length1) { _g_option_context_free0 (c); return result; } - __finally8: + __finally12: if (_inner_error_ != NULL) { _g_option_context_free0 (c); 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); |