Mercurial > projects > pk-update-icon
view notify.c @ 2:847ae02bc13b
added GPLv2 headers
author | Pavol Rusnak <stick@gk2.sk> |
---|---|
date | Tue, 27 Sep 2011 02:31:31 +0200 |
parents | f5e03fc667f8 |
children | f8ad23e60000 |
line wrap: on
line source
/* * Copyright (C) 2011 Pavol Rusnak <stick@gk2.sk> * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <libnotify/notify.h> #include "notify.h" #define NOTIFY_NAME "Software Update" void init_notify() { notify_init(NOTIFY_NAME); } void send_notify(int normal, int critical) { NotifyNotification *ntfy; char buf[128]; if (critical > 0) { snprintf(buf, sizeof(buf), "There are %d software updates available, %d of them critical.", normal + critical, critical); } else { snprintf(buf, sizeof(buf), "There are %d software updates available.", normal); } ntfy = notify_notification_new(NOTIFY_NAME, buf, critical > 0 ? "software-update-urgent" : "software-update-available"); notify_notification_set_timeout(ntfy, 3000); notify_notification_set_urgency(ntfy, critical > 0 ? NOTIFY_URGENCY_CRITICAL : NOTIFY_URGENCY_NORMAL); notify_notification_show(ntfy, NULL); }