Skip to content

Commit

Permalink
Add icons to notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrisbin committed Mar 6, 2014
1 parent 898942a commit d07994f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion android-receiver.c
Expand Up @@ -126,32 +126,38 @@ static void handle_message(char *msg) {

struct message_t *message;
char *title;
char *icon;

message = parse_message(msg);

switch (message->event_type) {
case Ring:
asprintf(&title, "Call: %s", message->data);
icon = "call-start";
break;
case SMS:
asprintf(&title, "SMS: %s", message->data);
icon = "stock_mail-unread";
break;
case MMS:
asprintf(&title, "MMS: %s", message->data);
icon = "stock_mail-unread";
break;
case Battery:
asprintf(&title, "Battery: %s", message->data);
icon = "battery-good"; // TODO: various levels and charge-state
break;
case Ping:
title = "Ping";
icon = "emblem-important";
break;

default:
return;
}

notify_init("android-receiver");
NotifyNotification *n = notify_notification_new(title, message->event_contents, NULL);
NotifyNotification *n = notify_notification_new(title, message->event_contents, icon);
notify_notification_show(n, NULL);
g_object_unref(G_OBJECT(n));
notify_uninit();
Expand Down

0 comments on commit d07994f

Please sign in to comment.