2004-12-18 Mike Kestner <mkestner@novell.com>
* gconf/GConf/ChangeSet.cs : add internal Handle prop. * gconf/GConf/Engine.cs : new class to expose the default gconf engine perform changeset commits and reverses. svn path=/trunk/gtk-sharp/; revision=37921
This commit is contained in:
parent
5e5c493b33
commit
1cdd16f09c
5 changed files with 219 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
2004-12-18 Mike Kestner <mkestner@novell.com>
|
||||
|
||||
* gconf/GConf/ChangeSet.cs : add internal Handle prop.
|
||||
* gconf/GConf/Engine.cs : new class to expose the default gconf engine
|
||||
perform changeset commits and reverses.
|
||||
|
||||
2004-12-17 Mike Kestner <mkestner@novell.com>
|
||||
|
||||
* gtk/ListStore.custom : dispose a bunch of GLib.Values.
|
||||
|
|
96
doc/en/GConf/Engine.xml
Normal file
96
doc/en/GConf/Engine.xml
Normal file
|
@ -0,0 +1,96 @@
|
|||
<Type Name="Engine" FullName="GConf.Engine">
|
||||
<TypeSignature Language="C#" Value="public class Engine : IDisposable" Maintainer="auto" />
|
||||
<AssemblyInfo>
|
||||
<AssemblyName>gconf-sharp</AssemblyName>
|
||||
<AssemblyPublicKey>[00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 71 EB 6C 55 75 52 9C BF 72 44 F7 A6 EA 05 62 84 F9 EA E0 3B CF F2 CC 13 2C 9C 49 0A B3 09 EA B0 B5 6B CE 44 9D F5 03 D9 C0 A8 1E 52 05 85 CD BE 70 E2 FB 90 43 4B AC 04 FA 62 22 A8 00 98 B7 A1 A7 B3 AF 99 1A 41 23 24 BB 43 25 F6 B8 65 BB 64 EB F6 D1 C2 06 D5 73 2D DF BC 70 A7 38 9E E5 3E 0C 24 6E 32 79 74 1A D0 05 03 E4 98 42 E1 9B F3 7B 19 8B 40 21 26 CB 36 89 C2 EA 64 96 A4 7C B4]</AssemblyPublicKey>
|
||||
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
||||
<AssemblyCulture>neutral</AssemblyCulture>
|
||||
<Attributes />
|
||||
</AssemblyInfo>
|
||||
<ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
|
||||
<Docs>
|
||||
<summary>Configuration Engine class.</summary>
|
||||
<remarks />
|
||||
</Docs>
|
||||
<Base>
|
||||
<BaseTypeName>System.Object</BaseTypeName>
|
||||
</Base>
|
||||
<Interfaces>
|
||||
<Interface>
|
||||
<InterfaceName>System.IDisposable</InterfaceName>
|
||||
</Interface>
|
||||
</Interfaces>
|
||||
<Attributes />
|
||||
<Members>
|
||||
<Member MemberName="Finalize">
|
||||
<MemberSignature Language="C#" Value="protected override void Finalize ();" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Void</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters />
|
||||
<Docs>
|
||||
<summary>Finalizes the engine.</summary>
|
||||
<remarks />
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Dispose">
|
||||
<MemberSignature Language="C#" Value="public virtual void Dispose ();" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Void</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters />
|
||||
<Docs>
|
||||
<summary>Releases the native engine ref.</summary>
|
||||
<remarks />
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="CommitChangeSet">
|
||||
<MemberSignature Language="C#" Value="public void CommitChangeSet (GConf.ChangeSet cs, bool remove_committed);" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Void</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="cs" Type="GConf.ChangeSet" />
|
||||
<Parameter Name="remove_committed" Type="System.Boolean" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<summary>Commits a change set to the engine.</summary>
|
||||
<param name="cs">a <see cref="T:GConf.ChangeSet" /></param>
|
||||
<param name="remove_committed">a <see cref="T:System.Boolean" />indicated if successfully committed items should be removed from the ChangeSet.</param>
|
||||
<remarks />
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Default">
|
||||
<MemberSignature Language="C#" Value="public static GConf.Engine Default { get; };" />
|
||||
<MemberType>Property</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>GConf.Engine</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters />
|
||||
<Docs>
|
||||
<summary>Gets the default configuration engine.</summary>
|
||||
<returns>a <see cref="T:GConf.Engine" /></returns>
|
||||
<remarks>This is the engine to use for most application code.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="ReverseChangeSet">
|
||||
<MemberSignature Language="C#" Value="public GConf.ChangeSet ReverseChangeSet (GConf.ChangeSet cs);" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>GConf.ChangeSet</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="cs" Type="GConf.ChangeSet" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<summary>Reverses the values for a ChangeSet.</summary>
|
||||
<param name="cs">a <see cref="T:GConf.ChangeSet" /></param>
|
||||
<returns>a <see cref="T:GConf.ChangeSet" /> containing the keys/values reversed from non-default values.</returns>
|
||||
<remarks />
|
||||
</Docs>
|
||||
</Member>
|
||||
</Members>
|
||||
</Type>
|
|
@ -35,6 +35,12 @@ namespace GConf
|
|||
Raw = gconf_change_set_new ();
|
||||
}
|
||||
|
||||
internal ChangeSet (IntPtr raw) : base ()
|
||||
{
|
||||
Initialize ();
|
||||
Raw = raw;
|
||||
}
|
||||
|
||||
~ChangeSet ()
|
||||
{
|
||||
Dispose ();
|
||||
|
@ -52,6 +58,12 @@ namespace GConf
|
|||
}
|
||||
}
|
||||
|
||||
internal IntPtr Handle {
|
||||
get {
|
||||
return Raw;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("gconf-2")]
|
||||
static extern void gconf_change_set_set (IntPtr cs, string key, IntPtr val);
|
||||
|
||||
|
|
104
gconf/GConf/Engine.cs
Normal file
104
gconf/GConf/Engine.cs
Normal file
|
@ -0,0 +1,104 @@
|
|||
// Engine.cs - configureation engine wrapper
|
||||
//
|
||||
// Author: Mike Kestner <mkestner@novell.com>
|
||||
//
|
||||
// Copyright (c) 2004 Novell, Inc.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of version 2 of the Lesser GNU General
|
||||
// Public License as published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this program; if not, write to the
|
||||
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
// Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
namespace GConf
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public class Engine : IDisposable
|
||||
{
|
||||
IntPtr handle = IntPtr.Zero;
|
||||
|
||||
[DllImport("gconf-2")]
|
||||
static extern bool gconf_is_initialized ();
|
||||
|
||||
[DllImport("gconf-2")]
|
||||
static extern bool gconf_init (int argc, IntPtr argv, out IntPtr err);
|
||||
|
||||
static Engine ()
|
||||
{
|
||||
if (!gconf_is_initialized ()) {
|
||||
IntPtr err;
|
||||
gconf_init (0, IntPtr.Zero, out err);
|
||||
if (err != IntPtr.Zero)
|
||||
throw new GLib.GException (err);
|
||||
}
|
||||
}
|
||||
|
||||
private Engine (IntPtr handle)
|
||||
{
|
||||
this.handle = handle;
|
||||
}
|
||||
|
||||
~Engine ()
|
||||
{
|
||||
Dispose ();
|
||||
}
|
||||
|
||||
[DllImport("gconf-2")]
|
||||
static extern void gconf_engine_unref (IntPtr cs);
|
||||
|
||||
public void Dispose ()
|
||||
{
|
||||
if (handle != IntPtr.Zero) {
|
||||
gconf_engine_unref (handle);
|
||||
handle = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("gconf-2")]
|
||||
static extern IntPtr gconf_engine_get_default ();
|
||||
|
||||
static Engine default_engine;
|
||||
public static Engine Default {
|
||||
get {
|
||||
if (default_engine == null)
|
||||
default_engine = new Engine (gconf_engine_get_default ());
|
||||
|
||||
return default_engine;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("gconf-2")]
|
||||
static extern bool gconf_engine_commit_change_set (IntPtr handle, IntPtr cs, bool remove, out IntPtr err);
|
||||
|
||||
public void CommitChangeSet (ChangeSet cs, bool remove_committed)
|
||||
{
|
||||
IntPtr err_handle;
|
||||
if (!gconf_engine_commit_change_set (handle, cs.Handle, remove_committed, out err_handle))
|
||||
throw new GLib.GException (err_handle);
|
||||
}
|
||||
|
||||
[DllImport("gconf-2")]
|
||||
static extern IntPtr gconf_engine_reverse_change_set (IntPtr handle, IntPtr cs, out IntPtr err);
|
||||
|
||||
public ChangeSet ReverseChangeSet (ChangeSet cs)
|
||||
{
|
||||
IntPtr err_handle;
|
||||
ChangeSet result = new ChangeSet (gconf_engine_reverse_change_set (handle, cs.Handle, out err_handle));
|
||||
if (err_handle != IntPtr.Zero)
|
||||
throw new GLib.GException (err_handle);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -25,6 +25,7 @@ sources = \
|
|||
ClientBase.cs \
|
||||
Client.cs \
|
||||
ChangeSet.cs \
|
||||
Engine.cs \
|
||||
_Entry.cs \
|
||||
NoSuchKeyException.cs \
|
||||
NotifyEventArgs.cs \
|
||||
|
|
Loading…
Add table
Reference in a new issue