gnome-desktop r5454 - in trunk: . gnome-about



Author: vuntz
Date: Thu Mar 26 15:57:44 2009
New Revision: 5454
URL: http://svn.gnome.org/viewvc/gnome-desktop?rev=5454&view=rev

Log:
2009-03-26  Vincent Untz  <vuntz gnome org>

	* gnome-about/gnome-about.in: make the code returning the content of
	gnome-version.xml a bit more solid, so that we can handle a file
	that doesn't contain the date, the distributor or the version.


Modified:
   trunk/ChangeLog
   trunk/gnome-about/gnome-about.in

Modified: trunk/gnome-about/gnome-about.in
==============================================================================
--- trunk/gnome-about/gnome-about.in	(original)
+++ trunk/gnome-about/gnome-about.in	Thu Mar 26 15:57:44 2009
@@ -86,7 +86,7 @@
         # FIXME: we don't have g_locale_to_utf8 in python. See bug #530382
         return unicode (time.strftime ("%x", time.strptime (date, "%Y-%m-%d")), locale.getpreferredencoding ()).encode ("utf-8")
     except:
-        return False
+        return ""
 
 # Imported from GNOME's Sabayon
 # (sabayon/admin-tool/lockdown/disabledapplets.py)
@@ -965,7 +965,9 @@
                 self.load_description_messages (node)
 
         '''Format version'''
-        if not len (infos["minor"]):
+        if not len (infos["platform"]):
+            version = ""
+        elif not len (infos["minor"]):
             version = infos["platform"]
         elif not len (infos["micro"]):
             version = "%s.%s" % (infos["platform"], infos["minor"])
@@ -973,11 +975,17 @@
             version = "%s.%s.%s" % (infos["platform"], infos["minor"],
                                     infos["micro"])
 
-        return [
-                    (_("Version"), version),
-                    (_("Distributor"), infos["distributor"]),
-                    (_("Build Date"), cleanup_date (infos["date"]))
-               ]
+        date = cleanup_date (infos["date"])
+
+        retval = []
+        if version:
+            retval.append((_("Version"), version))
+        if infos["distributor"]:
+            retval.append((_("Distributor"), infos["distributor"]))
+        if date:
+            retval.append((_("Build Date"), date))
+
+        return retval
 
     def load_description_messages (self, node):
         '''Find the best translation of each description message'''



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