[banshee/gtk3] build: guard against underscores in GSettingsSchemaExtractor



commit 7176e0fdd0a712eed73035bc558d67982b9c7f20
Author: Andres G. Aragoneses <knocte gmail com>
Date:   Wed Dec 19 00:54:58 2012 +0000

    build: guard against underscores in GSettingsSchemaExtractor
    
    Turns out GSettings is allergic to underscores, as evidenced by these errors
    when running make:
    
    org.gnome.banshee.gschema.xml: Error on line 4 char 1: invalid name 'show_artist_filter': invalid character '_'; only lowercase letters, numbers and hyphen ('-') are permitted..  --strict was specified; exiting.
    make[2]: *** [org.gnome.banshee.gschema.valid] Error 1
    make[1]: *** [all-recursive] Error 1
    make: *** [all] Error 2
    
    org.gnome.banshee.gschema.xml: Error on line 5 char 18: Element <_summary> not allowed inside <key>.  --strict was specified; exiting.
    make[2]: *** [org.gnome.banshee.gschema.valid] Error 1
    make[1]: *** [all-recursive] Error 1
    make: *** [all] Error 2

 build/GSettingsSchemaExtractor.cs      |    6 ++-
 build/GSettingsSchemaExtractorTests.cs |   50 ++++++++++++++++----------------
 2 files changed, 29 insertions(+), 27 deletions(-)
---
diff --git a/build/GSettingsSchemaExtractor.cs b/build/GSettingsSchemaExtractor.cs
index 8deaee1..c5fd156 100644
--- a/build/GSettingsSchemaExtractor.cs
+++ b/build/GSettingsSchemaExtractor.cs
@@ -177,11 +177,13 @@ public class GSettingsSchemaExtractorProgram
             type_attrib = "a" + type_attrib;
         }
 
+        key = key.Replace ("_", "-");
+
         StringBuilder builder = new StringBuilder ();
         builder.AppendFormat ("    <key name=\"{0}\" type=\"{1}\">\n", key, type_attrib);
         builder.AppendFormat ("      <default>{0}</default>\n", str_val);
-        builder.AppendFormat ("      <_summary>{0}</_summary>\n", summary);
-        builder.AppendFormat ("      <_description>{0}</_description>\n", description);
+        builder.AppendFormat ("      <summary>{0}</summary>\n", summary);
+        builder.AppendFormat ("      <description>{0}</description>\n", description);
         builder.AppendFormat ("    </key>\n");
         if (entries.ContainsKey (id)) {
             entries [id].Add (builder);
diff --git a/build/GSettingsSchemaExtractorTests.cs b/build/GSettingsSchemaExtractorTests.cs
index 869712b..ccd12d0 100644
--- a/build/GSettingsSchemaExtractorTests.cs
+++ b/build/GSettingsSchemaExtractorTests.cs
@@ -54,10 +54,10 @@ namespace GSettingsSchemaExtractor
             Assert.That (result.ToString ().Trim (), Is.EqualTo (@"
 <schemalist>
   <schema id=""org.gnome.banshee.player_window"" path=""/apps/banshee/player_window/"" gettext-domain=""banshee"">
-    <key name=""default_export_format"" type=""s"">
+    <key name=""default-export-format"" type=""s"">
       <default>'m3u'</default>
-      <_summary>Export Format</_summary>
-      <_description>The default playlist export format</_description>
+      <summary>Export Format</summary>
+      <description>The default playlist export format</description>
     </key>
   </schema>
 </schemalist>"
@@ -84,10 +84,10 @@ namespace GSettingsSchemaExtractor
             Assert.That (result.ToString ().Trim (), Is.EqualTo (@"
 <schemalist>
   <schema id=""org.gnome.banshee.import"" path=""/apps/banshee/import/"" gettext-domain=""banshee"">
-    <key name=""show_initial_import_dialog"" type=""b"">
+    <key name=""show-initial-import-dialog"" type=""b"">
       <default>true</default>
-      <_summary>Show the Initial Import Dialog</_summary>
-      <_description>Show the Initial Import Dialog when the Banshee library is empty</_description>
+      <summary>Show the Initial Import Dialog</summary>
+      <description>Show the Initial Import Dialog when the Banshee library is empty</description>
     </key>
   </schema>
 </schemalist>"
@@ -114,8 +114,8 @@ namespace GSettingsSchemaExtractor
   <schema id=""org.gnome.banshee.player_engine"" path=""/apps/banshee/player_engine/"" gettext-domain=""banshee"">
     <key name=""volume"" type=""i"">
       <default>80</default>
-      <_summary>Volume</_summary>
-      <_description>Volume of playback relative to mixer output</_description>
+      <summary>Volume</summary>
+      <description>Volume of playback relative to mixer output</description>
     </key>
   </schema>
 </schemalist>"
@@ -140,10 +140,10 @@ namespace GSettingsSchemaExtractor
             Assert.That (result.ToString ().Trim (), Is.EqualTo (@"
 <schemalist>
   <schema id=""org.gnome.banshee.player_window"" path=""/apps/banshee/player_window/"" gettext-domain=""banshee"">
-    <key name=""cover_art_size"" type=""d"">
+    <key name=""cover-art-size"" type=""d"">
       <default>20.5</default>
-      <_summary>Cover art size</_summary>
-      <_description>Surface size of cover art in the album grid</_description>
+      <summary>Cover art size</summary>
+      <description>Surface size of cover art in the album grid</description>
     </key>
   </schema>
 </schemalist>"
@@ -168,10 +168,10 @@ namespace GSettingsSchemaExtractor
             Assert.That (result.ToString ().Trim (), Is.EqualTo (@"
 <schemalist>
   <schema id=""org.gnome.banshee.sources.fsq"" path=""/apps/banshee/sources/fsq/"" gettext-domain=""banshee"">
-    <key name=""current_filters"" type=""as"">
+    <key name=""current-filters"" type=""as"">
       <default>['album','artist']</default>
-      <_summary></_summary>
-      <_description></_description>
+      <summary></summary>
+      <description></description>
     </key>
   </schema>
 </schemalist>"
@@ -190,20 +190,20 @@ namespace GSettingsSchemaExtractor
   <schema id=""org.gnome.banshee.player_engine"" path=""/apps/banshee/player_engine/"" gettext-domain=""banshee"">
     <key name=""volume"" type=""i"">
       <default>80</default>
-      <_summary>Volume</_summary>
-      <_description>Volume of playback relative to mixer output</_description>
+      <summary>Volume</summary>
+      <description>Volume of playback relative to mixer output</description>
     </key>
   </schema>
   <schema id=""org.gnome.banshee.player_window"" path=""/apps/banshee/player_window/"" gettext-domain=""banshee"">
-    <key name=""cover_art_size"" type=""d"">
+    <key name=""cover-art-size"" type=""d"">
       <default>20.5</default>
-      <_summary>Cover art size</_summary>
-      <_description>Surface size of cover art in the album grid</_description>
+      <summary>Cover art size</summary>
+      <description>Surface size of cover art in the album grid</description>
     </key>
-    <key name=""default_export_format"" type=""s"">
+    <key name=""default-export-format"" type=""s"">
       <default>'m3u'</default>
-      <_summary>Export Format</_summary>
-      <_description>The default playlist export format</_description>
+      <summary>Export Format</summary>
+      <description>The default playlist export format</description>
     </key>
   </schema>
 </schemalist>"
@@ -228,10 +228,10 @@ namespace GSettingsSchemaExtractor
             Assert.That (result.ToString ().Trim (), Is.EqualTo (@"
 <schemalist>
   <schema id=""org.gnome.banshee.plugins.audioscrobbler"" path=""/apps/banshee/plugins/audioscrobbler/"" gettext-domain=""banshee"">
-    <key name=""api_url"" type=""s"">
+    <key name=""api-url"" type=""s"">
       <default></default>
-      <_summary>AudioScrobbler API URL</_summary>
-      <_description>URL for the AudioScrobbler API (supports turtle.libre.fm, for instance)</_description>
+      <summary>AudioScrobbler API URL</summary>
+      <description>URL for the AudioScrobbler API (supports turtle.libre.fm, for instance)</description>
     </key>
   </schema>
 </schemalist>"



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