#define ITEM_IFACE "org.kde.StatusNotifierItem"
-const char *Category_Name[] = {
- "unknown", "SystemServices"
+const char *Category_Names[] = {
+ "unknown", "SystemServices", NULL
};
const char *Status_Names[] = {
- "unknown", "Active", "Passive", "NeedsAttention"
+ "unknown", "Active", "Passive", "NeedsAttention", NULL
};
static const char *box_part_name = "e.dbus_notifier.box";
#define HOST_REGISTRER "/bla" //TODO check what watcher expect we send to him
-extern const char *Category_Name[];
+extern const char *Category_Names[];
extern const char *Status_Names[];
typedef struct _Notifier_Host_Data {
}
static int
-id_find(const char *text, const char *array_of_names[], unsigned max)
+id_find(const char *s, const char *names[])
{
unsigned i;
- for (i = 0; i < max; i++)
+
+ for (i = 0; names[i]; i++)
{
- if (strcmp(text, array_of_names[i]))
- continue;
- return i;
- }
+ if (!strcmp(s, names[i]))
+ return i;
+ }
return 0;
}
{
const char *category;
edbus_message_iter_arguments_get(var, "s", &category);
- item->category = id_find(category, Category_Name, CATEGORY_LAST);
+ item->category = id_find(category, Category_Names);
}
else if (!strcmp(key, "IconName"))
{
{
const char *status;
edbus_message_iter_arguments_get(var, "s", &status);
- item->status = id_find(status, Status_Names, STATUS_LAST);
+ item->status = id_find(status, Status_Names);
}
else if (!strcmp(key, "Id"))
{
ERR("Error reading message.");
return;
}
- item->status = id_find(status, Status_Names, STATUS_LAST);
+ item->status = id_find(status, Status_Names);
systray_notifier_item_update(item);
}