b401fa7aa09508078679dbec4cf0a7c5ca957cac
[claws.git] / src / stock_pixmap.c
1 /*
2  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2016 Hiroyuki Yamamoto and the Claws Mail team
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18
19 #ifdef HAVE_CONFIG_H
20 #include "config.h"
21 #include "claws-features.h"
22 #endif
23
24 #include <glib.h>
25 #include <gtk/gtk.h>
26 #include <string.h>
27 #include <dirent.h>
28
29 #include "defs.h"
30 #include "stock_pixmap.h"
31 #include "gtkutils.h"
32 #include "utils.h"
33 #include "prefs_common.h"
34
35 #include "pixmaps/addr_one.xpm"
36 #include "pixmaps/addr_two.xpm"
37 #include "pixmaps/address.xpm"
38 #include "pixmaps/anonymous.xpm"
39 #include "pixmaps/book.xpm"
40 #include "pixmaps/category.xpm"
41 #include "pixmaps/checkbox_off.xpm"
42 #include "pixmaps/checkbox_on.xpm"
43 #include "pixmaps/clip.xpm"
44 #include "pixmaps/clipkey.xpm"
45 #include "pixmaps/complete.xpm"
46 #include "pixmaps/continue.xpm"
47 #include "pixmaps/deleted.xpm"
48 #include "pixmaps/error.xpm"
49 #include "pixmaps/edit_extern.xpm"
50 #include "pixmaps/forwarded.xpm"
51 #include "pixmaps/group.xpm"
52 #include "pixmaps/insert_file.xpm"
53 #include "pixmaps/interface.xpm"
54 #include "pixmaps/jpilot.xpm"
55 #include "pixmaps/key.xpm"
56 #include "pixmaps/key_gpg_signed.xpm"
57 #include "pixmaps/ldap.xpm"
58 #include "pixmaps/linewrap.xpm"
59 #include "pixmaps/linewrapcurrent.xpm"
60 #include "pixmaps/mark.xpm"
61 #include "pixmaps/locked.xpm"
62 #include "pixmaps/new.xpm"
63 #include "pixmaps/replied.xpm"
64 #include "pixmaps/replied_and_forwarded.xpm"
65 #include "pixmaps/close.xpm"
66 #include "pixmaps/down_arrow.xpm"
67 #include "pixmaps/up_arrow.xpm"
68 #include "pixmaps/exec.xpm"
69 #include "pixmaps/mail.xpm"
70 #include "pixmaps/mail_attach.xpm"
71 #include "pixmaps/mail_compose.xpm"
72 #include "pixmaps/mail_forward.xpm"
73 #include "pixmaps/mail_receive.xpm"
74 #include "pixmaps/mail_receive_all.xpm"
75 #include "pixmaps/mail_reply.xpm"
76 #include "pixmaps/mail_reply_to_all.xpm"
77 #include "pixmaps/mail_reply_to_author.xpm"
78 #include "pixmaps/mail_reply_to_list.xpm"
79 #include "pixmaps/mail_send.xpm"
80 #include "pixmaps/mail_send_queue.xpm"
81 #include "pixmaps/mail_sign.xpm"
82 #include "pixmaps/open_mail.xpm"
83 #include "pixmaps/news_compose.xpm"
84 #include "pixmaps/paste.xpm"
85 #include "pixmaps/preferences.xpm"
86 #include "pixmaps/properties.xpm"
87 #include "pixmaps/queue_close.xpm"
88 #include "pixmaps/queue_close_hrm.xpm"
89 #include "pixmaps/queue_open.xpm"
90 #include "pixmaps/queue_open_hrm.xpm"
91 #include "pixmaps/claws_mail_icon.xpm"
92 #include "pixmaps/claws_mail_icon_64.xpm"
93 #include "pixmaps/claws_mail_compose_logo.xpm"
94 #ifndef GENERIC_UMPC
95 #include "pixmaps/claws_mail_logo.xpm"
96 #else
97 #include "pixmaps/claws_mail_logo_small.xpm"
98 #endif
99 #include "pixmaps/address_book.xpm"
100 #include "pixmaps/unread.xpm"
101 #include "pixmaps/read.xpm"
102 #include "pixmaps/vcard.xpm"
103 #include "pixmaps/ignorethread.xpm"
104 #include "pixmaps/online.xpm"
105 #include "pixmaps/offline.xpm"
106 #include "pixmaps/notice_warn.xpm"
107 #include "pixmaps/notice_error.xpm"
108 #include "pixmaps/notice_note.xpm"
109 #include "pixmaps/quicksearch.xpm"
110 #include "pixmaps/clip_gpg_signed.xpm"
111 #include "pixmaps/gpg_signed.xpm"
112 #include "pixmaps/go_folders.xpm"
113 #include "pixmaps/mime_text_plain.xpm"
114 #include "pixmaps/mime_text_html.xpm"
115 #include "pixmaps/mime_text_patch.xpm"
116 #include "pixmaps/mime_application.xpm"
117 #include "pixmaps/mime_image.xpm"
118 #include "pixmaps/mime_audio.xpm"
119 #include "pixmaps/mime_text_enriched.xpm"
120 #include "pixmaps/mime_unknown.xpm"
121 #include "pixmaps/mime_pdf.xpm"
122 #include "pixmaps/mime_ps.xpm"
123 #include "pixmaps/mime_calendar.xpm"
124 #include "pixmaps/mime_pgpsig.xpm"
125 #include "pixmaps/printer.xpm"
126 #include "pixmaps/privacy_signed.xpm"
127 #include "pixmaps/privacy_passed.xpm"
128 #include "pixmaps/privacy_failed.xpm"
129 #include "pixmaps/privacy_unknown.xpm"
130 #include "pixmaps/privacy_expired.xpm"
131 #include "pixmaps/privacy_warn.xpm"
132 #include "pixmaps/privacy_emblem_encrypted.xpm"
133 #include "pixmaps/privacy_emblem_signed.xpm"
134 #include "pixmaps/privacy_emblem_passed.xpm"
135 #include "pixmaps/privacy_emblem_failed.xpm"
136 #include "pixmaps/privacy_emblem_warn.xpm"
137 #include "pixmaps/mime_message.xpm"
138 #include "pixmaps/address_search.xpm"
139 #include "pixmaps/check_spelling.xpm"
140 #include "pixmaps/dir_close.xpm"
141 #include "pixmaps/dir_close_hrm.xpm"
142 #include "pixmaps/dir_open.xpm"
143 #include "pixmaps/dir_open_hrm.xpm"
144 #include "pixmaps/inbox_open.xpm"
145 #include "pixmaps/inbox_open_hrm.xpm"
146 #include "pixmaps/inbox_close.xpm"
147 #include "pixmaps/inbox_close_hrm.xpm"
148 #include "pixmaps/outbox_open.xpm"
149 #include "pixmaps/outbox_open_hrm.xpm"
150 #include "pixmaps/outbox_close.xpm"
151 #include "pixmaps/outbox_close_hrm.xpm"
152 #include "pixmaps/trash_open.xpm"
153 #include "pixmaps/trash_close.xpm"
154 #include "pixmaps/delete_btn.xpm"
155 #include "pixmaps/delete_dup_btn.xpm"
156 #include "pixmaps/cancel.xpm"
157 #include "pixmaps/trash_btn.xpm"
158 #include "pixmaps/trash_open_hrm.xpm"
159 #include "pixmaps/trash_close_hrm.xpm"
160 #include "pixmaps/drafts_close.xpm"
161 #include "pixmaps/drafts_open.xpm"
162 #include "pixmaps/dir_close_mark.xpm"
163 #include "pixmaps/dir_close_hrm_mark.xpm"
164 #include "pixmaps/dir_open_mark.xpm"
165 #include "pixmaps/dir_open_hrm_mark.xpm"
166 #include "pixmaps/inbox_open_mark.xpm"
167 #include "pixmaps/inbox_open_hrm_mark.xpm"
168 #include "pixmaps/inbox_close_mark.xpm"
169 #include "pixmaps/inbox_close_hrm_mark.xpm"
170 #include "pixmaps/outbox_open_mark.xpm"
171 #include "pixmaps/outbox_open_hrm_mark.xpm"
172 #include "pixmaps/outbox_close_mark.xpm"
173 #include "pixmaps/outbox_close_hrm_mark.xpm"
174 #include "pixmaps/trash_open_mark.xpm"
175 #include "pixmaps/trash_close_mark.xpm"
176 #include "pixmaps/queue_close_mark.xpm"
177 #include "pixmaps/queue_close_hrm_mark.xpm"
178 #include "pixmaps/queue_open_mark.xpm"
179 #include "pixmaps/queue_open_hrm_mark.xpm"
180 #include "pixmaps/trash_open_hrm_mark.xpm"
181 #include "pixmaps/trash_close_hrm_mark.xpm"
182 #include "pixmaps/drafts_close_mark.xpm"
183 #include "pixmaps/drafts_open_mark.xpm"
184 #include "pixmaps/dir_noselect_close.xpm"
185 #include "pixmaps/dir_noselect_close_mark.xpm"
186 #include "pixmaps/dir_noselect_open.xpm"
187 #include "pixmaps/dir_subs_close_mark.xpm"
188 #include "pixmaps/dir_subs_close.xpm"
189 #include "pixmaps/dir_subs_open.xpm"
190 #include "pixmaps/spam.xpm"
191 #include "pixmaps/spam_btn.xpm"
192 #include "pixmaps/ham_btn.xpm"
193 #include "pixmaps/moved.xpm"
194 #include "pixmaps/copied.xpm"
195 #include "pixmaps/selection.xpm"
196 #include "pixmaps/watchthread.xpm"
197 #include "pixmaps/empty.xpm"
198 #include "pixmaps/tray_newmail_offline.xpm"
199 #include "pixmaps/tray_newmail.xpm"
200 #include "pixmaps/tray_newmarkedmail_offline.xpm"
201 #include "pixmaps/tray_newmarkedmail.xpm"
202 #include "pixmaps/tray_nomail_offline.xpm"
203 #include "pixmaps/tray_nomail.xpm"
204 #include "pixmaps/tray_unreadmail_offline.xpm"
205 #include "pixmaps/tray_unreadmail.xpm"
206 #include "pixmaps/tray_unreadmarkedmail_offline.xpm"
207 #include "pixmaps/tray_unreadmarkedmail.xpm"
208 #include "pixmaps/doc_index.xpm"
209 #include "pixmaps/doc_index_close.xpm"
210 #include "pixmaps/doc_info.xpm"
211 #include "pixmaps/first_arrow.xpm"
212 #include "pixmaps/last_arrow.xpm"
213 #include "pixmaps/left_arrow.xpm"
214 #include "pixmaps/right_arrow.xpm"
215 #include "pixmaps/rotate_left.xpm"
216 #include "pixmaps/rotate_right.xpm"
217 #include "pixmaps/zoom_fit.xpm"
218 #include "pixmaps/zoom_in.xpm"
219 #include "pixmaps/zoom_out.xpm"
220 #include "pixmaps/zoom_width.xpm"
221 #include "pixmaps/mark_ignorethread.xpm"
222 #include "pixmaps/mark_watchthread.xpm"
223 #include "pixmaps/mark_mark.xpm"
224 #include "pixmaps/mark_unmark.xpm"
225 #include "pixmaps/mark_locked.xpm"
226 #include "pixmaps/mark_unlocked.xpm"
227 #include "pixmaps/mark_allread.xpm"
228 #include "pixmaps/mark_allunread.xpm"
229 #include "pixmaps/mark_read.xpm"
230 #include "pixmaps/mark_unread.xpm"
231
232 typedef struct _StockPixmapData StockPixmapData;
233
234 struct _StockPixmapData
235 {
236         gchar **data;
237         cairo_surface_t *pixmap;
238         cairo_pattern_t *mask;
239         gchar *file;
240         gchar *icon_path;
241         GdkPixbuf *pixbuf;
242 };
243
244 typedef struct _OverlayData OverlayData;
245
246 struct _OverlayData
247 {
248         gboolean is_pixmap;
249         cairo_surface_t *base_pixmap;
250         cairo_surface_t *overlay_pixmap;
251
252         GdkPixbuf *base_pixbuf;
253         GdkPixbuf *overlay_pixbuf;
254
255         guint base_height;
256         guint base_width;
257         guint overlay_height;
258         guint overlay_width;
259         OverlayPosition position;
260         gint border_x;
261         gint border_y;
262         gboolean highlight;
263 };
264
265 static void stock_pixmap_find_themes_in_dir(GList **list, const gchar *dirname);
266
267 static StockPixmapData pixmaps[] =
268 {
269     {addr_one_xpm                     , NULL, NULL, "addr_one", NULL, NULL},
270     {addr_two_xpm                     , NULL, NULL, "addr_two", NULL, NULL},
271     {address_xpm                      , NULL, NULL, "address", NULL, NULL},
272     {address_book_xpm                 , NULL, NULL, "address_book", NULL, NULL},
273     {address_search_xpm               , NULL, NULL, "address_search", NULL, NULL},
274     {anonymous_xpm                    , NULL, NULL, "anonymous", NULL, NULL},
275     {book_xpm                         , NULL, NULL, "book", NULL, NULL},
276     {category_xpm                     , NULL, NULL, "category", NULL, NULL},
277     {checkbox_off_xpm                 , NULL, NULL, "checkbox_off", NULL, NULL},
278     {checkbox_on_xpm                  , NULL, NULL, "checkbox_on", NULL, NULL},
279     {check_spelling_xpm               , NULL, NULL, "check_spelling", NULL, NULL},
280     {clip_xpm                         , NULL, NULL, "clip", NULL, NULL},
281     {clipkey_xpm                      , NULL, NULL, "clipkey", NULL, NULL},
282     {clip_gpg_signed_xpm              , NULL, NULL, "clip_gpg_signed", NULL, NULL},
283     {close_xpm                        , NULL, NULL, "close", NULL, NULL},
284     {complete_xpm                     , NULL, NULL, "complete", NULL, NULL},
285     {continue_xpm                     , NULL, NULL, "continue", NULL, NULL},
286     {deleted_xpm                      , NULL, NULL, "deleted", NULL, NULL},
287     {dir_close_xpm                    , NULL, NULL, "dir_close", NULL, NULL},
288     {dir_close_hrm_xpm                , NULL, NULL, "dir_close_hrm", NULL, NULL},
289     {dir_open_xpm                     , NULL, NULL, "dir_open", NULL, NULL},
290     {dir_open_hrm_xpm                 , NULL, NULL, "dir_open_hrm", NULL, NULL},
291     {dir_close_mark_xpm               , NULL, NULL, "dir_close_mark", NULL, NULL},
292     {dir_close_hrm_mark_xpm           , NULL, NULL, "dir_close_hrm_mark", NULL, NULL},
293     {dir_open_mark_xpm                , NULL, NULL, "dir_open_mark", NULL, NULL},
294     {dir_open_hrm_mark_xpm            , NULL, NULL, "dir_open_hrm_mark", NULL, NULL},
295     {down_arrow_xpm                   , NULL, NULL, "down_arrow", NULL, NULL},
296     {up_arrow_xpm                     , NULL, NULL, "up_arrow", NULL, NULL},
297     {edit_extern_xpm                  , NULL, NULL, "edit_extern", NULL, NULL},
298     {error_xpm                        , NULL, NULL, "error", NULL, NULL},
299     {exec_xpm                         , NULL, NULL, "exec", NULL, NULL},
300     {forwarded_xpm                    , NULL, NULL, "forwarded", NULL, NULL},
301     {group_xpm                        , NULL, NULL, "group", NULL, NULL},
302     {ignorethread_xpm                 , NULL, NULL, "ignorethread", NULL, NULL},
303     {inbox_close_xpm                  , NULL, NULL, "inbox_close", NULL, NULL},
304     {inbox_close_hrm_xpm              , NULL, NULL, "inbox_close_hrm", NULL, NULL},
305     {inbox_open_xpm                   , NULL, NULL, "inbox_open", NULL, NULL},
306     {inbox_open_hrm_xpm               , NULL, NULL, "inbox_open_hrm", NULL, NULL},
307     {inbox_close_mark_xpm             , NULL, NULL, "inbox_close_mark", NULL, NULL},
308     {inbox_close_hrm_mark_xpm         , NULL, NULL, "inbox_close_hrm_mark", NULL, NULL},
309     {inbox_open_mark_xpm              , NULL, NULL, "inbox_open_mark", NULL, NULL},
310     {inbox_open_hrm_mark_xpm          , NULL, NULL, "inbox_open_hrm_mark", NULL, NULL},
311     {insert_file_xpm                  , NULL, NULL, "insert_file", NULL, NULL},
312     {interface_xpm                    , NULL, NULL, "interface", NULL, NULL},
313     {jpilot_xpm                       , NULL, NULL, "jpilot", NULL, NULL},
314     {key_xpm                          , NULL, NULL, "key", NULL, NULL},
315     {key_gpg_signed_xpm               , NULL, NULL, "key_gpg_signed", NULL, NULL},
316     {ldap_xpm                         , NULL, NULL, "ldap", NULL, NULL},
317     {linewrapcurrent_xpm              , NULL, NULL, "linewrapcurrent", NULL, NULL},
318     {linewrap_xpm                     , NULL, NULL, "linewrap", NULL, NULL},
319     {locked_xpm                       , NULL, NULL, "locked", NULL, NULL},
320     {mail_xpm                         , NULL, NULL, "mail", NULL, NULL},
321     {mail_attach_xpm                  , NULL, NULL, "mail_attach", NULL, NULL},
322     {mail_compose_xpm                 , NULL, NULL, "mail_compose", NULL, NULL},
323     {mail_forward_xpm                 , NULL, NULL, "mail_forward", NULL, NULL},
324     {mail_receive_xpm                 , NULL, NULL, "mail_receive", NULL, NULL},
325     {mail_receive_all_xpm             , NULL, NULL, "mail_receive_all", NULL, NULL},
326     {mail_reply_xpm                   , NULL, NULL, "mail_reply", NULL, NULL},
327     {mail_reply_to_all_xpm            , NULL, NULL, "mail_reply_to_all", NULL, NULL},
328     {mail_reply_to_author_xpm         , NULL, NULL, "mail_reply_to_author", NULL, NULL},
329     {mail_reply_to_list_xpm           , NULL, NULL, "mail_reply_to_list", NULL, NULL},
330     {mail_send_xpm                    , NULL, NULL, "mail_send", NULL, NULL},
331     {mail_send_queue_xpm              , NULL, NULL, "mail_send_queue", NULL, NULL},
332     {mail_sign_xpm                    , NULL, NULL, "mail_sign", NULL, NULL},
333     {open_mail_xpm                    , NULL, NULL, "open_mail", NULL, NULL},
334     {mark_xpm                         , NULL, NULL, "mark", NULL, NULL},
335     {new_xpm                          , NULL, NULL, "new", NULL, NULL},
336     {news_compose_xpm                 , NULL, NULL, "news_compose", NULL, NULL},
337     {outbox_close_xpm                 , NULL, NULL, "outbox_close", NULL, NULL},
338     {outbox_close_hrm_xpm             , NULL, NULL, "outbox_close_hrm", NULL, NULL},
339     {outbox_open_xpm                  , NULL, NULL, "outbox_open", NULL, NULL},
340     {outbox_open_hrm_xpm              , NULL, NULL, "outbox_open_hrm", NULL, NULL},
341     {outbox_close_mark_xpm            , NULL, NULL, "outbox_close_mark", NULL, NULL},
342     {outbox_close_hrm_mark_xpm        , NULL, NULL, "outbox_close_hrm_mark", NULL, NULL},
343     {outbox_open_mark_xpm             , NULL, NULL, "outbox_open_mark", NULL, NULL},
344     {outbox_open_hrm_mark_xpm         , NULL, NULL, "outbox_open_hrm_mark", NULL, NULL},
345     {replied_xpm                      , NULL, NULL, "replied", NULL, NULL},
346     {replied_and_forwarded_xpm        , NULL, NULL, "replied_and_forwarded", NULL, NULL},
347     {paste_xpm                        , NULL, NULL, "paste", NULL, NULL},
348     {preferences_xpm                  , NULL, NULL, "preferences", NULL, NULL},
349     {properties_xpm                   , NULL, NULL, "properties", NULL, NULL},
350     {queue_close_xpm                  , NULL, NULL, "queue_close", NULL, NULL},
351     {queue_close_hrm_xpm              , NULL, NULL, "queue_close_hrm", NULL, NULL},
352     {queue_open_xpm                   , NULL, NULL, "queue_open", NULL, NULL},
353     {queue_open_hrm_xpm               , NULL, NULL, "queue_open_hrm", NULL, NULL},
354     {trash_open_xpm                   , NULL, NULL, "trash_open", NULL, NULL},
355     {trash_open_hrm_xpm               , NULL, NULL, "trash_open_hrm", NULL, NULL},
356     {trash_close_xpm                  , NULL, NULL, "trash_close", NULL, NULL},
357     {trash_close_hrm_xpm              , NULL, NULL, "trash_close_hrm", NULL, NULL},
358     {queue_close_mark_xpm             , NULL, NULL, "queue_close_mark", NULL, NULL},
359     {queue_close_hrm_mark_xpm         , NULL, NULL, "queue_close_hrm_mark", NULL, NULL},
360     {queue_open_mark_xpm              , NULL, NULL, "queue_open_mark", NULL, NULL},
361     {queue_open_hrm_mark_xpm          , NULL, NULL, "queue_open_hrm_mark", NULL, NULL},
362     {trash_open_mark_xpm              , NULL, NULL, "trash_open_mark", NULL, NULL},
363     {trash_open_hrm_mark_xpm          , NULL, NULL, "trash_open_hrm_mark", NULL, NULL},
364     {trash_close_mark_xpm             , NULL, NULL, "trash_close_mark", NULL, NULL},
365     {trash_close_hrm_mark_xpm         , NULL, NULL, "trash_close_hrm_mark", NULL, NULL},
366     {unread_xpm                       , NULL, NULL, "unread", NULL, NULL},
367     {vcard_xpm                        , NULL, NULL, "vcard", NULL, NULL},
368     {online_xpm                       , NULL, NULL, "online", NULL, NULL},
369     {offline_xpm                      , NULL, NULL, "offline", NULL, NULL},
370     {notice_warn_xpm                  , NULL, NULL, "notice_warn",  NULL, NULL},
371     {notice_error_xpm                 , NULL, NULL, "notice_error",  NULL, NULL},
372     {notice_note_xpm                  , NULL, NULL, "notice_note",  NULL, NULL},
373     {quicksearch_xpm                  , NULL, NULL, "quicksearch",  NULL, NULL},
374     {gpg_signed_xpm                   , NULL, NULL, "gpg_signed", NULL, NULL},
375     {go_folders_xpm                   , NULL, NULL, "go_folders", NULL, NULL},
376     {drafts_close_xpm                 , NULL, NULL, "drafts_close", NULL, NULL},
377     {drafts_open_xpm                  , NULL, NULL, "drafts_open", NULL, NULL},
378     {drafts_close_mark_xpm            , NULL, NULL, "drafts_close_mark", NULL, NULL},
379     {drafts_open_mark_xpm             , NULL, NULL, "drafts_open_mark", NULL, NULL},
380     {mime_text_plain_xpm              , NULL, NULL, "mime_text_plain", NULL, NULL},
381     {mime_text_html_xpm               , NULL, NULL, "mime_text_html", NULL, NULL},
382     {mime_text_patch_xpm              , NULL, NULL, "mime_text_patch", NULL, NULL},
383     {mime_application_xpm             , NULL, NULL, "mime_application", NULL, NULL},
384     {mime_image_xpm                   , NULL, NULL, "mime_image", NULL, NULL},
385     {mime_audio_xpm                   , NULL, NULL, "mime_audio", NULL, NULL},
386     {mime_text_enriched_xpm           , NULL, NULL, "mime_text_enriched", NULL, NULL},
387     {mime_unknown_xpm                 , NULL, NULL, "mime_unknown", NULL, NULL},
388     {mime_pdf_xpm                     , NULL, NULL, "mime_pdf", NULL, NULL},
389     {mime_ps_xpm                      , NULL, NULL, "mime_ps", NULL, NULL},
390     {mime_calendar_xpm                , NULL, NULL, "mime_calendar", NULL, NULL},
391     {mime_pgpsig_xpm                  , NULL, NULL, "mime_pgpsig", NULL, NULL},
392     {printer_xpm                      , NULL, NULL, "printer", NULL, NULL},
393     {privacy_signed_xpm               , NULL, NULL, "privacy_signed", NULL, NULL},
394     {privacy_passed_xpm               , NULL, NULL, "privacy_passed", NULL, NULL},
395     {privacy_failed_xpm               , NULL, NULL, "privacy_failed", NULL, NULL},
396     {privacy_unknown_xpm              , NULL, NULL, "privacy_unknown", NULL, NULL},
397     {privacy_expired_xpm              , NULL, NULL, "privacy_expired", NULL, NULL},
398     {privacy_warn_xpm                 , NULL, NULL, "privacy_warn", NULL, NULL},
399     {privacy_emblem_encrypted_xpm     , NULL, NULL, "privacy_emblem_encrypted", NULL, NULL},
400     {privacy_emblem_signed_xpm        , NULL, NULL, "privacy_emblem_signed", NULL, NULL},
401     {privacy_emblem_passed_xpm        , NULL, NULL, "privacy_emblem_passed", NULL, NULL},
402     {privacy_emblem_failed_xpm        , NULL, NULL, "privacy_emblem_failed", NULL, NULL},
403     {privacy_emblem_warn_xpm          , NULL, NULL, "privacy_emblem_warn", NULL, NULL},
404     {mime_message_xpm                 , NULL, NULL, "mime_message", NULL, NULL},
405     {claws_mail_icon_xpm              , NULL, NULL, "claws_mail_icon", NULL, NULL},
406     {claws_mail_icon_64_xpm           , NULL, NULL, "claws_mail_icon_64", NULL, NULL},
407     {read_xpm                         , NULL, NULL, "read", NULL, NULL},
408     {delete_btn_xpm                   , NULL, NULL, "delete_btn", NULL, NULL},
409     {delete_dup_btn_xpm               , NULL, NULL, "delete_dup_btn", NULL, NULL},
410     {cancel_xpm                       , NULL, NULL, "cancel", NULL, NULL},
411     {trash_btn_xpm                    , NULL, NULL, "trash_btn", NULL, NULL},
412     {claws_mail_compose_logo_xpm      , NULL, NULL, "claws_mail_compose_logo", NULL, NULL},
413 #ifndef GENERIC_UMPC
414     {claws_mail_logo_xpm              , NULL, NULL, "claws_mail_logo", NULL, NULL},
415 #else
416     {claws_mail_logo_small_xpm        , NULL, NULL, "claws_mail_logo_small", NULL, NULL},
417 #endif
418     {dir_noselect_close_xpm           , NULL, NULL, "dir_noselect_close", NULL, NULL},
419     {dir_noselect_close_mark_xpm      , NULL, NULL, "dir_noselect_close_mark", NULL, NULL},
420     {dir_noselect_open_xpm            , NULL, NULL, "dir_noselect_open", NULL, NULL},
421     {dir_subs_close_mark_xpm          , NULL, NULL, "dir_subs_close_mark", NULL, NULL},
422     {dir_subs_close_xpm               , NULL, NULL, "dir_subs_close", NULL, NULL},
423     {dir_subs_open_xpm                , NULL, NULL, "dir_subs_open", NULL, NULL},
424     {spam_xpm                         , NULL, NULL, "spam", NULL, NULL},
425     {spam_btn_xpm                     , NULL, NULL, "spam_btn", NULL, NULL},
426     {ham_btn_xpm                      , NULL, NULL, "ham_btn", NULL, NULL},
427     {moved_xpm                        , NULL, NULL, "moved", NULL, NULL},
428     {copied_xpm                       , NULL, NULL, "copied", NULL, NULL},
429     {selection_xpm                    , NULL, NULL, "selection", NULL, NULL},
430     {watchthread_xpm                  , NULL, NULL, "watchthread", NULL, NULL},
431     {tray_newmail_offline_xpm         , NULL, NULL, "tray_newmail_offline", NULL, NULL},
432     {tray_newmail_xpm                 , NULL, NULL, "tray_newmail", NULL, NULL},
433     {tray_newmarkedmail_offline_xpm   , NULL, NULL, "tray_newmarkedmail_offline", NULL, NULL},
434     {tray_newmarkedmail_xpm           , NULL, NULL, "tray_newmarkedmail", NULL, NULL},
435     {tray_nomail_offline_xpm          , NULL, NULL, "tray_nomail_offline", NULL, NULL},
436     {tray_nomail_xpm                  , NULL, NULL, "tray_nomail", NULL, NULL},
437     {tray_unreadmail_offline_xpm      , NULL, NULL, "tray_unreadmail_offline", NULL, NULL},
438     {tray_unreadmail_xpm              , NULL, NULL, "tray_unreadmail", NULL, NULL},
439     {tray_unreadmarkedmail_offline_xpm, NULL, NULL, "tray_unreadmarkedmail_offline", NULL, NULL},
440     {tray_unreadmarkedmail_xpm        , NULL, NULL, "tray_unreadmarkedmail", NULL, NULL},
441     {doc_index_xpm                    , NULL, NULL, "doc_index", NULL, NULL},
442     {doc_index_close_xpm              , NULL, NULL, "doc_index_close", NULL, NULL},
443     {doc_info_xpm                     , NULL, NULL, "doc_info", NULL, NULL},
444     {first_arrow_xpm                  , NULL, NULL, "first_arrow", NULL, NULL},
445     {last_arrow_xpm                   , NULL, NULL, "last_arrow", NULL, NULL},
446     {left_arrow_xpm                   , NULL, NULL, "left_arrow", NULL, NULL},
447     {right_arrow_xpm                  , NULL, NULL, "right_arrow", NULL, NULL},
448     {rotate_left_xpm                  , NULL, NULL, "rotate_left", NULL, NULL},
449     {rotate_right_xpm                 , NULL, NULL, "rotate_right", NULL, NULL},
450     {zoom_fit_xpm                     , NULL, NULL, "zoom_fit", NULL, NULL},
451     {zoom_in_xpm                      , NULL, NULL, "zoom_in", NULL, NULL},
452     {zoom_out_xpm                     , NULL, NULL, "zoom_out", NULL, NULL},
453     {zoom_width_xpm                   , NULL, NULL, "zoom_width", NULL, NULL},
454     {mark_ignorethread_xpm            , NULL, NULL, "mark_ignorethread", NULL, NULL},
455     {mark_watchthread_xpm             , NULL, NULL, "mark_watchthread", NULL, NULL},
456     {mark_mark_xpm                    , NULL, NULL, "mark_mark", NULL, NULL},
457     {mark_unmark_xpm                  , NULL, NULL, "mark_unmark", NULL, NULL},
458     {mark_locked_xpm                  , NULL, NULL, "mark_locked", NULL, NULL},
459     {mark_unlocked_xpm                , NULL, NULL, "mark_unlocked", NULL, NULL},
460     {mark_allread_xpm                 , NULL, NULL, "mark_allread", NULL, NULL},
461     {mark_allunread_xpm               , NULL, NULL, "mark_allunread", NULL, NULL},
462     {mark_read_xpm                    , NULL, NULL, "mark_read", NULL, NULL},
463     {mark_unread_xpm                  , NULL, NULL, "mark_unread", NULL, NULL},
464     {empty_xpm                        , NULL, NULL, "empty", NULL, NULL}
465 };
466
467 /* Supported theme extensions */
468 static const char *extension[] = {
469         ".png",
470         ".xpm",
471         NULL
472 };
473
474 /* return current supported extensions */
475 const char **stock_pixmap_theme_extensions(void)
476 {
477         return extension;
478 }
479
480 /* return newly constructed GtkPixmap from GdkPixmap */
481 GtkWidget *stock_pixmap_widget(StockPixmap icon)
482 {
483         GdkPixbuf *pixbuf;
484
485         cm_return_val_if_fail(icon < N_STOCK_PIXMAPS, NULL);
486
487         if (stock_pixbuf_gdk(icon, &pixbuf) != -1)
488                 return gtk_image_new_from_pixbuf(pixbuf);
489
490         return NULL;
491 }
492
493 /*!
494  *\brief
495  */
496 gint stock_pixbuf_gdk(StockPixmap icon, GdkPixbuf **pixbuf)
497 {
498         StockPixmapData *pix_d;
499         int i = 0;
500         gboolean theme_changed = FALSE;
501
502         if (pixbuf)
503                 *pixbuf = NULL;
504
505         cm_return_val_if_fail(icon < N_STOCK_PIXMAPS, -1);
506
507         pix_d = &pixmaps[icon];
508
509         theme_changed = (strcmp2(pix_d->icon_path, prefs_common.pixmap_theme_path) != 0);
510         if (!pix_d->pixbuf || theme_changed) {
511                 GdkPixbuf *pix = NULL;
512
513                 if (theme_changed && pix_d->pixmap) {
514                         g_object_unref(pix_d->pixmap);
515                         pix_d->pixmap = NULL;
516                 }
517
518                 if (strcmp(prefs_common.pixmap_theme_path, DEFAULT_PIXMAP_THEME) != 0) {
519                         if (is_dir_exist(prefs_common.pixmap_theme_path)) {
520                                 char *icon_file_name;
521 try_next_extension:
522                                 icon_file_name = g_strconcat(prefs_common.pixmap_theme_path,
523                                                              G_DIR_SEPARATOR_S,
524                                                              pix_d->file,
525                                                              extension[i],
526                                                              NULL);
527                                 if (is_file_exist(icon_file_name)) {
528                                         GError *err = NULL;
529                                         pix = gdk_pixbuf_new_from_file(icon_file_name, &err);
530                                         if (err) g_error_free(err);
531                                 }
532                                 if (pix) {
533                                         g_free(pix_d->icon_path);
534                                         pix_d->icon_path = g_strdup(prefs_common.pixmap_theme_path);
535                                 }
536                                 g_free(icon_file_name);
537                                 if (!pix) {
538                                         i++;
539                                         if (extension[i])
540                                                 goto try_next_extension;
541                                 }
542                         } else {
543                                 /* even the path does not exist (deleted between two sessions), so
544                                 set the preferences to the internal theme */
545                                 prefs_common.pixmap_theme_path = g_strdup(DEFAULT_PIXMAP_THEME);
546                         }
547                 }
548                 pix_d->pixbuf = pix;
549         }
550
551         if (!pix_d->pixbuf) {
552                 pix_d->pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **) pix_d->data);
553                 if (pix_d->pixbuf) {
554                         g_free(pix_d->icon_path);
555                         pix_d->icon_path = g_strdup(DEFAULT_PIXMAP_THEME);
556                 }
557         }
558
559         cm_return_val_if_fail(pix_d->pixbuf != NULL, -1);
560
561         if (pixbuf)
562                 *pixbuf = pix_d->pixbuf;
563
564         /* pixbuf should have one ref outstanding */
565
566         return 0;
567 }
568
569 static void stock_pixmap_find_themes_in_dir(GList **list, const gchar *dirname)
570 {
571         const gchar *entry;
572         gchar *fullentry;
573         GDir *dp;
574         GError *error = NULL;
575
576         if ((dp = g_dir_open(dirname, 0, &error)) == NULL) {
577                 debug_print("skipping theme scan, dir %s could not be opened: %s (%d)\n",
578                                 dirname ? dirname : "(null)", error->message, error->code);
579                 g_error_free(error);
580                 return;
581         }
582
583         while ((entry = g_dir_read_name(dp)) != NULL) {
584                 fullentry = g_strconcat(dirname, G_DIR_SEPARATOR_S, entry, NULL);
585
586                 if (strcmp(entry, ".") != 0 && strcmp(entry, "..") != 0 && is_dir_exist(fullentry)) {
587                         gchar *filetoexist;
588                         gboolean found = FALSE;
589                         int i;
590                         int j;
591                         for (i = 0; i < N_STOCK_PIXMAPS && !found; i++) {
592                                 for (j = 0; extension[j] && !found; j++) {
593                                         filetoexist = g_strconcat(fullentry, G_DIR_SEPARATOR_S, pixmaps[i].file, extension[j], NULL);
594                                         if (is_file_exist(filetoexist)) {
595                                                 *list = g_list_append(*list, fullentry);
596                                                 found = TRUE;
597                                         }
598                                         g_free(filetoexist);
599                                 }
600                         }
601                         if (i == N_STOCK_PIXMAPS)
602                                 g_free(fullentry);
603                 } else
604                         g_free(fullentry);
605         }
606         g_dir_close(dp);
607 }
608
609 gchar *stock_pixmap_get_system_theme_dir_for_theme(const gchar *theme)
610 {
611         const gchar *sep = NULL;
612         if (theme && *theme)
613                 sep = G_DIR_SEPARATOR_S;
614 #ifndef G_OS_WIN32
615         return g_strconcat(PACKAGE_DATA_DIR, G_DIR_SEPARATOR_S,
616                            PIXMAP_THEME_DIR, sep, theme, NULL);
617 #else
618         return g_strconcat(w32_get_themes_dir(), sep, theme, NULL);
619 #endif
620 }
621
622 GList *stock_pixmap_themes_list_new(void)
623 {
624         gchar *defaulttheme;
625         gchar *userthemes;
626         gchar *systemthemes;
627         GList *list = NULL;
628
629         defaulttheme = g_strdup(DEFAULT_PIXMAP_THEME);
630         userthemes   = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
631                                    PIXMAP_THEME_DIR, NULL);
632         systemthemes = stock_pixmap_get_system_theme_dir_for_theme(NULL);
633
634         list = g_list_append(list, defaulttheme);
635         stock_pixmap_find_themes_in_dir(&list, userthemes);
636         stock_pixmap_find_themes_in_dir(&list, systemthemes);
637
638         g_free(userthemes);
639         g_free(systemthemes);
640         return list;
641 }
642
643 void stock_pixmap_themes_list_free(GList *list)
644 {
645         GList *ptr;
646
647         for (ptr = g_list_first(list); ptr != NULL; ptr = g_list_next(ptr))
648                 g_free(ptr->data);
649         g_list_free(list);
650 }
651
652 gchar *stock_pixmap_get_name (StockPixmap icon)
653 {
654         if (icon >= N_STOCK_PIXMAPS)
655                 return NULL;
656
657         return pixmaps[icon].file;
658
659 }
660
661 StockPixmap stock_pixmap_get_icon (gchar *file)
662 {
663         gint i;
664
665         for (i = 0; i < N_STOCK_PIXMAPS; i++) {
666                 if (strcmp (pixmaps[i].file, file) == 0)
667                         return i;
668         }
669         return -1;
670 }
671
672 static gboolean do_pix_draw(GtkWidget *widget, cairo_t *cr,
673                             OverlayData *data)
674 {
675         GdkWindow *drawable = gtk_widget_get_window(widget);
676         gint left = 0;
677         gint top = 0;
678
679         if (data->is_pixmap) {
680                 cm_return_val_if_fail(data->base_pixmap != NULL, FALSE);
681         } else {
682                 cm_return_val_if_fail(data->base_pixbuf != NULL, FALSE);
683         }
684
685         if (data->highlight) {
686                 MainWindow *mw = NULL;
687
688                 mw = mainwindow_get_mainwindow();
689                 if (mw != NULL && mw->menubar != NULL) {
690                         cairo_t *cr;
691                         GdkColor color = gtk_widget_get_style(mw->menubar)->base[GTK_STATE_SELECTED];
692
693                         cr = gdk_cairo_create(drawable);
694                         gdk_cairo_set_source_color(cr, &color);
695                         cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
696                         cairo_set_line_width(cr, 1.);
697                         cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT);
698                         cairo_set_line_join(cr, CAIRO_LINE_JOIN_BEVEL);
699                         cairo_rectangle(cr, data->border_x-2, data->border_y-2,
700                             data->base_width+3, data->base_height+3);
701                         cairo_stroke(cr);
702                         cairo_destroy(cr);
703                 }
704         }
705
706         if (data->is_pixmap) {
707                 cairo_set_source_surface(cr, data->base_pixmap, data->border_x, data->border_y);
708                 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT);
709                 cairo_rectangle(cr, data->border_x, data->border_y, data->base_width, data->base_height);
710                 cairo_fill(cr);
711         } else {
712                 gdk_cairo_set_source_pixbuf(cr, data->base_pixbuf, data->border_x, data->border_y);
713                 cairo_paint(cr);
714         }
715
716         if (data->position != OVERLAY_NONE) {
717
718                 switch (data->position) {
719                         case OVERLAY_TOP_LEFT:
720                         case OVERLAY_MID_LEFT:
721                         case OVERLAY_BOTTOM_LEFT:
722                                 left = 0;
723                                 break;
724
725                         case OVERLAY_TOP_CENTER:
726                         case OVERLAY_MID_CENTER:
727                         case OVERLAY_BOTTOM_CENTER:
728                                 left = (data->base_width + data->border_x * 2 - data->overlay_width)/2;
729                                 break;
730
731                         case OVERLAY_TOP_RIGHT:
732                         case OVERLAY_MID_RIGHT:
733                         case OVERLAY_BOTTOM_RIGHT:
734                                 left = data->base_width + data->border_x * 2 - data->overlay_width;
735                                 break;
736
737                         default:
738                                 break;
739                 }
740                 switch (data->position) {
741                         case OVERLAY_TOP_LEFT:
742                         case OVERLAY_TOP_CENTER:
743                         case OVERLAY_TOP_RIGHT:
744                                 top = 0;
745                                 break;
746
747                         case OVERLAY_MID_LEFT:
748                         case OVERLAY_MID_CENTER:
749                         case OVERLAY_MID_RIGHT:
750                                 top = (data->base_height + data->border_y * 2 - data->overlay_height)/2;
751                                 break;
752
753                         case OVERLAY_BOTTOM_LEFT:
754                         case OVERLAY_BOTTOM_CENTER:
755                         case OVERLAY_BOTTOM_RIGHT:
756                                 top = data->base_height + data->border_y * 2 - data->overlay_height;
757                                 break;
758
759                         default:
760                                 break;
761                 }
762         }
763
764         if (data->position != OVERLAY_NONE) {
765                 if (data->is_pixmap) {
766                         cm_return_val_if_fail(data->overlay_pixmap != NULL, FALSE);
767                         cairo_set_source_surface(cr, data->overlay_pixmap, left, top);
768                         cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
769                         cairo_rectangle (cr, left, top, data->overlay_width, data->overlay_height);
770                         cairo_fill(cr);
771                 } else {
772       cm_return_val_if_fail(data->overlay_pixbuf != NULL, FALSE);
773       gdk_cairo_set_source_pixbuf(cr, data->overlay_pixbuf, left, top);
774       cairo_paint(cr);
775                 }
776         }
777
778         return TRUE;
779 }
780
781 #if !GTK_CHECK_VERSION(3,0,0)
782 static gboolean pixmap_with_overlay_expose_event_cb(GtkWidget *widget, GdkEventExpose *expose,
783                                                    OverlayData *data)
784 #else
785 static gboolean pixmap_with_overlay_expose_event_cb(GtkWidget *widget, cairo_t *cr,
786                                                     OverlayData *data)
787 #endif
788 {
789 #if !GTK_CHECK_VERSION(3,0,0)
790         cairo_t *cr;
791         GdkWindow *drawable = gtk_widget_get_window(widget);
792         gboolean result;
793
794         cr = gdk_cairo_create(drawable);
795         gdk_window_clear_area (drawable, expose->area.x, expose->area.y,
796                                expose->area.width, expose->area.height);
797
798         result = do_pix_draw(widget, cr, data);
799         cairo_destroy(cr);
800         return result;
801 #else
802         return do_pix_draw(widget, cr, data);
803 #endif
804 }
805
806 static void pixmap_with_overlay_destroy_cb(GtkWidget *object, OverlayData *data)
807 {
808         if (data->is_pixmap) {
809                 cairo_surface_destroy(data->base_pixmap);
810                 if (data->position != OVERLAY_NONE) {
811                         cairo_surface_destroy(data->overlay_pixmap);
812                 }
813         } else {
814                 g_object_unref(data->base_pixbuf);
815                 if (data->position != OVERLAY_NONE) {
816                         g_object_unref(data->overlay_pixbuf);
817                 }
818         }
819         g_free(data);
820 }
821
822 /**
823  * \brief Get a widget showing one icon with another overlaid on top of it.
824  *
825  * The base icon is always centralised, the other icon can be positioned.
826  * The overlay icon is ignored if pos=OVERLAY_NONE is used
827  *
828  * \param window   top-level window widget
829  * \param icon     the base icon
830  * \param overlay  the icon to overlay
831  * \param pos      how to align the overlay widget, or OVERLAY_NONE for no overlay
832  * \param border_x size of the border around the base icon (left and right)
833  * \param border_y size of the border around the base icon (top and bottom)
834  */
835 GtkWidget *stock_pixmap_widget_with_overlay(StockPixmap icon,
836                                             StockPixmap overlay, OverlayPosition pos,
837                                             gint border_x, gint border_y)
838 {
839         cairo_surface_t *stock_pixmap = NULL;
840         GdkPixbuf *stock_pixbuf = NULL;
841         GtkWidget *widget = NULL;
842         GtkWidget *stock_wid = NULL;
843         GtkRequisition requisition;
844         OverlayData *data = NULL;
845
846         data = g_new0(OverlayData, 1);
847
848         stock_wid = stock_pixmap_widget(icon);
849         gtk_widget_get_requisition(stock_wid, &requisition);
850
851 #if !GTK_CHECK_VERSION(3, 0, 0)
852         if (gtk_image_get_storage_type(GTK_IMAGE(stock_wid)) == GTK_IMAGE_PIXMAP)
853                 data->is_pixmap = TRUE;
854         else
855 #endif
856                 data->is_pixmap = FALSE;
857
858         if (data->is_pixmap) {
859                 cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(stock_wid));
860                 stock_pixmap = cairo_get_target(cr);
861                 cairo_surface_reference(stock_pixmap);
862                 cairo_destroy(cr);
863                 data->base_pixmap = stock_pixmap;
864                 data->base_height = requisition.height;
865                 data->base_width  = requisition.width;
866                 gtk_widget_destroy(stock_wid);
867
868                 if (pos == OVERLAY_NONE) {
869                         data->overlay_pixmap = NULL;
870                 } else {
871                         stock_wid = stock_pixmap_widget(overlay);
872                         cr = gdk_cairo_create(gtk_widget_get_window(stock_wid));
873                         stock_pixmap = cairo_get_target(cr);
874                         cairo_surface_reference(stock_pixmap);
875                         cairo_destroy(cr);
876                         data->overlay_pixmap = stock_pixmap;
877                         data->overlay_height = requisition.height;
878                         data->overlay_width  = requisition.width;
879
880                         gtk_widget_destroy(stock_wid);
881                 }
882         } else {
883                 data->is_pixmap = FALSE;
884                 stock_pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(stock_wid));
885                 g_object_ref(stock_pixbuf);
886                 data->base_pixbuf = stock_pixbuf;
887                 data->base_height = requisition.height;
888                 data->base_width  = requisition.width;
889                 gtk_widget_destroy(stock_wid);
890                 if (pos == OVERLAY_NONE) {
891                         data->overlay_pixmap = NULL;
892                 } else {
893                         stock_wid = stock_pixmap_widget(overlay);
894                         stock_pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(stock_wid));
895                         g_object_ref(stock_pixbuf);
896                         data->overlay_pixbuf = stock_pixbuf;
897                         data->overlay_height = requisition.height;
898                         data->overlay_width  = requisition.width;
899
900                         gtk_widget_destroy(stock_wid);
901                 }
902         }
903         data->position = pos;
904         data->border_x = border_x;
905         data->border_y = border_y;
906         data->highlight = FALSE;
907
908         widget = gtk_drawing_area_new();
909         gtk_widget_set_size_request(widget, data->base_width + border_x * 2,
910                               data->base_height + border_y * 2);
911 #if !GTK_CHECK_VERSION(3, 0, 0)
912         g_signal_connect(G_OBJECT(widget), "expose_event",
913                          G_CALLBACK(pixmap_with_overlay_expose_event_cb), data);
914 #else
915         g_signal_connect(G_OBJECT(widget), "draw",
916                          G_CALLBACK(pixmap_with_overlay_expose_event_cb), data);
917 #endif
918         g_signal_connect(G_OBJECT(widget), "destroy",
919                          G_CALLBACK(pixmap_with_overlay_destroy_cb), data);
920         g_object_set_data(G_OBJECT(widget), "highlight", &(data->highlight));
921         return widget;
922
923 }