summaryrefslogtreecommitdiffstats
path: root/src/config
diff options
context:
space:
mode:
Diffstat (limited to 'src/config')
-rw-r--r--src/config/.gitignore1
-rw-r--r--src/config/Makefile10
-rw-r--r--src/config/config-interface.vala16
-rw-r--r--src/config/config.vala18
-rw-r--r--src/config/main.vala13
5 files changed, 24 insertions, 34 deletions
diff --git a/src/config/.gitignore b/src/config/.gitignore
deleted file mode 100644
index 04204c7..0000000
--- a/src/config/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-config
diff --git a/src/config/Makefile b/src/config/Makefile
deleted file mode 100644
index d93d5df..0000000
--- a/src/config/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-all: config
- @echo > /dev/null
-
-config: main.vala config.vala config-interface.vala
- valac -X -w -o $@ --pkg gio-2.0 $^
-
-clean:
- rm -rf config
-
-.PHONY: all clean
diff --git a/src/config/config-interface.vala b/src/config/config-interface.vala
index c34e3a7..369071e 100644
--- a/src/config/config-interface.vala
+++ b/src/config/config-interface.vala
@@ -15,12 +15,12 @@
[DBus (name = "io.mainframe.shopsystem.Config")]
public interface Config : Object {
- public abstract bool has_group(string group_name) throws IOError, KeyFileError;
- public abstract bool has_key(string group_name, string key) throws IOError, KeyFileError;
- public abstract string get_string(string group_name, string key) throws IOError, KeyFileError;
- public abstract bool get_boolean(string group_name, string key) throws IOError, KeyFileError;
- public abstract int get_integer(string group_name, string key) throws IOError, KeyFileError;
- public abstract int64 get_int64(string group_name, string key) throws IOError, KeyFileError;
- public abstract uint64 get_uint64(string group_name, string key) throws IOError, KeyFileError;
- public abstract double get_double(string group_name, string key) throws IOError, KeyFileError;
+ public abstract bool has_group(string group_name) throws DBusError, IOError, KeyFileError;
+ public abstract bool has_key(string group_name, string key) throws DBusError, IOError, KeyFileError;
+ public abstract string get_string(string group_name, string key) throws DBusError, IOError, KeyFileError;
+ public abstract bool get_boolean(string group_name, string key) throws DBusError, IOError, KeyFileError;
+ public abstract int get_integer(string group_name, string key) throws DBusError, IOError, KeyFileError;
+ public abstract int64 get_int64(string group_name, string key) throws DBusError, IOError, KeyFileError;
+ public abstract uint64 get_uint64(string group_name, string key) throws DBusError, IOError, KeyFileError;
+ public abstract double get_double(string group_name, string key) throws DBusError, IOError, KeyFileError;
}
diff --git a/src/config/config.vala b/src/config/config.vala
index 60fd835..bc476f4 100644
--- a/src/config/config.vala
+++ b/src/config/config.vala
@@ -23,39 +23,39 @@ public class Cfg {
this.file = new KeyFile();
this.file.load_from_file(file, KeyFileFlags.NONE);
} catch(Error e) {
- error("Could not load configuration file: %s", e.message);
+ error(_("Could not load configuration file: %s"), e.message);
}
}
- public bool has_group(string group_name) throws KeyFileError {
+ public bool has_group(string group_name) throws DBusError, IOError, KeyFileError {
return file.has_group(group_name);
}
- public bool has_key(string group_name, string key) throws KeyFileError {
+ public bool has_key(string group_name, string key) throws DBusError, IOError, KeyFileError {
return file.has_key(group_name, key);
}
- public string get_string(string group_name, string key) throws KeyFileError {
+ public string get_string(string group_name, string key) throws DBusError, IOError, KeyFileError {
return file.get_string(group_name, key);
}
- public bool get_boolean(string group_name, string key) throws KeyFileError {
+ public bool get_boolean(string group_name, string key) throws DBusError, IOError, KeyFileError {
return file.get_boolean(group_name, key);
}
- public int get_integer(string group_name, string key) throws KeyFileError {
+ public int get_integer(string group_name, string key) throws DBusError, IOError, KeyFileError {
return file.get_integer(group_name, key);
}
- public int64 get_int64(string group_name, string key) throws KeyFileError {
+ public int64 get_int64(string group_name, string key) throws DBusError, IOError, KeyFileError {
return file.get_int64(group_name, key);
}
- public uint64 get_uint64(string group_name, string key) throws KeyFileError {
+ public uint64 get_uint64(string group_name, string key) throws DBusError, IOError, KeyFileError {
return file.get_uint64(group_name, key);
}
- public double get_double(string group_name, string key) throws KeyFileError {
+ public double get_double(string group_name, string key) throws DBusError, IOError, KeyFileError {
return file.get_double(group_name, key);
}
diff --git a/src/config/main.vala b/src/config/main.vala
index 5ae15be..1a5328d 100644
--- a/src/config/main.vala
+++ b/src/config/main.vala
@@ -16,27 +16,28 @@
Cfg cfg;
public static int main(string[] args) {
- string binarylocation = File.new_for_path(args[0]).get_parent().get_path();
+ Intl.setlocale(LocaleCategory.ALL, "");
+ Intl.textdomain("shopsystem");
- cfg = new Cfg(binarylocation + "/../../ktt-shopsystem.cfg");
+ cfg = new Cfg("/etc/shopsystem/config.ini");
Bus.own_name(
BusType.SYSTEM,
"io.mainframe.shopsystem.Config",
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/config", cfg);
} catch(IOError e) {
- stderr.printf("Could not register service\n");
+ stderr.printf(_("Could not register service\n"));
}
}