Browse Source

notification: produce a shell notification

Should display a shell notification. Skips notification from dialer,
these will likely be taken care of with telephony plugin.
bboozzoo/device-cache
Maciek Borzecki 10 years ago
parent
commit
9a6bb27844
1 changed files with 25 additions and 0 deletions
  1. +25
    -0
      src/notification.vala

+ 25
- 0
src/notification.vala View File

@ -44,5 +44,30 @@ class NotificationHandler : Object, PacketHandlerInterface {
public void message(Packet pkt) {
debug("got notification packet");
// get application ID
string id = pkt.body.get_string_member("id");
// dialer notifications are handled by telephony plugin
if (id.match_string("com.android.dialer", false) == true)
return;
// other notifications
if (pkt.body.has_member("appName") == false ||
pkt.body.has_member("ticker") == false)
return;
string app = pkt.body.get_string_member("appName");
string ticker = pkt.body.get_string_member("ticker");
// skip empty notifications
if (ticker.length == 0)
return;
GLib.message("notification from %s: %s", app, ticker);
var notif = new Notify.Notification(app, ticker,
"dialog-information");
notif.show();
}
}

Loading…
Cancel
Save