2 * @file pidginstock.c GTK+ Stock resources
8 * Pidgin is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
30 #include "pidginstock.h"
32 static struct StockIcon
38 } const stock_icons
[] =
40 { PIDGIN_STOCK_ACTION
, NULL
, GTK_STOCK_EXECUTE
},
41 #if GTK_CHECK_VERSION(2,6,0)
42 { PIDGIN_STOCK_ALIAS
, NULL
, GTK_STOCK_EDIT
},
44 { PIDGIN_STOCK_ALIAS
, "buttons", "edit.png" },
46 { PIDGIN_STOCK_CHAT
, NULL
, GTK_STOCK_JUMP_TO
},
47 { PIDGIN_STOCK_CLEAR
, NULL
, GTK_STOCK_CLEAR
},
48 { PIDGIN_STOCK_CLOSE_TABS
, NULL
, GTK_STOCK_CLOSE
},
49 { PIDGIN_STOCK_DEBUG
, NULL
, GTK_STOCK_PROPERTIES
},
50 { PIDGIN_STOCK_DOWNLOAD
, NULL
, GTK_STOCK_GO_DOWN
},
51 #if GTK_CHECK_VERSION(2,6,0)
52 { PIDGIN_STOCK_DISCONNECT
, NULL
, GTK_STOCK_DISCONNECT
},
54 { PIDGIN_STOCK_DISCONNECT
, "icons", "stock_disconnect_16.png" },
56 { PIDGIN_STOCK_FGCOLOR
, "buttons", "change-fgcolor-small.png" },
57 #if GTK_CHECK_VERSION(2,6,0)
58 { PIDGIN_STOCK_EDIT
, NULL
, GTK_STOCK_EDIT
},
60 { PIDGIN_STOCK_EDIT
, "buttons", "edit.png" },
62 { PIDGIN_STOCK_FILE_CANCELED
, NULL
, GTK_STOCK_CANCEL
},
63 { PIDGIN_STOCK_FILE_DONE
, NULL
, GTK_STOCK_APPLY
},
64 { PIDGIN_STOCK_IGNORE
, NULL
, GTK_STOCK_DIALOG_ERROR
},
65 { PIDGIN_STOCK_INVITE
, NULL
, GTK_STOCK_JUMP_TO
},
66 { PIDGIN_STOCK_MODIFY
, NULL
, GTK_STOCK_PREFERENCES
},
67 { PIDGIN_STOCK_ADD
, NULL
, GTK_STOCK_ADD
},
68 #if GTK_CHECK_VERSION(2,6,0)
69 { PIDGIN_STOCK_PAUSE
, NULL
, GTK_STOCK_MEDIA_PAUSE
},
71 { PIDGIN_STOCK_PAUSE
, "buttons", "pause.png" },
73 { PIDGIN_STOCK_POUNCE
, NULL
, GTK_STOCK_REDO
},
74 { PIDGIN_STOCK_OPEN_MAIL
, NULL
, GTK_STOCK_JUMP_TO
},
75 { PIDGIN_STOCK_SIGN_ON
, NULL
, GTK_STOCK_EXECUTE
},
76 { PIDGIN_STOCK_SIGN_OFF
, NULL
, GTK_STOCK_CLOSE
},
77 { PIDGIN_STOCK_TYPED
, "pidgin", "typed.png" },
78 { PIDGIN_STOCK_UPLOAD
, NULL
, GTK_STOCK_GO_UP
},
79 #if GTK_CHECK_VERSION(2,8,0)
80 { PIDGIN_STOCK_INFO
, NULL
, GTK_STOCK_INFO
},
82 { PIDGIN_STOCK_INFO
, "buttons", "info.png" },
86 static const GtkStockItem stock_items
[] =
88 { PIDGIN_STOCK_ALIAS
, N_("_Alias"), 0, 0, NULL
},
89 { PIDGIN_STOCK_CHAT
, N_("_Join"), 0, 0, NULL
},
90 { PIDGIN_STOCK_CLOSE_TABS
, N_("Close _tabs"), 0, 0, NULL
},
91 { PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW
, N_("I_M"), 0, 0, NULL
},
92 { PIDGIN_STOCK_TOOLBAR_USER_INFO
, N_("_Get Info"), 0, 0, NULL
},
93 { PIDGIN_STOCK_INVITE
, N_("_Invite"), 0, 0, NULL
},
94 { PIDGIN_STOCK_MODIFY
, N_("_Modify..."), 0, 0, NULL
},
95 { PIDGIN_STOCK_ADD
, N_("_Add..."), 0, 0, NULL
},
96 { PIDGIN_STOCK_OPEN_MAIL
, N_("_Open Mail"), 0, 0, NULL
},
97 { PIDGIN_STOCK_PAUSE
, N_("_Pause"), 0, 0, NULL
},
98 { PIDGIN_STOCK_EDIT
, N_("_Edit"), 0, 0, NULL
}
101 static struct SizedStockIcon
{
104 const char *filename
;
105 gboolean microscopic
;
106 gboolean extra_small
;
112 const char *translucent_name
;
113 } const sized_stock_icons
[] = {
114 { PIDGIN_STOCK_STATUS_AVAILABLE
, "status", "available.png", TRUE
, TRUE
, TRUE
, TRUE
, TRUE
, FALSE
, FALSE
, PIDGIN_STOCK_STATUS_AVAILABLE_I
},
115 { PIDGIN_STOCK_STATUS_AWAY
, "status", "away.png", TRUE
, TRUE
, TRUE
, TRUE
, TRUE
, FALSE
, FALSE
, PIDGIN_STOCK_STATUS_AWAY_I
},
116 { PIDGIN_STOCK_STATUS_BUSY
, "status", "busy.png", TRUE
, TRUE
, TRUE
, TRUE
, TRUE
, FALSE
, FALSE
, PIDGIN_STOCK_STATUS_BUSY_I
},
117 { PIDGIN_STOCK_STATUS_CHAT
, "status", "chat.png", TRUE
, TRUE
, TRUE
, TRUE
, TRUE
, FALSE
, FALSE
, NULL
},
118 { PIDGIN_STOCK_STATUS_INVISIBLE
,"status", "invisible.png", TRUE
, TRUE
, TRUE
, TRUE
, TRUE
, FALSE
, FALSE
, NULL
},
119 { PIDGIN_STOCK_STATUS_XA
, "status", "extended-away.png", TRUE
, TRUE
, TRUE
, TRUE
, TRUE
, FALSE
, TRUE
, PIDGIN_STOCK_STATUS_XA_I
},
120 { PIDGIN_STOCK_STATUS_LOGIN
, "status", "log-in.png", TRUE
, TRUE
, TRUE
, TRUE
, TRUE
, FALSE
, TRUE
, NULL
},
121 { PIDGIN_STOCK_STATUS_LOGOUT
, "status", "log-out.png", TRUE
, TRUE
, TRUE
, TRUE
, TRUE
, FALSE
, TRUE
, NULL
},
122 { PIDGIN_STOCK_STATUS_OFFLINE
, "status", "offline.png", TRUE
, TRUE
, TRUE
, TRUE
, TRUE
, FALSE
, FALSE
, PIDGIN_STOCK_STATUS_OFFLINE_I
},
123 { PIDGIN_STOCK_STATUS_PERSON
, "status", "person.png", TRUE
, TRUE
, TRUE
, TRUE
, TRUE
, FALSE
, FALSE
, NULL
},
124 { PIDGIN_STOCK_STATUS_MESSAGE
, "toolbar", "message-new.png", TRUE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
126 { PIDGIN_STOCK_STATUS_IGNORED
, "emblems", "blocked.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
127 { PIDGIN_STOCK_STATUS_FOUNDER
, "emblems", "founder.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
128 { PIDGIN_STOCK_STATUS_OPERATOR
, "emblems", "operator.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
129 { PIDGIN_STOCK_STATUS_HALFOP
, "emblems", "half-operator.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
130 { PIDGIN_STOCK_STATUS_VOICE
, "emblems", "voice.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
132 { PIDGIN_STOCK_DIALOG_AUTH
, "dialogs", "auth.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, TRUE
, FALSE
, NULL
},
133 { PIDGIN_STOCK_DIALOG_COOL
, "dialogs", "cool.png", FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, TRUE
, FALSE
, NULL
},
134 { PIDGIN_STOCK_DIALOG_ERROR
, "dialogs", "error.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, TRUE
, FALSE
, NULL
},
135 { PIDGIN_STOCK_DIALOG_INFO
, "dialogs", "info.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, TRUE
, FALSE
, NULL
},
136 { PIDGIN_STOCK_DIALOG_MAIL
, "dialogs", "mail.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, TRUE
, FALSE
, NULL
},
137 { PIDGIN_STOCK_DIALOG_QUESTION
, "dialogs", "question.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, TRUE
, FALSE
, NULL
},
138 { PIDGIN_STOCK_DIALOG_WARNING
, "dialogs", "warning.png", FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, TRUE
, FALSE
, NULL
},
140 { PIDGIN_STOCK_ANIMATION_CONNECT0
, "animations", "process-working0.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
141 { PIDGIN_STOCK_ANIMATION_CONNECT1
, "animations", "process-working1.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
142 { PIDGIN_STOCK_ANIMATION_CONNECT2
, "animations", "process-working2.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
143 { PIDGIN_STOCK_ANIMATION_CONNECT3
, "animations", "process-working3.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
144 { PIDGIN_STOCK_ANIMATION_CONNECT4
, "animations", "process-working4.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
145 { PIDGIN_STOCK_ANIMATION_CONNECT5
, "animations", "process-working5.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
146 { PIDGIN_STOCK_ANIMATION_CONNECT6
, "animations", "process-working6.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
147 { PIDGIN_STOCK_ANIMATION_CONNECT7
, "animations", "process-working7.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
148 { PIDGIN_STOCK_ANIMATION_CONNECT8
, "animations", "process-working8.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
149 { PIDGIN_STOCK_ANIMATION_CONNECT9
, "animations", "process-working9.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
150 { PIDGIN_STOCK_ANIMATION_CONNECT10
, "animations", "process-working10.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
151 { PIDGIN_STOCK_ANIMATION_CONNECT11
, "animations", "process-working11.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
152 { PIDGIN_STOCK_ANIMATION_CONNECT12
, "animations", "process-working12.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
153 { PIDGIN_STOCK_ANIMATION_CONNECT13
, "animations", "process-working13.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
154 { PIDGIN_STOCK_ANIMATION_CONNECT14
, "animations", "process-working14.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
155 { PIDGIN_STOCK_ANIMATION_CONNECT15
, "animations", "process-working15.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
156 { PIDGIN_STOCK_ANIMATION_CONNECT16
, "animations", "process-working16.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
157 { PIDGIN_STOCK_ANIMATION_CONNECT17
, "animations", "process-working17.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
158 { PIDGIN_STOCK_ANIMATION_CONNECT18
, "animations", "process-working18.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
159 { PIDGIN_STOCK_ANIMATION_CONNECT19
, "animations", "process-working19.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
160 { PIDGIN_STOCK_ANIMATION_CONNECT20
, "animations", "process-working20.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
161 { PIDGIN_STOCK_ANIMATION_CONNECT21
, "animations", "process-working21.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
162 { PIDGIN_STOCK_ANIMATION_CONNECT22
, "animations", "process-working22.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
163 { PIDGIN_STOCK_ANIMATION_CONNECT23
, "animations", "process-working23.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
164 { PIDGIN_STOCK_ANIMATION_CONNECT24
, "animations", "process-working24.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
165 { PIDGIN_STOCK_ANIMATION_CONNECT25
, "animations", "process-working25.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
166 { PIDGIN_STOCK_ANIMATION_CONNECT26
, "animations", "process-working26.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
167 { PIDGIN_STOCK_ANIMATION_CONNECT27
, "animations", "process-working27.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
168 { PIDGIN_STOCK_ANIMATION_CONNECT28
, "animations", "process-working28.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
169 { PIDGIN_STOCK_ANIMATION_CONNECT29
, "animations", "process-working29.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
170 { PIDGIN_STOCK_ANIMATION_CONNECT30
, "animations", "process-working30.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
171 { PIDGIN_STOCK_ANIMATION_TYPING0
, "animations", "typing0.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
172 { PIDGIN_STOCK_ANIMATION_TYPING1
, "animations", "typing1.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
173 { PIDGIN_STOCK_ANIMATION_TYPING2
, "animations", "typing2.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
174 { PIDGIN_STOCK_ANIMATION_TYPING3
, "animations", "typing3.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
175 { PIDGIN_STOCK_ANIMATION_TYPING4
, "animations", "typing4.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
176 { PIDGIN_STOCK_ANIMATION_TYPING5
, "animations", "typing5.png",FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
178 { PIDGIN_STOCK_TOOLBAR_BGCOLOR
, "toolbar", "change-bgcolor.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
179 { PIDGIN_STOCK_TOOLBAR_BLOCK
, "emblems", "blocked.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
180 { PIDGIN_STOCK_TOOLBAR_FGCOLOR
, "toolbar", "change-fgcolor.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
181 { PIDGIN_STOCK_TOOLBAR_SMILEY
, "toolbar", "emote-select.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
182 { PIDGIN_STOCK_TOOLBAR_FONT_FACE
, "toolbar", "font-face.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
183 { PIDGIN_STOCK_TOOLBAR_TEXT_SMALLER
, "toolbar", "font-size-down.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
184 { PIDGIN_STOCK_TOOLBAR_TEXT_LARGER
, "toolbar", "font-size-up.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
185 { PIDGIN_STOCK_TOOLBAR_INSERT
, "toolbar", "insert.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
186 { PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE
, "toolbar", "insert-image.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
187 { PIDGIN_STOCK_TOOLBAR_INSERT_LINK
, "toolbar", "insert-link.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
188 { PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW
, "toolbar", "message-new.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
189 { PIDGIN_STOCK_TOOLBAR_PENDING
, "tray", "tray-new-im.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
190 { PIDGIN_STOCK_TOOLBAR_PLUGINS
, "toolbar", "plugins.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
191 { PIDGIN_STOCK_TOOLBAR_UNBLOCK
, "toolbar", "unblock.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
192 { PIDGIN_STOCK_TOOLBAR_SELECT_AVATAR
, "toolbar", "select-avatar.png", FALSE
, FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
193 { PIDGIN_STOCK_TOOLBAR_SEND_FILE
, "toolbar", "send-file.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
194 { PIDGIN_STOCK_TOOLBAR_TRANSFER
, "toolbar", "transfer.png", FALSE
, TRUE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, NULL
},
196 { PIDGIN_STOCK_TRAY_AVAILABLE
, "tray", "tray-online.png", FALSE
, TRUE
, TRUE
, TRUE
, TRUE
, FALSE
, FALSE
, NULL
},
197 { PIDGIN_STOCK_TRAY_INVISIBLE
, "tray", "tray-invisible.png", FALSE
, TRUE
, TRUE
, TRUE
, TRUE
, FALSE
, FALSE
, NULL
},
198 { PIDGIN_STOCK_TRAY_AWAY
, "tray", "tray-away.png", FALSE
, TRUE
, TRUE
, TRUE
, TRUE
, FALSE
, FALSE
, NULL
},
199 { PIDGIN_STOCK_TRAY_BUSY
, "tray", "tray-busy.png", FALSE
, TRUE
, TRUE
, TRUE
, TRUE
, FALSE
, FALSE
, NULL
},
200 { PIDGIN_STOCK_TRAY_XA
, "tray", "tray-extended-away.png", FALSE
, TRUE
, TRUE
, TRUE
, TRUE
, FALSE
, FALSE
, NULL
},
201 { PIDGIN_STOCK_TRAY_OFFLINE
, "tray", "tray-offline.png", FALSE
, TRUE
, TRUE
, TRUE
, TRUE
, FALSE
, FALSE
, NULL
},
202 { PIDGIN_STOCK_TRAY_CONNECT
, "tray", "tray-connecting.png", FALSE
, TRUE
, TRUE
, TRUE
, TRUE
, FALSE
, FALSE
, NULL
},
203 { PIDGIN_STOCK_TRAY_PENDING
, "tray", "tray-new-im.png", FALSE
, TRUE
, TRUE
, TRUE
, TRUE
, FALSE
, FALSE
, NULL
},
204 { PIDGIN_STOCK_TRAY_EMAIL
, "tray", "tray-message.png", FALSE
, TRUE
, TRUE
, TRUE
, TRUE
, FALSE
, FALSE
, NULL
}
208 add_sized_icon_common(GtkIconSet
*iconset
, GtkIconSize sizeid
, const char *dir
,
209 gboolean rtl
, const char *size
, const char *file
,
210 gboolean translucent
);
213 find_file_common(const char *name
)
216 #if GLIB_CHECK_VERSION(2,6,0)
217 const gchar
*userdir
;
218 const gchar
* const *sysdirs
;
220 userdir
= g_get_user_data_dir();
221 filename
= g_build_filename(userdir
, name
, NULL
);
222 if (g_file_test(filename
, G_FILE_TEST_EXISTS
))
226 sysdirs
= g_get_system_data_dirs();
227 for (; *sysdirs
; sysdirs
++) {
228 filename
= g_build_filename(*sysdirs
, name
, NULL
);
229 if (g_file_test(filename
, G_FILE_TEST_EXISTS
))
234 filename
= g_build_filename(DATADIR
, name
, NULL
);
235 if (g_file_test(filename
, G_FILE_TEST_EXISTS
))
242 find_file(const char *dir
, const char *base
)
250 if (!strcmp(dir
, "pidgin"))
251 filename
= g_build_filename("pixmaps", "pidgin", base
, NULL
);
253 filename
= g_build_filename("pixmaps", "pidgin", dir
, base
, NULL
);
255 ret
= find_file_common(filename
);
261 add_sized_icon(GtkIconSet
*iconset
, GtkIconSize sizeid
, const char *dir
,
262 gboolean rtl
, const char *size
, const char *file
)
264 add_sized_icon_common(iconset
, sizeid
, dir
, rtl
, size
, file
, FALSE
);
267 /* Altered from do_colorshift in gnome-panel */
269 do_alphashift (GdkPixbuf
*dest
, GdkPixbuf
*src
)
272 gint width
, height
, has_alpha
, srcrowstride
, destrowstride
;
273 guchar
*target_pixels
;
274 guchar
*original_pixels
;
279 has_alpha
= gdk_pixbuf_get_has_alpha (src
);
283 width
= gdk_pixbuf_get_width (src
);
284 height
= gdk_pixbuf_get_height (src
);
285 srcrowstride
= gdk_pixbuf_get_rowstride (src
);
286 destrowstride
= gdk_pixbuf_get_rowstride (dest
);
287 target_pixels
= gdk_pixbuf_get_pixels (dest
);
288 original_pixels
= gdk_pixbuf_get_pixels (src
);
290 for (i
= 0; i
< height
; i
++) {
291 pixdest
= target_pixels
+ i
*destrowstride
;
292 pixsrc
= original_pixels
+ i
*srcrowstride
;
293 for (j
= 0; j
< width
; j
++) {
294 *(pixdest
++) = *(pixsrc
++);
295 *(pixdest
++) = *(pixsrc
++);
296 *(pixdest
++) = *(pixsrc
++);
298 *(pixdest
++) = a
/ 2;
304 add_translucent_sized_icon(GtkIconSet
*iconset
, GtkIconSize sizeid
, const char *dir
,
305 gboolean rtl
, const char *size
, const char *file
)
307 add_sized_icon_common(iconset
, sizeid
, dir
, rtl
, size
, file
, TRUE
);
311 add_sized_icon_common(GtkIconSet
*iconset
, GtkIconSize sizeid
, const char *dir
,
312 gboolean rtl
, const char *size
, const char *file
,
313 gboolean translucent
)
315 char *filename
, *subpath
;
316 GtkIconSource
*source
;
319 subpath
= g_build_filename("pixmaps", "pidgin", dir
, size
, file
, NULL
);
320 filename
= find_file_common(subpath
);
325 pixbuf
= gdk_pixbuf_new_from_file(filename
, NULL
);
327 do_alphashift(pixbuf
, pixbuf
);
329 source
= gtk_icon_source_new();
330 gtk_icon_source_set_pixbuf(source
, pixbuf
);
331 gtk_icon_source_set_direction(source
, GTK_TEXT_DIR_LTR
);
332 gtk_icon_source_set_direction_wildcarded(source
, !rtl
);
333 gtk_icon_source_set_size(source
, sizeid
);
334 gtk_icon_source_set_size_wildcarded(source
, FALSE
);
335 gtk_icon_source_set_state_wildcarded(source
, TRUE
);
336 gtk_icon_set_add_source(iconset
, source
);
337 gtk_icon_source_free(source
);
339 if (sizeid
== gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL
)) {
340 source
= gtk_icon_source_new();
341 gtk_icon_source_set_pixbuf(source
, pixbuf
);
342 gtk_icon_source_set_direction_wildcarded(source
, TRUE
);
343 gtk_icon_source_set_size(source
, GTK_ICON_SIZE_MENU
);
344 gtk_icon_source_set_size_wildcarded(source
, FALSE
);
345 gtk_icon_source_set_state_wildcarded(source
, TRUE
);
346 gtk_icon_set_add_source(iconset
, source
);
347 gtk_icon_source_free(source
);
350 g_object_unref(pixbuf
);
353 subpath
= g_build_filename("pixmaps", "pidgin", dir
, size
, "rtl", file
, NULL
);
354 filename
= find_file_common(subpath
);
358 pixbuf
= gdk_pixbuf_new_from_file(filename
, NULL
);
360 do_alphashift(pixbuf
, pixbuf
);
361 source
= gtk_icon_source_new();
362 gtk_icon_source_set_pixbuf(source
, pixbuf
);
363 gtk_icon_source_set_direction(source
, GTK_TEXT_DIR_RTL
);
364 gtk_icon_source_set_size(source
, sizeid
);
365 gtk_icon_source_set_size_wildcarded(source
, FALSE
);
366 gtk_icon_source_set_state_wildcarded(source
, TRUE
);
367 gtk_icon_set_add_source(iconset
, source
);
369 g_object_unref(pixbuf
);
370 gtk_icon_source_free(source
);
375 pidgin_stock_init(void)
377 static gboolean stock_initted
= FALSE
;
378 GtkIconFactory
*icon_factory
;
381 GtkIconSize microscopic
, extra_small
, small
, medium
, large
, huge
;
386 stock_initted
= TRUE
;
388 /* Setup the icon factory. */
389 icon_factory
= gtk_icon_factory_new();
391 gtk_icon_factory_add_default(icon_factory
);
393 /* Er, yeah, a hack, but it works. :) */
394 win
= gtk_window_new(GTK_WINDOW_TOPLEVEL
);
395 gtk_widget_realize(win
);
397 for (i
= 0; i
< G_N_ELEMENTS(stock_icons
); i
++)
399 GtkIconSource
*source
;
403 if (stock_icons
[i
].dir
== NULL
)
405 /* GTK+ Stock icon */
406 iconset
= gtk_style_lookup_icon_set(gtk_widget_get_style(win
),
407 stock_icons
[i
].filename
);
411 filename
= find_file(stock_icons
[i
].dir
, stock_icons
[i
].filename
);
413 if (filename
== NULL
)
416 source
= gtk_icon_source_new();
417 gtk_icon_source_set_filename(source
, filename
);
418 gtk_icon_source_set_direction_wildcarded(source
, TRUE
);
419 gtk_icon_source_set_size_wildcarded(source
, TRUE
);
420 gtk_icon_source_set_state_wildcarded(source
, TRUE
);
422 iconset
= gtk_icon_set_new();
423 gtk_icon_set_add_source(iconset
, source
);
425 gtk_icon_source_free(source
);
429 gtk_icon_factory_add(icon_factory
, stock_icons
[i
].name
, iconset
);
431 gtk_icon_set_unref(iconset
);
434 /* register custom icon sizes */
436 microscopic
= gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_MICROSCOPIC
, 11, 11);
437 extra_small
= gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL
, 16, 16);
438 small
= gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_SMALL
, 22, 22);
439 medium
= gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_MEDIUM
, 32, 32);
440 large
= gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_LARGE
, 48, 48);
441 huge
= gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_HUGE
, 64, 64);
443 for (i
= 0; i
< G_N_ELEMENTS(sized_stock_icons
); i
++)
447 iconset
= gtk_icon_set_new();
449 #define ADD_SIZED_ICON(name, size) do { \
450 if (sized_stock_icons[i].name) \
451 add_sized_icon(iconset, name, \
452 sized_stock_icons[i].dir, sized_stock_icons[i].rtl, \
453 size, sized_stock_icons[i].filename); \
455 ADD_SIZED_ICON(microscopic
, "11");
456 ADD_SIZED_ICON(extra_small
, "16");
457 ADD_SIZED_ICON(small
, "22");
458 ADD_SIZED_ICON(medium
, "32");
459 ADD_SIZED_ICON(large
, "48");
460 ADD_SIZED_ICON(huge
, "64");
461 #undef ADD_SIZED_ICON
463 gtk_icon_factory_add(icon_factory
, sized_stock_icons
[i
].name
, iconset
);
464 gtk_icon_set_unref(iconset
);
466 if (sized_stock_icons
[i
].translucent_name
) {
467 iconset
= gtk_icon_set_new();
469 #define ADD_TRANS_ICON(name, size) do { \
470 if (sized_stock_icons[i].name) \
471 add_translucent_sized_icon(iconset, name, \
472 sized_stock_icons[i].dir, sized_stock_icons[i].rtl, \
473 size, sized_stock_icons[i].filename); \
475 ADD_TRANS_ICON(microscopic
, "11");
476 ADD_TRANS_ICON(extra_small
, "16");
477 ADD_TRANS_ICON(small
, "22");
478 ADD_TRANS_ICON(medium
, "32");
479 ADD_TRANS_ICON(large
, "48");
480 ADD_TRANS_ICON(huge
, "64");
481 #undef ADD_TRANS_ICON
483 gtk_icon_factory_add(icon_factory
, sized_stock_icons
[i
].translucent_name
, iconset
);
484 gtk_icon_set_unref(iconset
);
488 gtk_widget_destroy(win
);
489 g_object_unref(G_OBJECT(icon_factory
));
491 /* Register the stock items. */
492 gtk_stock_add_static(stock_items
, G_N_ELEMENTS(stock_items
));