summaryrefslogtreecommitdiffstats
path: root/src/pgp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pgp')
-rw-r--r--src/pgp/.gitignore1
-rw-r--r--src/pgp/Makefile10
-rw-r--r--src/pgp/main.vala18
-rw-r--r--src/pgp/pgp-interface.vala6
-rw-r--r--src/pgp/pgp.vala10
5 files changed, 19 insertions, 26 deletions
diff --git a/src/pgp/.gitignore b/src/pgp/.gitignore
deleted file mode 100644
index c8886a7..0000000
--- a/src/pgp/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-pgp
diff --git a/src/pgp/Makefile b/src/pgp/Makefile
deleted file mode 100644
index 6292111..0000000
--- a/src/pgp/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-all: pgp
- @echo > /dev/null
-
-pgp: main.vala pgp.vala pgp-interface.vala ../config/config-interface.vala
- valac --Xcc="-D_FILE_OFFSET_BITS=64" -X -w -o $@ --vapidir ../../vapi -X -lgpgme --pkg gpgme --pkg gio-2.0 --pkg libarchive $^
-
-clean:
- rm -rf pgp
-
-.PHONY: all clean
diff --git a/src/pgp/main.vala b/src/pgp/main.vala
index c866c7b..74bcf0e 100644
--- a/src/pgp/main.vala
+++ b/src/pgp/main.vala
@@ -21,33 +21,37 @@ PGPKeyArchive pgp;
Config cfg;
public static int main(string[] args) {
+ Intl.setlocale(LocaleCategory.ALL, "");
+ Intl.textdomain("shopsystem");
+
try {
cfg = Bus.get_proxy_sync(BusType.SYSTEM, "io.mainframe.shopsystem.Config", "/io/mainframe/shopsystem/config");
pgp = new PGPKeyArchive(cfg.get_string("PGP", "keyring"));
+ } catch(DBusError e) {
+ error(_("DBus Error: %s\n"), e.message);
} catch(IOError e) {
- error("IOError: %s\n", e.message);
+ error(_("IO Error: %s\n"), e.message);
} catch(KeyFileError e) {
- error("Config Error: %s\n", e.message);
+ error(_("Config Error: %s\n"), e.message);
}
-
Bus.own_name(
BusType.SYSTEM,
"io.mainframe.shopsystem.PGP",
BusNameOwnerFlags.NONE,
- on_bus_aquired,
+ on_bus_acquired,
() => {},
- () => stderr.printf("Could not aquire name\n"));
+ () => stderr.printf(_("Could not acquire name\n")));
new MainLoop().run();
return 0;
}
-void on_bus_aquired(DBusConnection con) {
+void on_bus_acquired(DBusConnection con) {
try {
con.register_object("/io/mainframe/shopsystem/pgp", pgp);
} catch(IOError e) {
- stderr.printf("Could not register service\n");
+ stderr.printf(_("Could not register service\n"));
}
}
diff --git a/src/pgp/pgp-interface.vala b/src/pgp/pgp-interface.vala
index 62bfe67..2621fae 100644
--- a/src/pgp/pgp-interface.vala
+++ b/src/pgp/pgp-interface.vala
@@ -15,7 +15,7 @@
[DBus (name = "io.mainframe.shopsystem.PGP")]
public interface PGP : Object {
- public abstract string[] import_archive(uint8[] data) throws IOError;
- public abstract string[] list_keys() throws IOError;
- public abstract string get_key(string fingerprint) throws IOError;
+ public abstract string[] import_archive(uint8[] data) throws IOError, DBusError;
+ public abstract string[] list_keys() throws IOError, DBusError;
+ public abstract string get_key(string fingerprint) throws IOError, DBusError;
}
diff --git a/src/pgp/pgp.vala b/src/pgp/pgp.vala
index bb48c61..6d9bed0 100644
--- a/src/pgp/pgp.vala
+++ b/src/pgp/pgp.vala
@@ -42,13 +42,13 @@ public class PGPKeyArchive {
gpg.set_armor(true);
}
- public string[] import_archive(uint8[] data) {
+ public string[] import_archive(uint8[] data) throws DBusError, IOError {
string[] result = {};
unowned Archive.Entry entry;
var archive = new Archive.Read();
/* support all formats & compression types */
- archive.support_compression_all();
+ archive.support_filter_all();
archive.support_format_all();
/* load test archive for now */
@@ -93,7 +93,7 @@ public class PGPKeyArchive {
return result;
}
- public string[] list_keys() {
+ public string[] list_keys() throws DBusError, IOError {
string[] result = {};
GPG.Key key;
@@ -108,7 +108,7 @@ public class PGPKeyArchive {
return result;
}
- public string get_key(string fingerprint) {
+ public string get_key(string fingerprint) throws DBusError, IOError {
GPG.Data keydata;
GPG.Data.create(out keydata);
@@ -120,7 +120,7 @@ public class PGPKeyArchive {
keydata.read(data);
return (string) data;
} else {
- stdout.printf("error!\n");
+ stdout.printf(_("Error!\n"));
return "";
}
}