[Muine] [PATCH] Stop using deprecated Gtk.About, and make links clickable



This is my first code patch for Muine, and I suck at c#, so take it
easy.

This should silence a couple warnings and make the About box nicer to
use. The newer Gtk.AboutDialog has been around since GTK# 2.6.

Screenshot: http://floam.sh.nu/files/images/muineclickable.png

Aaron Gyes
Index: src/About.cs
===================================================================
--- src/About.cs	(revision 1019)
+++ src/About.cs	(working copy)
@@ -17,6 +17,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
+using System.Diagnostics;
 using Gtk;
 using Gdk;
 
@@ -24,7 +25,7 @@
 
 namespace Muine
 {
-	public class About : Gnome.About
+	public class About : AboutDialog
 	{
 		// Strings
 		private static readonly string string_translators = 
@@ -32,7 +33,10 @@
 
 		private static readonly string string_muine =
 			Catalog.GetString ("Muine");
-
+		
+		private static readonly string string_website =
+			Catalog.GetString ("http://muine-player.org/";);
+		
 		private static readonly string string_copyright =
 			Catalog.GetString ("Copyright � 2003-2006 Jorn Baayen");
 
@@ -47,7 +51,7 @@
 			Catalog.GetString ("Tamara Roberson <foxxygirltamara gmail com>"),
 			Catalog.GetString ("Peter Johanson <peter peterjohanson com>"),
 			"",
-			Catalog.GetString ("Album covers are provided by amazon.com and musicbrainz.org."),
+			Catalog.GetString ("Album covers are provided by:\n \thttp://amazon.com\n\thttp://musicbrainz.org.";),
 			null,
 		};
 		
@@ -79,13 +83,29 @@
 		/// <param name="parent">
 		///	The parent window
 		/// </param>
-		public About (Gtk.Window parent) 
-		: base (string_muine, Defines.VERSION, string_copyright, string_description,
-			authors, documenters, translators, pixbuf)
+
+		public About (Gtk.Window parent)
+		: base ()
 		{
+			SetUrlHook(new AboutDialogActivateLinkFunc (UrlHook));
+			SetEmailHook(new AboutDialogActivateLinkFunc (UrlHook));
+
+			Logo = pixbuf;
+			Name = string_muine;
+			Version = Defines.VERSION;
+			Comments = string_description;
+			Copyright = string_copyright;
+			Website = string_website;
+			Authors = authors;
+			TranslatorCredits = translators;
+
 			TransientFor = parent;
-
 			Show ();
 		}
+		
+		private void UrlHook (Gtk.AboutDialog about, string link)
+		{
+			Process.Start (new ProcessStartInfo ("gnome-open", link));
+		}
 	}
 }


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