summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2006-11-07 17:21:13 +0000
committerRay Strode <rstrode@redhat.com>2006-11-07 17:21:13 +0000
commit46a49431585b61d3190cd19e7b16c6ff1179485b (patch)
treef08470fbc6c69edefb0ba59b18c06c67884fd87f
parent56dc8a2254fbaa8c7688594f59f841e444263208 (diff)
Print a warning instead of an error if categories aren't defined by the
2006-11-07 Ray Strode <rstrode@redhat.com> * src/validate.c: Print a warning instead of an error if categories aren't defined by the spec. Give special handling to the "Application" category since it's not defined by the spec, but is in wide use, and can be translated to one of the "main categories". (gnome bug 343799 comment 8)
-rw-r--r--ChangeLog11
-rw-r--r--src/validate.c80
2 files changed, 54 insertions, 37 deletions
diff --git a/ChangeLog b/ChangeLog
index 49c71a5..23c0193 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2006-11-07 Ray Strode <rstrode@redhat.com>
+ * src/validate.c: Print a warning instead of an error
+ if categories aren't defined by the spec. Give special
+ handling to the "Application" category since it's not
+ defined by the spec, but is in wide use, and can be
+ translated to one of the "main categories". (gnome bug
+ 343799 comment 8)
+
+2006-11-07 Ray Strode <rstrode@redhat.com>
+
* src/validate.c: Validate keywords as localestrings
instead of strings (red hat bug 172423). Patch from
Ville Skyttä <ville.skytta@iki.fi>
@@ -37,7 +46,7 @@
TeminalEmulator -> TerminalEmulator
ScreenSaver -> Screensaver
spotted by Vincent Fretin (in gnome bug
- 342799)
+ 343799)
2006-11-06 Ray Strode <rstrode@redhat.com>
diff --git a/src/validate.c b/src/validate.c
index 605dbef..371b3fb 100644
--- a/src/validate.c
+++ b/src/validate.c
@@ -148,38 +148,37 @@ validate_strings (const char *value, const char *key, const char *locale, const
static void
validate_categories (const char *value, const char *key, const char *locale, const char *filename, GnomeDesktopFile *df)
{
+ #define MAIN_CATEGORIES \
+ "AudioVideo", "Audio", "Video", "Development", "Education", "Game", \
+ "Graphics", "Network", "Office", "Settings", "System", "Utility"
+
+ #define ADDITIONAL_CATEGORIES \
+ "Building", "Debugger", "IDE", "GUIDesigner", "Profiling", \
+ "RevisionControl", "Translation", "Calendar", "ContactManagement", \
+ "Database", "Dictionary", "Chart", "Email", "Finance", "FlowChart", "PDA", \
+ "ProjectManagement", "Presentation", "Spreadsheet", "WordProcessor", \
+ "2DGraphics", "VectorGraphics", "RasterGraphics", "3DGraphics", \
+ "Scanning", "OCR", "Photography", "Viewer", "DesktopSettings", \
+ "HardwareSettings", "PackageManager", "Dialup", "InstantMessaging", \
+ "IRCClient", "FileTransfer", "HamRadio", "News", "P2P", "RemoteAccess", \
+ "Telephony", "WebBrowser", "WebDevelopment", "Midi", "Mixer", "Sequencer", \
+ "Tuner", "TV", "AudioVideoEditing", "Player", "Recorder", "DiscBurning", \
+ "ActionGame", "AdventureGame", "ArcadeGame", "BoardGame", "BlocksGame", \
+ "CardGame", "KidsGame", "LogicGame", "RolePlaying", "Simulation", \
+ "SportsGame", "StrategyGame", "Art", "Construction", "Music", "Languages", \
+ "Science", "Astronomy", "Biology", "Chemistry", "Geology", "Math", \
+ "MedicalSoftware", "Physics", "Amusement", "Archiving", "Electronics", \
+ "Emulator", "Engineering", "FileManager", "TerminalEmulator", \
+ "Filesystem", "Monitor", "Security", "Accessibility", "Calculator", \
+ "Clock", "TextEditor", "Core", "KDE", "GNOME", "GTK", "Qt", "Motif", \
+ "Java", "ConsoleOnly"
+
+ #define RESERVED_CATEGORIES \
+ "Screensaver", "TrayIcon", "Applet", "Shell"
+
/* Category list from Desktop Menu Specification version 1.0 */
- const char *categories_keys[] = {
-
- /* Main categories */
- "AudioVideo", "Audio", "Video", "Development", "Education", "Game",
- "Graphics", "Network", "Office", "Settings", "System", "Utility",
-
- /* Additional categories */
- "Building", "Debugger", "IDE", "GUIDesigner", "Profiling",
- "RevisionControl", "Translation", "Calendar", "ContactManagement",
- "Database", "Dictionary", "Chart", "Email", "Finance", "FlowChart", "PDA",
- "ProjectManagement", "Presentation", "Spreadsheet", "WordProcessor",
- "2DGraphics", "VectorGraphics", "RasterGraphics", "3DGraphics",
- "Scanning", "OCR", "Photography", "Viewer", "DesktopSettings",
- "HardwareSettings", "PackageManager", "Dialup", "InstantMessaging",
- "IRCClient", "FileTransfer", "HamRadio", "News", "P2P", "RemoteAccess",
- "Telephony", "WebBrowser", "WebDevelopment", "Midi", "Mixer", "Sequencer",
- "Tuner", "TV", "AudioVideoEditing", "Player", "Recorder", "DiscBurning",
- "ActionGame", "AdventureGame", "ArcadeGame", "BoardGame", "BlocksGame",
- "CardGame", "KidsGame", "LogicGame", "RolePlaying", "Simulation",
- "SportsGame", "StrategyGame", "Art", "Construction", "Music", "Languages",
- "Science", "Astronomy", "Biology", "Chemistry", "Geology", "Math",
- "MedicalSoftware", "Physics", "Amusement", "Archiving", "Electronics",
- "Emulator", "Engineering", "FileManager", "TerminalEmulator",
- "Filesystem", "Monitor", "Security", "Accessibility", "Calculator",
- "Clock", "TextEditor", "Core", "KDE", "GNOME", "GTK", "Qt", "Motif",
- "Java", "ConsoleOnly",
-
- /* Reserved categories */
- "Screensaver", "TrayIcon", "Applet", "Shell",
-
- NULL
+ static const char *categories_keys[] = {
+ MAIN_CATEGORIES, ADDITIONAL_CATEGORIES, RESERVED_CATEGORIES, NULL
};
char **vals;
int i;
@@ -222,10 +221,11 @@ validate_categories (const char *value, const char *key, const char *locale, con
{
if (strcmp (vals[i], categories_keys[j]) != 0)
{
- print_fatal (filename, "%s values are case sensitive (should be \"%s\" instead of \"%s\")\n",
+ print_warning (filename, "%s values are case sensitive (should be \"%s\" instead of \"%s\")\n",
key, categories_keys[j], vals[i]);
}
- break;
+
+ break;
}
++j;
}
@@ -234,9 +234,17 @@ validate_categories (const char *value, const char *key, const char *locale, con
{
char *valid_categories;
- valid_categories = g_strjoinv ("\", \"", (gchar **) categories_keys);
- print_fatal (filename, "%s values must be one of \"%s\" (found \"%s\")\n",
- key, valid_categories, vals[i]);
+ if ((g_ascii_strcasecmp (vals[i], "Application") == 0) ||
+ (g_ascii_strcasecmp (vals[i], "Applications") == 0))
+ {
+ valid_categories = g_strjoin ("\", \"", MAIN_CATEGORIES, NULL);
+ print_warning (filename, "The 'Application' category is not defined by the desktop entry specification. Please use one of \"%s\" instead\n",
+ valid_categories);
+ } else {
+ valid_categories = g_strjoinv ("\", \"", (gchar **) categories_keys);
+ print_warning (filename, "%s values must be one of \"%s\" (found \"%s\")\n",
+ key, valid_categories, vals[i]);
+ }
g_free (valid_categories);
}
++i;