ubuntu下漂亮的冒泡提示 (2011-11-07 20:49)
来源:互联网 发布:十年期国债 知乎 编辑:程序博客网 时间:2024/05/16 05:01
UBUNTU 下漂亮的冒泡提示,可定制图标。挺好玩的,很久以前弄的一个小程序。
得先安装依赖库libnotify
/* * Copyright (C) 2011 crazyleen <357228736@qq.com>, All Rights Reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * 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. * * HOWTO: * $(CC) $(Flags) -c mynotify.c -o mynotify.o `pkg-config --cflags --libs gtk+-2.0` -l notify */#include <libnotify/notify.h>#include "mynotify.h"int notification_show(char *title, char *body, char *icon){GError *error = NULL;NotifyNotification *notify_p;if (title == NULL)return -1;//you should init notify using app's nameif(notify_is_initted() == FALSE)if(notify_init("argv[0]") == FALSE){return -1;} notify_p = notify_notification_new(title, body, icon, NULL); //miliseconds, NOTIFY_EXPIRES_DEFAULT NOTIFY_EXPIRES_NEVERnotify_notification_set_timeout(notify_p, 1000); //NOTIFY_URGENCY_LOW,NOTIFY_URGENCY_NORMAL, NOTIFY_URGENCY_CRITICAL, notify_notification_set_urgency (notify_p,NOTIFY_URGENCY_NORMAL);//notify_notification_update(title, body, icon, NULL);//notify_notification_close(notify_p, &error); if (notify_notification_show(notify_p, &error) == FALSE)return -1;//notify_uninit();return 0;}
/* mynotify.h * this function is to display a notification on the screan, * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * Copyright (C) 2011 crazyleen <357228736@qq.com>, All Rights Reserved. */#ifndef MYNOTIFY_H#define MYNOTIFY_H/* body & icoon are both optional * Returns : error: -1, success return 0 */int notification_show(char *title, char *body, char *icon);#endi
/* file.c * Copyright (C) 2011 crazyleen <357228736@qq.com>, All Rights Reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * 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. */#include <stdio.h>#include <string.h>#include <unistd.h>#include "mynotify.h"int main(char argc, char *argv[]){notification_show("cheery", "here is body...", "/usr/share/pixmaps/apple-green.png");sleep(5);notification_show("cheery", NULL, NULL);printf("UNIX\n");return 0;}
- ubuntu下漂亮的冒泡提示 (2011-11-07 20:49)
- 漂亮的提示效果
- 漂亮的信息提示
- Ubuntu 11.04下非常漂亮的GRUB引导界面
- 漂亮的提示信息栏
- 漂亮的提示框源代码
- 漂亮的jquery提示效果
- 漂亮的title提示信息
- 漂亮实用的提示框
- Ubuntu下PHP错误提示的开启
- Ubuntu下的提示信息彩色显示
- 漂亮的鼠标提示的信息
- 制作一个漂亮的提示框
- 漂亮的页面加载提示信息
- C# 漂亮的右下角提示框
- java漂亮样式的鼠标提示
- 腾讯UED 漂亮的提示信息
- 漂亮的网页消息提示框<一>
- 今天心情好差
- epoll_create epoll_ctl epoll_wait close epoll和select的简单比较
- Web开发人员常用速查手册
- 资治通鉴,卷八十二,对老庄的批驳,《崇有论》
- 学习c第一天
- ubuntu下漂亮的冒泡提示 (2011-11-07 20:49)
- 面向对象--常用关键字
- 不要迷失在技术的海洋里……
- 初涉Android蓝牙开发
- 触宝cootek杯 中科大校赛 E (ac)(原来是dpr写成啦dpl)(n^2级别的直接dp)
- java工具类简单介绍
- 渗透工具
- 百分制转换为五分制的算法
- 2011河北金融学院CSDN高校俱乐部动员大会