summaryrefslogtreecommitdiff
path: root/src/simple-scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/simple-scan.c')
-rw-r--r--src/simple-scan.c1016
1 files changed, 442 insertions, 574 deletions
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;
}