- add progress to edge, dct and fft plugins
[FaRetSys.git] / IPlugin / GConfConfig.cs
blob144d2b339f4ae320625b074d00d8a9e3e11cc4e3
1 using System;
2 using System.IO;
4 namespace Eithne
6 internal class GConfConfig : IConfig
8 GConf.Client c = new GConf.Client();
9 Config.Callback UpdateCallback;
11 static string path = "/apps/eithne/";
13 public GConfConfig(Config.Callback UpdateCallback)
15 this.UpdateCallback = UpdateCallback;
17 c.AddNotify(path.TrimEnd(new char[] {'/'}), UpdateHandler);
20 private void UpdateHandler(object o, EventArgs args)
22 UpdateCallback();
25 public void Set(string key, string val)
27 c.Set(path + key, val);
30 public void Set(string key, int val)
32 c.Set(path + key, val);
35 public void Set(string key, bool val)
37 c.Set(path + key, val);
40 public string Get(string key, string def)
42 try
44 return (string)c.Get(path + key);
46 catch(GConf.NoSuchKeyException)
48 c.Set(path + key, def);
49 return def;
53 public int Get(string key, int def)
55 try
57 return (int)c.Get(path + key);
59 catch(GConf.NoSuchKeyException)
61 c.Set(path + key, def);
62 return def;
66 public bool Get(string key, bool def)
68 try
70 return (bool)c.Get(path + key);
72 catch(GConf.NoSuchKeyException)
74 c.Set(path + key, def);
75 return def;