summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Untz <vuntz@gnome.org>2012-10-03 08:17:39 +0200
committerVincent Untz <vuntz@gnome.org>2012-10-03 11:42:52 +0200
commit6a685a92691087eeb0325355e52b42ecf621f797 (patch)
tree1554c1e4571b7a73ed401ada8afc3028ac85ee2e
parentc3eeb8c7b4a63233226ef76a56221a167510253e (diff)
downloaddesktop-file-utils-6a685a92691087eeb0325355e52b42ecf621f797.tar.gz
validate: Output hint if more than one main category is present
-rw-r--r--src/validate.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/validate.c b/src/validate.c
index 78e5869..81f0c14 100644
--- a/src/validate.c
+++ b/src/validate.c
@@ -1484,6 +1484,9 @@ handle_mime_key (kf_validator *kf,
* FIXME: it's not really deprecated, so the error message is wrong
* + All categories extending the format should start with "X-".
* Checked.
+ * + Using multiple main categories may lead to appearing more than once in
+ * application menu.
+ * Checked.
* + One main category should be included, otherwise application will appear in
* "catch-all" section of application menu.
* Checked.
@@ -1504,6 +1507,7 @@ handle_categories_key (kf_validator *kf,
int i;
unsigned int j;
gboolean main_category_present;
+ gboolean more_than_one_main_category;
handle_key_for_application (kf, locale_key, value);
@@ -1538,6 +1542,7 @@ handle_categories_key (kf_validator *kf,
/* second pass */
main_category_present = FALSE;
+ more_than_one_main_category = FALSE;
for (i = 0; categories[i]; i++) {
unsigned int k;
@@ -1564,6 +1569,15 @@ handle_categories_key (kf_validator *kf,
continue;
}
+ if (registered_categories[j].main && main_category_present &&
+ !more_than_one_main_category) {
+ print_hint (kf, "value \"%s\" for key \"%s\" in group \"%s\" "
+ "contains more than one main category; application "
+ "might appear more than once in the application menu\n",
+ value, locale_key, kf->current_group);
+ more_than_one_main_category = TRUE;
+ }
+
if (registered_categories[j].main)
main_category_present = TRUE;