Mercurial > projects > pk-update-icon
view notify.c @ 12:db42ea75e9ff
add license header to main.h
author | Guido Berhoerster <guido@berhoerster.name> |
---|---|
date | Tue, 11 Oct 2011 17:07:49 +0200 |
parents | 2da5037fdfad |
children |
line wrap: on
line source
/* * Copyright (C) 2011 Pavol Rusnak <stick@gk2.sk> * Copyright (C) 2011 Guido Berhoerster <gber@opensuse.org> * * 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 "notify.h" void init_notify() { notify_init(PACKAGE); } void send_notify(struct UpdatesInfo *info) { NotifyNotification *ntfy; ntfy = notify_notification_new( _("Software Update(s)"), _(notify_text(info)), info->critical > 0 ? "software-update-urgent" : "software-update-available" #if (NOTIFY_VERSION_MAJOR == 0 && NOTIFY_VERSION_MINOR < 7) , NULL #endif ); notify_notification_set_timeout(ntfy, 3000); notify_notification_set_urgency(ntfy, info->critical > 0 ? NOTIFY_URGENCY_CRITICAL : NOTIFY_URGENCY_NORMAL); notify_notification_show(ntfy, NULL); } const char *notify_text(struct UpdatesInfo *info) { static char buf[128]; if (info->critical > 0) { snprintf(buf, sizeof(buf), _("There are %d software updates available, %d of them critical."), info->normal + info->critical, info->critical); } else { snprintf(buf, sizeof(buf), _("There are %d software updates available."), info->normal); } return buf; }