Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

GLib.Format.SizeForDisplay()

  • Loading branch information...
commit aa2593bce975048e0d37aa50453a8d0ad8e9d680 1 parent a3f0f9e
Stephane Delcroix StephaneDelcroix authored
Showing with 38 additions and 0 deletions.
  1. +37 −0 GLib.Sources/Format.cs
  2. +1 −0  Makefile.am
37 GLib.Sources/Format.cs
View
@@ -0,0 +1,37 @@
+// Format.cs: Wrapper for the g_format code in Glib
+//
+// Authors:
+// Stephane Delcroix (stephane@delcroix.org)
+//
+// 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.
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace GLib {
+ public class Format {
+ [DllImport("libglib-2.0-0.dll")]
+ static extern IntPtr g_format_size_for_display (long size);
+
+ static public string SizeForDisplay (long size)
+ {
+ string result = Marshaller.PtrToStringGFree (g_format_size_for_display (size));
+ return result;
+ }
+ }
+}
1  Makefile.am
View
@@ -11,6 +11,7 @@ GTK_CUSTOMS = \
$(srcdir)/Gtk.Customs/Builder.custom
GLIB_SRCS = \
+ $(srcdir)/GLib.Sources/Format.cs \
$(srcdir)/GLib.Sources/Priority.cs \
$(srcdir)/GLib.Sources/Sources.cs \
$(srcdir)/GLib.Sources/Timeout.cs
Please sign in to comment.
Something went wrong with that request. Please try again.