diff --git a/gio/AppInfoAdapter.custom b/gio/AppInfoAdapter.cs similarity index 86% rename from gio/AppInfoAdapter.custom rename to gio/AppInfoAdapter.cs index aea897b12..0a1414ebb 100644 --- a/gio/AppInfoAdapter.custom +++ b/gio/AppInfoAdapter.cs @@ -1,4 +1,4 @@ -// AppInfoAdapter.custom - customizations to GLib.AppInfoAdapter +// AppInfoAdapter.cs - customizations to GLib.AppInfoAdapter // // Authors: Stephane Delcroix // @@ -18,6 +18,11 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. +namespace GLib { + using System; + using System.Runtime.InteropServices; + + public partial class AppInfoAdapter { [DllImport ("libgio-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr g_app_info_get_all(); @@ -26,3 +31,5 @@ GLib.AppInfo[] ret = (GLib.AppInfo[]) GLib.Marshaller.ListPtrToArray (raw_ret, typeof(GLib.List), true, false, typeof(GLib.AppInfo)); return ret; } + } +} \ No newline at end of file diff --git a/gio/File.custom b/gio/File.cs similarity index 79% rename from gio/File.custom rename to gio/File.cs index f764de790..87aaa0cb4 100644 --- a/gio/File.custom +++ b/gio/File.cs @@ -1,4 +1,4 @@ -// File.custom - customizations to GLib.File +// File.cs - customizations to GLib.File // // Authors: Stephane Delcroix // @@ -18,14 +18,18 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. -bool Exists -{ - get; +namespace GLib { + public partial interface File : GLib.IWrapper { + bool Exists + { + get; + } + + System.Uri Uri + { + get; + } + + bool Delete(); + } } - -System.Uri Uri -{ - get; -} - -bool Delete(); diff --git a/gio/FileEnumerator.custom b/gio/FileAdapter.cs similarity index 53% rename from gio/FileEnumerator.custom rename to gio/FileAdapter.cs index acd483295..3efec2234 100644 --- a/gio/FileEnumerator.custom +++ b/gio/FileAdapter.cs @@ -1,4 +1,4 @@ -// FileEnumerator.custom - customizations to GLib.FileEnumerator +// FileAdapter.cs - customizations to GLib.FileAdapter // // Authors: Stephane Delcroix // @@ -18,42 +18,34 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. -public IEnumerator GetEnumerator () -{ - return new Enumerator (this); -} - -public FileInfo NextFile () -{ - return NextFile ((Cancellable) null); -} - -class Enumerator : IEnumerator -{ - FileEnumerator file_enumerator; - - public Enumerator (FileEnumerator file_enumerator) - { - this.file_enumerator = file_enumerator; - } - - FileInfo current=null; - public object Current { - get { - return current; +namespace GLib { + using System; + using System.Runtime.InteropServices; + + public partial class FileAdapter { + public override string ToString () + { + return Uri.ToString (); + } + + public bool Exists { + get { return QueryExists (null); } + } + + public bool Delete () + { + return Delete (null); + } + + [DllImport ("libgio-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern IntPtr g_file_get_uri(IntPtr raw); + + public System.Uri Uri { + get { + IntPtr raw_ret = g_file_get_uri(Handle); + string ret = GLib.Marshaller.PtrToStringGFree(raw_ret); + return new System.Uri (ret); + } } } - - public bool MoveNext () - { - current = file_enumerator.NextFile (); - if (current == null) - return false; - return true; - } - - public void Reset () - { - throw new NotImplementedException (); - } } diff --git a/gio/FileAdapter.custom b/gio/FileAdapter.custom deleted file mode 100644 index 900366f82..000000000 --- a/gio/FileAdapter.custom +++ /dev/null @@ -1,46 +0,0 @@ -// FileAdapter.custom - customizations to GLib.FileAdapter -// -// Authors: Stephane Delcroix -// -// Copyright (c) 2008 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. - -public override string ToString () -{ - return Uri.ToString (); -} - -public bool Exists { - get { return QueryExists (null); } -} - -public bool Delete () -{ - return Delete (null); -} - -[DllImport ("libgio-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] -static extern IntPtr g_file_get_uri(IntPtr raw); - -public System.Uri Uri { - get { - IntPtr raw_ret = g_file_get_uri(Handle); - string ret = GLib.Marshaller.PtrToStringGFree(raw_ret); - return new System.Uri (ret); - } -} - - diff --git a/gio/FileEnumerator.cs b/gio/FileEnumerator.cs new file mode 100644 index 000000000..5b5d656dc --- /dev/null +++ b/gio/FileEnumerator.cs @@ -0,0 +1,66 @@ +// FileEnumerator.cs - customizations to GLib.FileEnumerator +// +// Authors: Stephane Delcroix +// +// Copyright (c) 2008 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 GLib { + using System; + using System.Collections; + + public partial class FileEnumerator { + public IEnumerator GetEnumerator () + { + return new Enumerator (this); + } + + public FileInfo NextFile () + { + return NextFile ((Cancellable) null); + } + + class Enumerator : IEnumerator + { + FileEnumerator file_enumerator; + + public Enumerator (FileEnumerator file_enumerator) + { + this.file_enumerator = file_enumerator; + } + + FileInfo current=null; + public object Current { + get { + return current; + } + } + + public bool MoveNext () + { + current = file_enumerator.NextFile (); + if (current == null) + return false; + return true; + } + + public void Reset () + { + throw new NotImplementedException (); + } + } + } +} \ No newline at end of file diff --git a/gio/Makefile.am b/gio/Makefile.am index ddf7ff512..b7afdeaa3 100644 --- a/gio/Makefile.am +++ b/gio/Makefile.am @@ -12,15 +12,13 @@ glue_includes = gio/gio.h POLICY_VERSIONS= sources = \ + AppInfoAdapter.cs \ + File.cs \ + FileAdapter.cs \ + FileEnumerator.cs \ FileFactory.cs \ GioStream.cs -customs = \ - AppInfoAdapter.custom \ - File.custom \ - FileAdapter.custom \ - FileEnumerator.custom - add_dist = gio-sharp-3.0.pc.in include ../Makefile.include