diff options
author | Ted Gould <ted@gould.cx> | 2010-08-11 11:03:02 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-08-11 11:03:02 -0500 |
commit | 38c7a01f9a5c462ea31403a55de5b08f3fb86222 (patch) | |
tree | 7eaacc7312bf92bbd07f60b636dd77d31c31c5e0 /src | |
parent | 26d50dfef1ddbc5cda58cb221501c6b5654b36b5 (diff) | |
download | libayatana-appindicator-38c7a01f9a5c462ea31403a55de5b08f3fb86222.tar.gz libayatana-appindicator-38c7a01f9a5c462ea31403a55de5b08f3fb86222.tar.bz2 libayatana-appindicator-38c7a01f9a5c462ea31403a55de5b08f3fb86222.zip |
Making the categories a case statement.
Diffstat (limited to 'src')
-rw-r--r-- | src/generate-id.c | 24 |
1 files changed, 23 insertions, 1 deletions
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; |