banshee r4834 - in trunk/banshee: . src src/Core/Banshee.Services/Banshee.ServiceStack



Author: abock
Date: Tue Nov 11 01:32:55 2008
New Revision: 4834
URL: http://svn.gnome.org/viewvc/banshee?rev=4834&view=rev

Log:
* banshee/configure.ac:
* banshee/src/AssemblyInfo.cs.in:
* banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs:
  Added a third version concept, since we need the assembly version to
  stay the same to reflect the stable API version

Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/configure.ac
   trunk/banshee/src/AssemblyInfo.cs.in
   trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs

Modified: trunk/banshee/configure.ac
==============================================================================
--- trunk/banshee/configure.ac	(original)
+++ trunk/banshee/configure.ac	Tue Nov 11 01:32:55 2008
@@ -1,11 +1,11 @@
 dnl Automake setup
 AC_INIT([banshee-1], [1.4.1])
-ASM_DISPLAY_VERSION="1.4.1"
+DISPLAY_VERSION="1.4.1"
 API_VERSION="1.4"
 ASM_VERSION="$API_VERSION.0.0"
 AC_SUBST(API_VERSION)
 AC_SUBST(ASM_VERSION)
-AC_SUBST(ASM_DISPLAY_VERSION)
+AC_SUBST(DISPLAY_VERSION)
 
 DISTCHECK_CONFIGURE_FLAGS="--disable-docs --enable-mtp --enable-daap --enable-podcast --enable-release"
 AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)

Modified: trunk/banshee/src/AssemblyInfo.cs.in
==============================================================================
--- trunk/banshee/src/AssemblyInfo.cs.in	(original)
+++ trunk/banshee/src/AssemblyInfo.cs.in	Tue Nov 11 01:32:55 2008
@@ -2,24 +2,30 @@
 using System.Reflection;
 using System.Runtime.CompilerServices;
 
+[assembly: ApplicationVersion ("@VERSION@", "@DISPLAY_VERSION@")]
 [assembly: AssemblyVersion ("@ASM_VERSION@")]
-[assembly: AssemblyDisplayVersion ("@ASM_DISPLAY_VERSION@")]
 [assembly: AssemblyTitle ("Banshee")]
 [assembly: AssemblyDescription ("Banshee Media Player")]
 [assembly: AssemblyCopyright ("Copyright (C) 2005-2008 Novell, 2005 Aaron Bockover")]
 [assembly: AssemblyCompany ("Novell, Inc.")]
 
 [AttributeUsage (AttributeTargets.Assembly, Inherited = false)]
-internal sealed class AssemblyDisplayVersionAttribute : Attribute
+internal sealed class ApplicationVersionAttribute : Attribute
 {
-    private string version;
-    public string Version {
-        get { return version; }
+    private string release_version;
+    public string ReleaseVersion {
+        get { return release_version; }
     }
 
-    public AssemblyDisplayVersionAttribute (string version)
+    private string display_version;
+    public string DisplayVersion {
+        get { return display_version; }
+    }
+
+    public ApplicationVersionAttribute (string releaseVersion, string displayVersion)
     {
-        this.version = version;
+        release_version = releaseVersion;
+        display_version = displayVersion;
     }
 }
 

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs	Tue Nov 11 01:32:55 2008
@@ -239,43 +239,47 @@
             get { return "media-player-banshee"; }
         }
         
-        private static string version;
-        public static string Version {
+        private static string api_version;
+        public static string ApiVersion {
             get { 
-                if (version != null) {
-                    return version;
+                if (api_version != null) {
+                    return api_version;
                 }
                 
                 try {
                     AssemblyName name = Assembly.GetEntryAssembly ().GetName ();
-                    version = String.Format ("{0}.{1}.{2}", name.Version.Major, 
+                    api_version = String.Format ("{0}.{1}.{2}", name.Version.Major, 
                         name.Version.Minor, name.Version.Build);
                 } catch {
-                    version = Catalog.GetString ("Unknown");
+                    api_version = "unknown";
                 }
                 
-                return version;
+                return api_version;
             }
         }
         
+        private static string version;
+        public static string Version {
+            get { return version ?? (version = GetVersion ("ReleaseVersion")); }
+        }
+        
         private static string display_version;
         public static string DisplayVersion {
-            get { 
-                if (display_version != null) {
-                    return display_version;
-                }
-                
-                foreach (Attribute attribute in Assembly.GetEntryAssembly ().GetCustomAttributes (false)) {
-                    Type type = attribute.GetType ();
-                    PropertyInfo property = type.GetProperty ("Version");
-                    if (type.Name == "AssemblyDisplayVersionAttribute" && property != null && 
-                        property.PropertyType == typeof (string)) {
-                        display_version = (string)property.GetValue (attribute, null); 
-                    }
+            get { return display_version ?? (display_version = GetVersion ("DisplayVersion")); }
+        }
+        
+        private static string GetVersion (string versionName)
+        {
+            foreach (Attribute attribute in Assembly.GetEntryAssembly ().GetCustomAttributes (false)) {
+                Type type = attribute.GetType ();
+                PropertyInfo property = type.GetProperty (versionName);
+                if (type.Name == "ApplicationVersionAttribute" && property != null && 
+                    property.PropertyType == typeof (string)) {
+                    return (string)property.GetValue (attribute, null); 
                 }
-                
-                return display_version;
             }
+            
+            return Catalog.GetString ("Unknown");
         }
     }
 }



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