internal override void SetValue (string key, Value val) { IntPtr err; gconf_client_set (Raw, key, val.Handle, out err); if (err != IntPtr.Zero) throw new GLib.GException (err); }
public override object Get (string key) { IntPtr raw_val; if (gconf_change_set_check_value (Raw, key, out raw_val) && raw_val != IntPtr.Zero) { Value val = new Value (raw_val); val.Managed = false; return val.Get (); } else { throw new NoSuchKeyException (); } }
void NotifyCB (IntPtr client_ptr, uint id, IntPtr entry_ptr, IntPtr user_data) { Client client = new Client (client_ptr); _Entry entry = new _Entry (entry_ptr); if (entry.ValuePtr == IntPtr.Zero) { notify (client, new NotifyEventArgs (entry.Key, null)); return; } Value val = new Value (entry.ValuePtr); val.Managed = false; notify (client, new NotifyEventArgs (entry.Key, val.Get ())); }
public override object Get (string key) { if (key == null) throw new ArgumentNullException ("key"); IntPtr err; IntPtr raw = gconf_client_get (Raw, key, out err); if (err != IntPtr.Zero) throw new GLib.GException (err); if (raw == IntPtr.Zero) throw new NoSuchKeyException (key); Value val = new Value (raw); return val.Get (); }
GLib.SList GetListFromCollection (ICollection data, out ValueType listType) { object [] arr = (object []) Array.CreateInstance (typeof (object), data.Count); data.CopyTo (arr, 0); listType = ValueType.Invalid; GLib.SList list = new GLib.SList (IntPtr.Zero); GC.SuppressFinalize (list); if (data.Count == 0) { if (data is string []) listType = ValueType.String; else if (data is int []) listType = ValueType.Int; else if (data is double []) listType = ValueType.Float; else if (data is bool []) listType = ValueType.Bool; } if (arr.Length == 0) { if (data is Array) listType = LookupType (data.GetType ().GetElementType ()); else throw new InvalidValueTypeException (); return list; } foreach (object o in arr) { ValueType type = LookupType (o.GetType ()); if (listType == ValueType.Invalid) listType = type; if (listType == ValueType.Invalid || type != listType) throw new InvalidValueTypeException (); Value v = new Value (o); GC.SuppressFinalize (v); list.Append (v.Raw); } return list; }
internal abstract void SetValue (string key, Value val);
internal override void SetValue (string key, Value val) { gconf_change_set_set (Raw, key, val.Handle); }