Back to index

libappindicator  12.10.0
Defines | Functions
generate-id.c File Reference
#include "generate-id.h"

Go to the source code of this file.

Defines

#define MULTIPLIER   32

Functions

guint32 _generate_id (const AppIndicatorCategory catenum, const gchar *id)

Define Documentation

#define MULTIPLIER   32

Definition at line 24 of file generate-id.c.


Function Documentation

guint32 _generate_id ( const AppIndicatorCategory  catenum,
const gchar *  id 
)

Definition at line 27 of file generate-id.c.

{
       guchar category = 0;
       guchar first = 0;
       guchar second = 0;
       guchar third = 0;

       switch (catenum) {
       case APP_INDICATOR_CATEGORY_OTHER:
              category = MULTIPLIER * 5;
              break;
       case APP_INDICATOR_CATEGORY_APPLICATION_STATUS:
              category = MULTIPLIER * 4;
              break;
       case APP_INDICATOR_CATEGORY_COMMUNICATIONS:
              category = MULTIPLIER * 3;
              break;
       case APP_INDICATOR_CATEGORY_SYSTEM_SERVICES:
              category = MULTIPLIER * 2;
              break;
       case APP_INDICATOR_CATEGORY_HARDWARE:
              category = MULTIPLIER * 1;
              break;
       default:
              g_warning("Got an undefined category: %d", category);
              category = 0;
              break;
       }
       
       if (id != NULL) {
              if (id[0] != '\0') {
                     first = id[0];
                     if (id[1] != '\0') {
                            second = id[1];
                            if (id[2] != '\0') {
                                   third = id[2];
                            }
                     }
              }
       }

       return (((((category * 256) + first) * 256) + second) * 256) + third;
}

Here is the caller graph for this function: