From 38c7a01f9a5c462ea31403a55de5b08f3fb86222 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 11 Aug 2010 11:03:02 -0500 Subject: Making the categories a case statement. --- src/generate-id.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/generate-id.c b/src/generate-id.c index 79e2c26..5b0eb8b 100644 --- a/src/generate-id.c +++ b/src/generate-id.c @@ -33,12 +33,34 @@ union ordering_id_union_t { struct ordering_id_struct str; }; +#define MULTIPLIER 32 + guint32 generate_id (const AppIndicatorCategory category, const gchar * id) { union ordering_id_union_t u; - u.str.category = category; + switch (category) { + case APP_INDICATOR_CATEGORY_OTHER: + u.str.category = MULTIPLIER * 5; + break; + case APP_INDICATOR_CATEGORY_APPLICATION_STATUS: + u.str.category = MULTIPLIER * 4; + break; + case APP_INDICATOR_CATEGORY_COMMUNICATIONS: + u.str.category = MULTIPLIER * 3; + break; + case APP_INDICATOR_CATEGORY_SYSTEM_SERVICES: + u.str.category = MULTIPLIER * 2; + break; + case APP_INDICATOR_CATEGORY_HARDWARE: + u.str.category = MULTIPLIER * 1; + break; + default: + g_warning("Got an undefined category: %d", category); + u.str.category = 0; + break; + } u.str.first = 0; u.str.second = 0; -- cgit v1.2.3