/// <summary> /// Reads single option value from GConf. /// </summary> /// <param name="setting">Option to set.</param> private void ReadGConfValue(Setting setting) { try { setting.Value = this.client.Get(setting.Key); } catch (Exception ex) { Tools.PrintInfo(ex, this.GetType()); this.client.Unset(setting.Key); } }
/// <summary> /// Registers new option. /// </summary> /// <param name="key">Key used to access value.</param> /// <param name="gconfKey">Path to key in GConf.</param> /// <param name="valueType">Value type.</param> /// <param name="requiresMenuRebuild">If true, SettingChanged event propagates information whether menu rebuild is required.</param> /// <returns>True, if succeeded.</returns> public bool RegisterSetting(string key, string gconfKey, SettingTypes valueType, bool requiresMenuRebuild) { try { Setting o = new Setting(gconfKey, valueType, requiresMenuRebuild); this.settings.Add(key, o); this.ReadGConfValue(o); } catch (Exception ex) { #if DEBUG Tools.PrintInfo(ex, this.GetType()); #endif return false; } return true; }