1 /* Notification plugin for Claws-Mail
2 * Copyright (C) 2005-2007 Holger Berndt
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include "notification_pixbuf.h"
20 /* The following files were created from the respective .png or
21 * xpm files with the command
22 * gdk-pixbuf-csource --raw --name=<name> file.png > <name>.h
24 /* From the Claws-Mail distribution */
25 #include "raw_claws_mail_logo_64x64.h"
27 #include "stock_pixmap.h"
29 static GdkPixbuf* notification_pixbuf[NOTIFICATION_PIXBUF_LAST];
31 GdkPixbuf* notification_pixbuf_get(NotificationPixbuf wanted)
33 if(!notification_pixbuf[wanted]) {
35 case NOTIFICATION_CM_LOGO_64x64:
36 notification_pixbuf[wanted] =
37 gdk_pixbuf_new_from_inline(-1, raw_claws_mail_logo_64x64,
40 case NOTIFICATION_TRAYICON_NEWMAIL:
41 stock_pixbuf_gdk(NULL, STOCK_PIXMAP_TRAY_NEWMAIL, &(notification_pixbuf[wanted]));
42 g_object_ref(notification_pixbuf[wanted]);
44 case NOTIFICATION_TRAYICON_NEWMAIL_OFFLINE:
45 stock_pixbuf_gdk(NULL, STOCK_PIXMAP_TRAY_NEWMAIL_OFFLINE, &(notification_pixbuf[wanted]));
46 g_object_ref(notification_pixbuf[wanted]);
48 case NOTIFICATION_TRAYICON_NEWMARKEDMAIL:
49 stock_pixbuf_gdk(NULL, STOCK_PIXMAP_TRAY_NEWMARKEDMAIL, &(notification_pixbuf[wanted]));
50 g_object_ref(notification_pixbuf[wanted]);
52 case NOTIFICATION_TRAYICON_NEWMARKEDMAIL_OFFLINE:
53 stock_pixbuf_gdk(NULL, STOCK_PIXMAP_TRAY_NEWMARKEDMAIL_OFFLINE, &(notification_pixbuf[wanted]));
54 g_object_ref(notification_pixbuf[wanted]);
56 case NOTIFICATION_TRAYICON_NOMAIL:
57 stock_pixbuf_gdk(NULL, STOCK_PIXMAP_TRAY_NOMAIL, &(notification_pixbuf[wanted]));
58 g_object_ref(notification_pixbuf[wanted]);
60 case NOTIFICATION_TRAYICON_NOMAIL_OFFLINE:
61 stock_pixbuf_gdk(NULL, STOCK_PIXMAP_TRAY_NOMAIL_OFFLINE, &(notification_pixbuf[wanted]));
62 g_object_ref(notification_pixbuf[wanted]);
64 case NOTIFICATION_TRAYICON_UNREADMAIL:
65 stock_pixbuf_gdk(NULL, STOCK_PIXMAP_TRAY_UNREADMAIL, &(notification_pixbuf[wanted]));
66 g_object_ref(notification_pixbuf[wanted]);
68 case NOTIFICATION_TRAYICON_UNREADMAIL_OFFLINE:
69 stock_pixbuf_gdk(NULL, STOCK_PIXMAP_TRAY_UNREADMAIL_OFFLINE, &(notification_pixbuf[wanted]));
70 g_object_ref(notification_pixbuf[wanted]);
72 case NOTIFICATION_TRAYICON_UNREADMARKEDMAIL:
73 stock_pixbuf_gdk(NULL, STOCK_PIXMAP_TRAY_UNREADMARKEDMAIL, &(notification_pixbuf[wanted]));
74 g_object_ref(notification_pixbuf[wanted]);
76 case NOTIFICATION_TRAYICON_UNREADMARKEDMAIL_OFFLINE:
77 stock_pixbuf_gdk(NULL, STOCK_PIXMAP_TRAY_UNREADMARKEDMAIL_OFFLINE, &(notification_pixbuf[wanted]));
78 g_object_ref(notification_pixbuf[wanted]);
80 case NOTIFICATION_PIXBUF_LAST:
84 return notification_pixbuf[wanted];
87 void notification_pixbuf_free_all(void)
91 for(ii = NOTIFICATION_CM_LOGO_64x64; ii < NOTIFICATION_PIXBUF_LAST; ii++) {
92 if(notification_pixbuf[ii]) {
93 g_object_unref(notification_pixbuf[ii]);
94 notification_pixbuf[ii] = NULL;