[Muine] Gettext fix (for soon to be released mono Beta2)



hey all,

attached is a fix for issues with gettext that arise in the
soon-to-be-released mono Beta2. It incorporates the changes from fer for
a few things, and steals the latest code from monodevelop's gettext file
to get things working. none of my work really, just standing on shoulders.
(:


-pete

-- 
Peter Johanson
<latexer gentoo org>

Key ID = 0x6EFA3917
Key fingerprint = A90A 2518 57B1 9D20 9B71  A2FF 8649 439B 6EFA 3917
Index: src/AddAlbumWindow.cs
===================================================================
RCS file: /cvs/gnome/muine/src/AddAlbumWindow.cs,v
retrieving revision 1.36
diff -u -b -B -r1.36 AddAlbumWindow.cs
--- src/AddAlbumWindow.cs	6 May 2004 10:02:12 -0000	1.36
+++ src/AddAlbumWindow.cs	1 Jun 2004 15:36:42 -0000
@@ -184,7 +186,7 @@
 	{
 		ResponseArgs args = (ResponseArgs) a;
 
-		switch (args.ResponseId) {
+		switch ((int) args.ResponseId) {
 		case 1: /* Play */
 			window.Visible = false;
 
@@ -351,7 +353,7 @@
 	{
 		TreePath path;
 
-		if (!view.GetPathAtPos (args.X, args.Y, out path, null))
+		if (!view.GetPathAtPos (args.X, args.Y, out path))
 			return;
 
 		IntPtr album_ptr = view.GetHandleFromPath (path);
@@ -364,7 +366,7 @@
 	{
 		TreePath path;
 
-		if (!view.GetPathAtPos (args.X, args.Y, out path, null))
+		if (!view.GetPathAtPos (args.X, args.Y, out path))
 			return;
 
 		if (Muine.CoverDB.Loading)
Index: src/GettextCatalog.cs
===================================================================
RCS file: /cvs/gnome/muine/src/GettextCatalog.cs,v
retrieving revision 1.1
diff -u -b -B -r1.1 GettextCatalog.cs
--- src/GettextCatalog.cs	26 Feb 2004 13:11:18 -0000	1.1
+++ src/GettextCatalog.cs	1 Jun 2004 15:36:42 -0000
@@ -21,6 +21,7 @@
  *     be picked up by update-po.
  */
 
+using System;
 using System.Runtime.InteropServices;
 
 public class GettextCatalog
@@ -34,22 +35,55 @@
 	}
 
 	[DllImport ("libmuine")]
-	private static extern string intl_get_string (string str);
+	private static extern IntPtr intl_get_string (IntPtr str);
 
+	//public static string GetString (string str)
+	public string GetString (string str)
+	{
+		IntPtr inptr = Marshal.StringToHGlobalAuto (str);
+		IntPtr sptr = intl_get_string (inptr);
+		Marshal.FreeHGlobal (inptr);
+		if (inptr == sptr)
+			return str;
+		else    
+			return Marshal.PtrToStringAuto (sptr);
+	}
+
+	/*
 	public string GetString (string str)
 	{
 		return intl_get_string (str);
 	}
+	*/
 
 	[DllImport ("libmuine")]
-	private static extern string intl_get_plural_string (string singular,
-							     string plural,
+	private static extern IntPtr intl_get_plural_string (IntPtr singular,
+							     IntPtr plural,
 							     int n);
 
+	//public static string GetPluralString (string singular,
+	public string GetPluralString (string singular,
+					      string plural,
+					      int n)
+	{
+		IntPtr singptr = Marshal.StringToHGlobalAuto (singular);
+		IntPtr plurptr = Marshal.StringToHGlobalAuto (plural);
+		IntPtr sptr = intl_get_plural_string (singptr, plurptr, n);
+		Marshal.FreeHGlobal (singptr);
+		Marshal.FreeHGlobal (plurptr);
+		if (sptr == singptr)
+			return singular;
+		else if (sptr == plurptr)
+			return plural;
+		else
+			return Marshal.PtrToStringAuto (sptr);
+	}
+	/*
 	public string GetPluralString (string singular,
 				       string plural,
 				       int n)
 	{
 		return intl_get_plural_string (singular, plural, n);
 	}
+	*/
 }
Index: src/Player.cs
===================================================================
RCS file: /cvs/gnome/muine/src/Player.cs,v
retrieving revision 1.15
diff -u -b -B -r1.15 Player.cs
--- src/Player.cs	11 May 2004 17:52:42 -0000	1.15
+++ src/Player.cs	1 Jun 2004 15:36:42 -0000
@@ -20,8 +20,6 @@
 using System;
 using System.Runtime.InteropServices;
 
-using GLibSharp;
-
 public class Player : GLib.Object
 {
 	[DllImport ("libmuine")]
@@ -50,7 +48,7 @@
 
 			player_set_file (Raw, song.Filename, out error_ptr);
 			if (error_ptr != IntPtr.Zero) {
-				string error = Marshaller.PtrToStringGFree (error_ptr);
+				string error = GLib.Marshaller.PtrToStringGFree (error_ptr);
 
 				new ErrorDialog (String.Format (Muine.Catalog.GetString ("Error opening {0}:\n{1}"),
 				                                                         song.Filename, error));
@@ -190,7 +188,7 @@
 		
 		Raw = player_new (out error_ptr);
 		if (error_ptr != IntPtr.Zero) {
-			string error = Marshaller.PtrToStringGFree (error_ptr);
+			string error = GLib.Marshaller.PtrToStringGFree (error_ptr);
 
 			throw new Exception (error);
 		}
Index: src/Song.cs
===================================================================
RCS file: /cvs/gnome/muine/src/Song.cs,v
retrieving revision 1.40
diff -u -b -B -r1.40 Song.cs
--- src/Song.cs	27 Apr 2004 17:25:41 -0000	1.40
+++ src/Song.cs	1 Jun 2004 15:36:43 -0000
@@ -24,7 +24,6 @@
 using System.Threading;
 using System.Runtime.InteropServices;
 
-using GLibSharp;
 using Gdk;
 
 public class Song
@@ -424,7 +423,7 @@
 		IntPtr ret, str_ptr;
 
 		ret = db_unpack_string (p, out str_ptr);
-		str = Marshaller.PtrToStringGFree (str_ptr);
+		str = GLib.Marshaller.PtrToStringGFree (str_ptr);
 
 		return ret;
 	}
Index: src/StockIcons.cs
===================================================================
RCS file: /cvs/gnome/muine/src/StockIcons.cs,v
retrieving revision 1.7
diff -u -b -B -r1.7 StockIcons.cs
--- src/StockIcons.cs	11 Apr 2004 15:42:51 -0000	1.7
+++ src/StockIcons.cs	1 Jun 2004 15:36:43 -0000
@@ -57,7 +57,7 @@
 			IconSet iconset = new IconSet (pixbuf);
 
 			/* add menu variant if we have it */
-			IO.Stream menu_stream = System.Reflection.Assembly.GetCallingAssembly ().GetManifestResourceStream (name + "-16.png");
+			System.IO.Stream menu_stream = System.Reflection.Assembly.GetCallingAssembly ().GetManifestResourceStream (name + "-16.png");
 			if (menu_stream != null) {
 				IconSource source = new IconSource ();
 				source.Pixbuf = new Pixbuf (menu_stream);
Index: src/StringUtils.cs
===================================================================
RCS file: /cvs/gnome/muine/src/StringUtils.cs,v
retrieving revision 1.12
diff -u -b -B -r1.12 StringUtils.cs
--- src/StringUtils.cs	26 Feb 2004 10:46:10 -0000	1.12
+++ src/StringUtils.cs	1 Jun 2004 15:36:43 -0000
@@ -20,8 +20,6 @@
 using System;
 using System.Runtime.InteropServices;
 
-using GLibSharp;
-
 public class StringUtils
 {
 	public static string SecondsToString (long time)
@@ -93,7 +91,7 @@
 	{
 		IntPtr str_ptr = g_utf8_collate_key (key, -1);
 		
-		return Marshaller.PtrToStringGFree (str_ptr);
+		return GLib.Marshaller.PtrToStringGFree (str_ptr);
 	}
 
 	public static string SelectionDataToString (Gtk.SelectionData data)

Attachment: pgpiFl2ERwovX.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]