[f-spot] Update to System.Uri killing gio-sharp.
- From: Ruben Vermeersch <rubenv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [f-spot] Update to System.Uri killing gio-sharp.
- Date: Tue, 25 May 2010 22:56:16 +0000 (UTC)
commit 4700dc2d8d5affe1db56c315ff0b3bad7f104911
Author: Ruben Vermeersch <ruben savanne be>
Date: Tue May 25 22:53:20 2010 +0200
Update to System.Uri killing gio-sharp.
lib/gio-sharp/generator/InterfaceGen.cs | 2 +-
lib/gio-sharp/generator/Method.cs | 18 ++++-
lib/gio-sharp/gio/AppInfoAdapter.custom | 36 +++++++----
lib/gio-sharp/gio/AssemblyInfo.cs | 2 +-
lib/gio-sharp/gio/File.custom | 35 +++++-----
lib/gio-sharp/gio/FileAdapter.custom | 47 ++++++--------
lib/gio-sharp/gio/FileEnumerator.custom | 28 +++++---
lib/gio-sharp/gio/FileFactory.cs | 28 +++++---
lib/gio-sharp/gio/Gio.metadata | 20 ++++++-
lib/gio-sharp/gio/GioStream.cs | 104 +++++++++++++++++++++----------
10 files changed, 202 insertions(+), 118 deletions(-)
---
diff --git a/lib/gio-sharp/generator/InterfaceGen.cs b/lib/gio-sharp/generator/InterfaceGen.cs
index 00cd892..85b93fa 100644
--- a/lib/gio-sharp/generator/InterfaceGen.cs
+++ b/lib/gio-sharp/generator/InterfaceGen.cs
@@ -363,7 +363,7 @@ namespace GtkSharp.Generation {
foreach (Method method in methods.Values) {
if (IgnoreMethod (method, this))
continue;
- method.GenerateDecl (sw);
+ method.GenerateDecl (sw, true);
}
foreach (Property prop in props.Values)
diff --git a/lib/gio-sharp/generator/Method.cs b/lib/gio-sharp/generator/Method.cs
index 76cd721..3ecf077 100644
--- a/lib/gio-sharp/generator/Method.cs
+++ b/lib/gio-sharp/generator/Method.cs
@@ -105,7 +105,12 @@ namespace GtkSharp.Generation {
}
}
- private void GenerateDeclCommon (StreamWriter sw, ClassBase implementor)
+ private void GenerateDeclCommon (StreamWriter sw, ClassBase implementor)
+ {
+ GenerateDeclCommon (sw, implementor, false);
+ }
+
+ private void GenerateDeclCommon (StreamWriter sw, ClassBase implementor, bool is_interface)
{
if (IsStatic)
sw.Write("static ");
@@ -116,7 +121,7 @@ namespace GtkSharp.Generation {
if (implementor != null)
dup = implementor.GetMethodRecursively (Name);
- if (Name == "ToString" && Parameters.Count == 0)
+ if (Name == "ToString" && Parameters.Count == 0 && !is_interface)
sw.Write("override ");
else if (Name == "GetGType" && container_type is ObjectGen)
sw.Write("new ");
@@ -146,7 +151,12 @@ namespace GtkSharp.Generation {
}
}
- public void GenerateDecl (StreamWriter sw)
+ public void GenerateDecl (StreamWriter sw)
+ {
+ GenerateDecl (sw, false);
+ }
+
+ public void GenerateDecl (StreamWriter sw, bool is_interface)
{
if (IsStatic)
return;
@@ -173,7 +183,7 @@ namespace GtkSharp.Generation {
else
{
sw.Write("\t\t");
- GenerateDeclCommon (sw, null);
+ GenerateDeclCommon (sw, null, is_interface);
sw.WriteLine (";");
}
diff --git a/lib/gio-sharp/gio/AppInfoAdapter.custom b/lib/gio-sharp/gio/AppInfoAdapter.custom
index 1c4a337..a57d95b 100644
--- a/lib/gio-sharp/gio/AppInfoAdapter.custom
+++ b/lib/gio-sharp/gio/AppInfoAdapter.custom
@@ -1,22 +1,30 @@
-// AppInfoAdapter.custom - customizations to GLib.AppInfoAdapter
//
-// Authors: Stephane Delcroix <stephane delcroix org>
+// AppInfoAdapter.custom
//
-// Copyright (c) 2008 Novell, Inc.
+// Author:
+// Stephane Delcroix <stephane delcroix org>
//
-// 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.
+// Copyright (C) 2008 Novell, Inc.
//
-// 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.
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-// 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.
[DllImport("libgio-2.0-0.dll")]
static extern IntPtr g_app_info_get_all();
diff --git a/lib/gio-sharp/gio/AssemblyInfo.cs b/lib/gio-sharp/gio/AssemblyInfo.cs
index a061da1..56378fd 100644
--- a/lib/gio-sharp/gio/AssemblyInfo.cs
+++ b/lib/gio-sharp/gio/AssemblyInfo.cs
@@ -3,5 +3,5 @@ using System.Runtime.CompilerServices;
[assembly:AssemblyVersion("2.14.0.0")]
[assembly:AssemblyDelaySign(false)]
-[assembly:AssemblyKeyFile("gtk-sharp.snk")]
+[assembly:AssemblyKeyFile("./gtk-sharp.snk")]
[assembly:GLib.IgnoreClassInitializers]
diff --git a/lib/gio-sharp/gio/File.custom b/lib/gio-sharp/gio/File.custom
index f764de7..23519f8 100644
--- a/lib/gio-sharp/gio/File.custom
+++ b/lib/gio-sharp/gio/File.custom
@@ -2,30 +2,31 @@
//
// Authors: Stephane Delcroix <stephane delcroix org>
//
-// Copyright (c) 2008 Novell, Inc.
+// 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.
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
//
-// 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.
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-// 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.
bool Exists
{
get;
}
-System.Uri Uri
-{
- get;
-}
-
bool Delete();
diff --git a/lib/gio-sharp/gio/FileAdapter.custom b/lib/gio-sharp/gio/FileAdapter.custom
index bab7ab7..5ec0661 100644
--- a/lib/gio-sharp/gio/FileAdapter.custom
+++ b/lib/gio-sharp/gio/FileAdapter.custom
@@ -1,26 +1,33 @@
// FileAdapter.custom - customizations to GLib.FileAdapter
//
-// Authors: Stephane Delcroix <stephane delcroix org>
+// Author:
+// Stephane Delcroix <stephane delcroix org>
//
-// Copyright (c) 2008 Novell, Inc.
+// 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.
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
//
-// 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.
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-// 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 ();
+ return Uri;
}
public bool Exists {
@@ -32,15 +39,3 @@ public bool Delete ()
return Delete (null);
}
-[DllImport("libgio-2.0-0.dll")]
-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/lib/gio-sharp/gio/FileEnumerator.custom b/lib/gio-sharp/gio/FileEnumerator.custom
index acd4832..4c8001a 100644
--- a/lib/gio-sharp/gio/FileEnumerator.custom
+++ b/lib/gio-sharp/gio/FileEnumerator.custom
@@ -4,19 +4,25 @@
//
// 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.
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
//
-// 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.
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-// 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 IEnumerator GetEnumerator ()
{
diff --git a/lib/gio-sharp/gio/FileFactory.cs b/lib/gio-sharp/gio/FileFactory.cs
index 8fa3a58..8a5661c 100644
--- a/lib/gio-sharp/gio/FileFactory.cs
+++ b/lib/gio-sharp/gio/FileFactory.cs
@@ -6,19 +6,25 @@
//
// Copyright (c) 2008 Stephane Delcroix
//
-// 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.
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
//
-// 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.
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-// 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.
using System;
using System.Runtime.InteropServices;
diff --git a/lib/gio-sharp/gio/Gio.metadata b/lib/gio-sharp/gio/Gio.metadata
index 81716fc..ab82fbf 100644
--- a/lib/gio-sharp/gio/Gio.metadata
+++ b/lib/gio-sharp/gio/Gio.metadata
@@ -12,7 +12,6 @@
<attr path="/api/namespace/interface[ cname='GAppInfo']/method[ name='SupportsUris']" name="name">GetSupportsUris</attr>
<attr path="/api/namespace/interface[ cname='GDrive']" name="consume_only">1</attr>
<attr path="/api/namespace/interface[ cname='GFile']/method[ name='GetParseName']" name="name">GetParsedName</attr>
- <attr path="/api/namespace/interface[ cname='GFile']/method[ name='GetUri']" name="hidden">1</attr>
<attr path="/api/namespace/interface[ cname='GLoadableIcon']/method[ name='LoadAsync']/*/*[ type='GAsyncReadyCallback']" name="scope">async</attr>
<attr path="/api/namespace/interface/method/*/*[ type='GAsyncReadyCallback']" name="scope">async</attr>
<attr path="/api/namespace/interface[ cname='GMount']" name="consume_only">1</attr>
@@ -58,4 +57,23 @@
<attr path="/api/namespace/object[ cname='GVolumeMonitor']/method[ name='GetConnectedDrives']/return-type" name="element_type">GDrive*</attr>
<attr path="/api/namespace/object[ cname='GVolumeMonitor']/method[ name='GetConnectedDrives']/return-type" name="owned">true</attr>
<attr path="/api/namespace/struct[ cname='GFileAttributeInfoList']/field[ name='Infos']" name="array">1</attr>
+
+ <attr path="/api/namespace/enum[ cname='GSocketFamily']" name="hidden">1</attr>
+ <attr path="/api/namespace/enum[ cname='GSocketMsgFlags']" name="hidden">1</attr>
+ <attr path="/api/namespace/enum[ cname='GSocketProtocol']" name="hidden">1</attr>
+ <attr path="/api/namespace/enum[ cname='GSocketType']" name="hidden">1</attr>
+ <attr path="/api/namespace/enum[ cname='GResolverError']" name="hidden">1</attr>
+ <attr path="/api/namespace/struct[ cname='GResolver']" name="hidden">1</attr>
+ <attr path="/api/namespace/struct[ cname='GSocket']" name="hidden">1</attr>
+ <attr path="/api/namespace/struct[ cname='GSocketAddress']" name="hidden">1</attr>
+ <attr path="/api/namespace/struct[ cname='GSocketAddressEnumerator']" name="hidden">1</attr>
+ <attr path="/api/namespace/struct[ cname='GSocketClient']" name="hidden">1</attr>
+ <attr path="/api/namespace/struct[ cname='GSocketConnectable']" name="hidden">1</attr>
+ <attr path="/api/namespace/struct[ cname='GSocketConnection']" name="hidden">1</attr>
+ <attr path="/api/namespace/struct[ cname='GSocketControlMessage']" name="hidden">1</attr>
+ <attr path="/api/namespace/struct[ cname='GSocketListener']" name="hidden">1</attr>
+ <attr path="/api/namespace/struct[ cname='GSocketService']" name="hidden">1</attr>
+ <attr path="/api/namespace/struct[ cname='GThreadedSocketService']" name="hidden">1</attr>
+ <attr path="/api/namespace/struct[ cname='GTcpConnection']" name="hidden">1</attr>
+
</metadata>
diff --git a/lib/gio-sharp/gio/GioStream.cs b/lib/gio-sharp/gio/GioStream.cs
index 03d1696..b0be69e 100644
--- a/lib/gio-sharp/gio/GioStream.cs
+++ b/lib/gio-sharp/gio/GioStream.cs
@@ -1,32 +1,33 @@
-/*
- * GioStream.cs: provide a System.IO.Stream api to [Input|Output]Streams
- *
- * Author(s):
- * Stephane Delcroix (stephane delcroix org)
- *
- * Copyright (c) 2008 Novell, Inc.
- *
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
+//
+// GioStream.cs - provide a System.IO.Stream api to [Input|Output]Streams
+//
+// Author(s):
+// Stephane Delcroix <stephane delcroix org>
+// Gabriel Burt <gabriel burt gmail com>
+//
+// Copyright (c) 2008 Stephane Delcroix
+// Copyright (c) 2010 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
using System;
namespace GLib
@@ -63,6 +64,16 @@ namespace GLib
can_seek = stream is Seekable && (stream as Seekable).CanSeek;
}
+#if GIO_SHARP_2_22
+ public GioStream (IOStream stream)
+ {
+ this.stream = stream;
+ can_read = true;
+ can_write = true;
+ can_seek = stream is Seekable && (stream as Seekable).CanSeek;
+ }
+#endif
+
public override bool CanSeek {
get { return can_seek; }
}
@@ -90,6 +101,12 @@ namespace GLib
FileInfo info = (stream as FileOutputStream).QueryInfo ("standard::size", null);
return info.Size;
}
+#if GIO_SHARP_2_22
+ if (stream is FileIOStream) {
+ FileInfo info = (stream as FileIOStream).QueryInfo ("standard::size", null);
+ return info.Size;
+ }
+#endif
throw new NotImplementedException (String.Format ("not implemented for {0} streams", stream.GetType()));
}
}
@@ -127,7 +144,13 @@ namespace GLib
throw new NotSupportedException ("The stream does not support reading");
if (is_disposed)
throw new ObjectDisposedException ("The stream is closed");
- InputStream input_stream = stream as InputStream;
+ InputStream input_stream = null;
+ if (stream is InputStream)
+ input_stream = stream as InputStream;
+#if GIO_SHARP_2_22
+ else if (stream is IOStream)
+ input_stream = (stream as IOStream).InputStream;
+#endif
if (input_stream == null)
throw new System.Exception ("this shouldn't happen");
@@ -155,7 +178,13 @@ namespace GLib
throw new NotSupportedException ("The stream does not support writing");
if (is_disposed)
throw new ObjectDisposedException ("The stream is closed");
- OutputStream output_stream = stream as OutputStream;
+ OutputStream output_stream = null;
+ if (stream is OutputStream)
+ output_stream = stream as OutputStream;
+#if GIO_SHARP_2_22
+ else if (stream is IOStream)
+ output_stream = (stream as IOStream).OutputStream;
+#endif
if (output_stream == null)
throw new System.Exception ("this shouldn't happen");
if (offset == 0) {
@@ -198,9 +227,16 @@ namespace GLib
{
if (!CanSeek || !CanWrite)
throw new NotSupportedException ("This stream doesn't support seeking");
+
+ var seekable = stream as Seekable;
+
+ if (!seekable.CanTruncate ())
+ throw new NotSupportedException ("This stream doesn't support truncating");
+
if (is_disposed)
throw new ObjectDisposedException ("The stream is closed");
- throw new NotImplementedException ();
+
+ seekable.Truncate (value, null);
}
public override void Close ()
@@ -209,6 +245,10 @@ namespace GLib
(stream as InputStream).Close (null);
if (stream is OutputStream)
(stream as OutputStream).Close (null);
+#if GIO_SHARP_2_22
+ if (stream is IOStream)
+ (stream as IOStream).Close (null);
+#endif
is_disposed = true;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]