diff options
author | Sebastian Reichel <sre@ring0.de> | 2018-06-28 01:03:02 +0200 |
---|---|---|
committer | Sebastian Reichel <sre@ring0.de> | 2018-06-28 01:53:40 +0200 |
commit | f466538a3527cd539c732d3abee481fa7a34fc2f (patch) | |
tree | 0a244c5b3594ee42d25744bdbdd3f0a44595c87b /src/pdf-invoice | |
parent | c70d626e473c8cbdbd87125a256ca221c0c3fa23 (diff) | |
download | serial-barcode-scanner-f466538a3527cd539c732d3abee481fa7a34fc2f.tar.bz2 |
all: Add DBusError to avoid warnings with valac 0.40
Diffstat (limited to 'src/pdf-invoice')
-rw-r--r-- | src/pdf-invoice/main.vala | 6 | ||||
-rw-r--r-- | src/pdf-invoice/pdf-invoice-interface.vala | 4 | ||||
-rw-r--r-- | src/pdf-invoice/pdf-invoice.vala | 16 |
3 files changed, 14 insertions, 12 deletions
diff --git a/src/pdf-invoice/main.vala b/src/pdf-invoice/main.vala index 3d8e298..dc95bde 100644 --- a/src/pdf-invoice/main.vala +++ b/src/pdf-invoice/main.vala @@ -19,6 +19,8 @@ public static int main(string[] args) { try { Config cfg = Bus.get_proxy_sync(BusType.SYSTEM, "io.mainframe.shopsystem.Config", "/io/mainframe/shopsystem/config"); datadir = cfg.get_string("INVOICE", "datadir"); + } catch(DBusError e) { + error("DBusError: %s\n", e.message); } catch(IOError e) { error("IOError: %s\n", e.message); } catch(KeyFileError e) { @@ -41,7 +43,7 @@ public static int main(string[] args) { void on_bus_aquired(DBusConnection conn) { try { conn.register_object("/io/mainframe/shopsystem/invoicepdf", new InvoicePDF(datadir)); - } catch(IOError e) { - stderr.printf("Could not register service\n"); + } catch(Error e) { + stderr.printf("Could not register service: %s\n", e.message); } } diff --git a/src/pdf-invoice/pdf-invoice-interface.vala b/src/pdf-invoice/pdf-invoice-interface.vala index 8fccbf0..41abc6d 100644 --- a/src/pdf-invoice/pdf-invoice-interface.vala +++ b/src/pdf-invoice/pdf-invoice-interface.vala @@ -43,6 +43,6 @@ public interface PDFInvoice : Object { public abstract InvoiceRecipient invoice_recipient { set; owned get; } public abstract InvoiceEntry[] invoice_entries { set; owned get; } - public abstract uint8[] generate() throws IOError, InvoicePDFError; - public abstract void clear() throws IOError; + public abstract uint8[] generate() throws DBusError, IOError, InvoicePDFError; + public abstract void clear() throws DBusError, IOError; } diff --git a/src/pdf-invoice/pdf-invoice.vala b/src/pdf-invoice/pdf-invoice.vala index 6fd4383..a5696b1 100644 --- a/src/pdf-invoice/pdf-invoice.vala +++ b/src/pdf-invoice/pdf-invoice.vala @@ -65,7 +65,7 @@ public class InvoicePDF { string longname; string vat; - public InvoicePDF(string datadir) { + public InvoicePDF(string datadir) throws DBusError, IOError, KeyFileError { this.datadir = datadir; cfg = Bus.get_proxy_sync(BusType.SYSTEM, "io.mainframe.shopsystem.Config", "/io/mainframe/shopsystem/config"); longname = cfg.get_string("GENERAL", "longname"); @@ -96,7 +96,7 @@ public class InvoicePDF { ctx.restore(); } - private void draw_address(Cairo.Context ctx) { + private void draw_address(Cairo.Context ctx) throws DBusError, IOError, KeyFileError { ctx.save(); ctx.set_source_rgb(0, 0, 0); ctx.set_line_width(1.0); @@ -206,7 +206,7 @@ public class InvoicePDF { ctx.restore(); } - private void draw_footer_text_left(Cairo.Context ctx) { + private void draw_footer_text_left(Cairo.Context ctx) throws DBusError, IOError, KeyFileError { ctx.save(); ctx.move_to(64.0, 742.0); ctx.set_source_rgb(0, 0, 0); @@ -242,7 +242,7 @@ public class InvoicePDF { ctx.restore(); } - private void draw_footer_text_middle(Cairo.Context ctx) { + private void draw_footer_text_middle(Cairo.Context ctx) throws DBusError, IOError, KeyFileError { ctx.save(); ctx.move_to(216.5, 742.0); ctx.set_source_rgb(0, 0, 0); @@ -278,7 +278,7 @@ public class InvoicePDF { ctx.restore(); } - private void draw_footer_text_right(Cairo.Context ctx) { + private void draw_footer_text_right(Cairo.Context ctx) throws DBusError, IOError, KeyFileError { ctx.save(); ctx.move_to(410.0, 742.0); ctx.set_source_rgb(0, 0, 0); @@ -331,7 +331,7 @@ public class InvoicePDF { return "Moin"; } - private void draw_first_page_text(Cairo.Context ctx) { + private void draw_first_page_text(Cairo.Context ctx) throws IOError { ctx.save(); ctx.move_to(56.5, 352.5); ctx.set_source_rgb(0, 0, 0); @@ -616,7 +616,7 @@ public class InvoicePDF { return Cairo.Status.SUCCESS; } - public uint8[] generate() throws InvoicePDFError { + public uint8[] generate() throws DBusError, IOError, InvoicePDFError, KeyFileError { data = null; var document = new Cairo.PdfSurface.for_stream(pdf_write, width, height); @@ -657,7 +657,7 @@ public class InvoicePDF { return data; } - public void clear() { + public void clear() throws DBusError, IOError { invoice_date = 0; invoice_id = ""; invoice_recipient.firstname = ""; |