|
Freya
0.0.1
A Gtk3 MPD Client
|
00001 /*********************************************************** 00002 * This file is part of Freya 00003 * - A free MPD Gtk3 MPD Client - 00004 * 00005 * Authors: Christopher Pahl, Christoph Piechula, 00006 * Eduard Schneider 00007 * 00008 * Copyright (C) [2011-2012] 00009 * Hosted at: https://github.com/studentkittens/Freya 00010 * 00011 * __..--''``---....___ _..._ __ 00012 * /// //_.-' .-/"; ` ``<._ ``.''_ `. / // / 00013 * ///_.-' _..--.'_ `( ) ) // // 00014 * / (_..-' // (< _ ;_..__ ; `' / /// 00015 * / // // // `-._,_)' // / ``--...____..-' /// / // 00016 * Ascii-Art by Felix Lee <flee@cse.psu.edu> 00017 * 00018 * Freya is free software: you can redistribute it and/or modify 00019 * it under the terms of the GNU General Public License as published by 00020 * the Free Software Foundation, either version 3 of the License, or 00021 * (at your option) any later version. 00022 * 00023 * Freya is distributed in the hope that it will be useful, 00024 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00025 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00026 * GNU General Public License for more details. 00027 * 00028 * You should have received a copy of the GNU General Public License 00029 * along with Freya. If not, see <http://www.gnu.org/licenses/>. 00030 **************************************************************/ 00031 #ifndef FREYA_NOTIFY_GUARD 00032 #define FREYA_NOTIFY_GUARD 00033 00034 #include "../Utils/Singleton.hh" 00035 00036 #include <gtkmm.h> 00037 #include <libnotify/notify.h> 00038 namespace Browser 00039 { 00040 class Settings; 00041 } 00042 00043 00044 namespace Notify 00045 { 00049 class Notify 00050 { 00051 friend class Browser::Settings; 00052 00053 DEF_SINGLETON( Notify ) 00054 public: 00055 ~Notify(); 00056 00063 void send_big(Glib::ustring hl, Glib::ustring msg); 00064 00072 void send_full(Glib::ustring hl, Glib::ustring msg, GdkPixbuf * pixbuf); 00073 00081 void set_stock_icon(const char* stock); 00082 00090 void set_next_extra(); 00091 00092 private: 00093 Glib::ustring * icon; 00094 NotifyNotification *notification; 00095 bool extra,working; 00096 void re_init(); 00097 void clear_icon(); 00098 int timeout,use_notify; 00099 void _send(const char *hl, const char *msg, GdkPixbuf * pixbuf); 00100 }; 00101 } 00102 00103 #define NOTIFY_SEND(x,y) Notify::Notify::instance().send_big(x,y) //x=headline, y=message 00104 #define NOTIFY_SEND_FULL(x,y,z) Notify::Notify::instance().send_full(x,y,z) //x=headline, y= message , z = GdkPixbuf* 00105 00106 00107 /* Sets the icon for the next and ONLY the next notification. 00108 * 'x' must be a char* to one of the stock-icon names 00109 * you can find on 'http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html' 00110 * DO NOT FORGET TO ACTUALLY SHOW THE NOTIFICATION!!!!!!!!!! Otherwise the next notification will have your icon if it's not re-setted. 00111 * Nothing serious though :) 00112 */ 00113 #define NOTIFY_STOCK_ICON(x) Notify::Notify::instance().set_stock_icon(x) 00114 00115 00116 /* Next and ONLY NEXT notification will be seperate to all others and closes after notify-timeout set in config */ 00117 #define NOTIFY_EXTRA() Notify::Notify::instance().set_next_extra() 00118 00119 00120 #endif
1.8.0