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