annotate src/stock.c @ 9776:1e5ef71c9583

[gaim-migrate @ 10644] A patch from Daniel Atallah that should fix sf bug 1008489: "Windows Messenger BOT Crashes Gaim" Someone MSN-savvy should check this to make sure it's a valid fix. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 19 Aug 2004 01:13:58 +0000
parents d549d27388b2
children 4a15962c344a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * @file stock.c GTK+ Stock resources
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 *
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 * gaim
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7879
diff changeset
6 * Gaim is the legal property of its developers, whose names are too numerous
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7879
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7879
diff changeset
8 * source distribution.
8302
462ead6fc1a0 [gaim-migrate @ 9026]
Christian Hammond <chipx86@chipx86.com>
parents: 8300
diff changeset
9 *
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * (at your option) any later version.
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 *
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * GNU General Public License for more details.
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 *
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 *
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 */
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6155
diff changeset
25 #include "gtkinternal.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5822
diff changeset
26
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 #include "stock.h"
4363
65d98b565fbe [gaim-migrate @ 4629]
Christian Hammond <chipx86@chipx86.com>
parents: 4359
diff changeset
28
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 static struct StockIcon
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31 const char *name;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32 const char *dir;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33 const char *filename;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 } const stock_icons[] =
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36 {
5024
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
37 { GAIM_STOCK_ABOUT, "buttons", "about_menu.png" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
38 { GAIM_STOCK_ACCOUNTS, "buttons", "accounts.png" },
8302
462ead6fc1a0 [gaim-migrate @ 9026]
Christian Hammond <chipx86@chipx86.com>
parents: 8300
diff changeset
39 { GAIM_STOCK_ALIAS, "buttons", "edit.png" },
5024
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
40 { GAIM_STOCK_BGCOLOR, "buttons", "change-bgcolor-small.png" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
41 { GAIM_STOCK_BLOCK, NULL, GTK_STOCK_STOP },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
42 { GAIM_STOCK_CHAT, NULL, GTK_STOCK_JUMP_TO },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
43 { GAIM_STOCK_DOWNLOAD, NULL, GTK_STOCK_GO_DOWN },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
44 { GAIM_STOCK_DIALOG_AUTH, "dialogs", "gaim_auth.png" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
45 { GAIM_STOCK_DIALOG_COOL, "dialogs", "gaim_cool.png" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
46 { GAIM_STOCK_DIALOG_ERROR, "dialogs", "gaim_error.png" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
47 { GAIM_STOCK_DIALOG_INFO, "dialogs", "gaim_info.png" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
48 { GAIM_STOCK_DIALOG_QUESTION, "dialogs", "gaim_question.png" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
49 { GAIM_STOCK_DIALOG_WARNING, "dialogs", "gaim_warning.png" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
50 { GAIM_STOCK_FGCOLOR, "buttons", "change-fgcolor-small.png" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
51 { GAIM_STOCK_EDIT, "buttons", "edit.png" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
52 { GAIM_STOCK_FILE_CANCELED, NULL, GTK_STOCK_CANCEL },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
53 { GAIM_STOCK_FILE_DONE, NULL, GTK_STOCK_APPLY },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
54 { GAIM_STOCK_FILE_TRANSFER, NULL, GTK_STOCK_REVERT_TO_SAVED },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
55 { GAIM_STOCK_ICON_AWAY, "icons", "away.png" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
56 { GAIM_STOCK_ICON_AWAY_MSG, "icons", "msgpend.png" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
57 { GAIM_STOCK_ICON_CONNECT, "icons", "connect.png" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
58 { GAIM_STOCK_ICON_OFFLINE, "icons", "offline.png" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
59 { GAIM_STOCK_ICON_ONLINE, "icons", "online.png" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
60 { GAIM_STOCK_ICON_ONLINE_MSG, "icons", "msgunread.png" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
61 { GAIM_STOCK_IGNORE, NULL, GTK_STOCK_DIALOG_ERROR },
8472
6d1c5321c55e [gaim-migrate @ 9205]
Christian Hammond <chipx86@chipx86.com>
parents: 8346
diff changeset
62 { GAIM_STOCK_IM, "buttons", "send-im.png" },
5024
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
63 { GAIM_STOCK_IMAGE, "buttons", "insert-image-small.png" },
8472
6d1c5321c55e [gaim-migrate @ 9205]
Christian Hammond <chipx86@chipx86.com>
parents: 8346
diff changeset
64 { GAIM_STOCK_INFO, "icons", "info.png", },
5024
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
65 { GAIM_STOCK_INVITE, NULL, GTK_STOCK_JUMP_TO },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
66 { GAIM_STOCK_LINK, "buttons", "insert-link-small.png" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
67 { GAIM_STOCK_LOGO, "gaim", "logo.png" },
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5523
diff changeset
68 { GAIM_STOCK_MODIFY, NULL, GTK_STOCK_PREFERENCES },
6009
5cd7a10c6ade [gaim-migrate @ 6457]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
69 { GAIM_STOCK_PAUSE, "buttons", "pause.png" },
5cd7a10c6ade [gaim-migrate @ 6457]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
70 { GAIM_STOCK_OPEN_MAIL, NULL, GTK_STOCK_JUMP_TO },
5822
849bb39357a1 [gaim-migrate @ 6252]
Sean Egan <seanegan@gmail.com>
parents: 5563
diff changeset
71 { GAIM_STOCK_SEND, "buttons", "send-im.png" },
5024
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
72 { GAIM_STOCK_SIGN_ON, NULL, GTK_STOCK_EXECUTE },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
73 { GAIM_STOCK_SIGN_OFF, NULL, GTK_STOCK_CLOSE },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
74 { GAIM_STOCK_SMILEY, "buttons", "insert-smiley-small.png" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
75 { GAIM_STOCK_TEXT_BIGGER, "buttons", "text_bigger.png" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
76 { GAIM_STOCK_TEXT_NORMAL, "buttons", "text_normal.png" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
77 { GAIM_STOCK_TEXT_SMALLER, "buttons", "text_smaller.png" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
78 { GAIM_STOCK_TYPED, "gaim", "typed.png" },
6155
bac97cd0ed45 [gaim-migrate @ 6630]
Sean Egan <seanegan@gmail.com>
parents: 6150
diff changeset
79 { GAIM_STOCK_TYPING, "gaim", "typing.png" },
5024
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
80 { GAIM_STOCK_UPLOAD, NULL, GTK_STOCK_GO_UP },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
81 { GAIM_STOCK_WARN, NULL, GTK_STOCK_DIALOG_WARNING }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 };
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83
5523
fe76565d93c4 [gaim-migrate @ 5923]
Christian Hammond <chipx86@chipx86.com>
parents: 5115
diff changeset
84 const GtkStockItem stock_items[] =
fe76565d93c4 [gaim-migrate @ 5923]
Christian Hammond <chipx86@chipx86.com>
parents: 5115
diff changeset
85 {
8302
462ead6fc1a0 [gaim-migrate @ 9026]
Christian Hammond <chipx86@chipx86.com>
parents: 8300
diff changeset
86 { GAIM_STOCK_ALIAS, N_("_Alias"), 0, 0, NULL },
8308
34e8ad866f12 [gaim-migrate @ 9032]
Mark Doliner <mark@kingant.net>
parents: 8302
diff changeset
87 { GAIM_STOCK_CHAT, N_("_Join"), 0, 0, NULL },
9742
d549d27388b2 [gaim-migrate @ 10607]
Mark Doliner <mark@kingant.net>
parents: 8472
diff changeset
88 { GAIM_STOCK_INVITE, N_("_Invite"), 0, 0, NULL },
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5523
diff changeset
89 { GAIM_STOCK_MODIFY, N_("_Modify"), 0, 0, NULL },
6009
5cd7a10c6ade [gaim-migrate @ 6457]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
90 { GAIM_STOCK_OPEN_MAIL, N_("_Open Mail"), 0, 0, NULL },
8300
0f5cb0d93b11 [gaim-migrate @ 9024]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
91 { GAIM_STOCK_PAUSE, N_("_Pause"), 0, 0, NULL },
0f5cb0d93b11 [gaim-migrate @ 9024]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
92 { GAIM_STOCK_WARN, N_("_Warn"), 0, 0, NULL }
5523
fe76565d93c4 [gaim-migrate @ 5923]
Christian Hammond <chipx86@chipx86.com>
parents: 5115
diff changeset
93 };
fe76565d93c4 [gaim-migrate @ 5923]
Christian Hammond <chipx86@chipx86.com>
parents: 5115
diff changeset
94
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95 static gint stock_icon_count = sizeof(stock_icons) / sizeof(*stock_icons);
5523
fe76565d93c4 [gaim-migrate @ 5923]
Christian Hammond <chipx86@chipx86.com>
parents: 5115
diff changeset
96 static gint stock_item_count = sizeof(stock_items) / sizeof(*stock_items);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97
6009
5cd7a10c6ade [gaim-migrate @ 6457]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
98 static gboolean stock_inited = FALSE;
5cd7a10c6ade [gaim-migrate @ 6457]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
99
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
100 static gchar *
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
101 find_file(const char *dir, const char *base)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
102 {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
103 char *filename;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105 if (base == NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106 return NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
107
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108 if (!strcmp(dir, "gaim"))
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109 filename = g_build_filename(DATADIR, "pixmaps", "gaim", base, NULL);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
110 else
5523
fe76565d93c4 [gaim-migrate @ 5923]
Christian Hammond <chipx86@chipx86.com>
parents: 5115
diff changeset
111 filename = g_build_filename(DATADIR, "pixmaps", "gaim", dir, base, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
113 if (!g_file_test(filename, G_FILE_TEST_EXISTS)) {
4866
703e02e52262 [gaim-migrate @ 5196]
Christian Hammond <chipx86@chipx86.com>
parents: 4736
diff changeset
114 g_critical("Unable to load stock pixmap %s\n", base);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
115
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
116 g_free(filename);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
117
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
118 return NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
119 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
120
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
121 return filename;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
122 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
123
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
124 void
6009
5cd7a10c6ade [gaim-migrate @ 6457]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
125 gaim_gtk_stock_init(void)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
126 {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
127 GtkIconFactory *icon_factory;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
128 int i;
4670
ada933d434cb [gaim-migrate @ 4981]
Christian Hammond <chipx86@chipx86.com>
parents: 4514
diff changeset
129 GtkWidget *win;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
130
6009
5cd7a10c6ade [gaim-migrate @ 6457]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
131 if (stock_inited)
5cd7a10c6ade [gaim-migrate @ 6457]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
132 return;
5cd7a10c6ade [gaim-migrate @ 6457]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
133
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
134 /* Setup the icon factory. */
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
135 icon_factory = gtk_icon_factory_new();
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
136
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
137 gtk_icon_factory_add_default(icon_factory);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
138
4670
ada933d434cb [gaim-migrate @ 4981]
Christian Hammond <chipx86@chipx86.com>
parents: 4514
diff changeset
139 /* Er, yeah, a hack, but it works. :) */
ada933d434cb [gaim-migrate @ 4981]
Christian Hammond <chipx86@chipx86.com>
parents: 4514
diff changeset
140 win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
ada933d434cb [gaim-migrate @ 4981]
Christian Hammond <chipx86@chipx86.com>
parents: 4514
diff changeset
141 gtk_widget_realize(win);
ada933d434cb [gaim-migrate @ 4981]
Christian Hammond <chipx86@chipx86.com>
parents: 4514
diff changeset
142
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
143 for (i = 0; i < stock_icon_count; i++) {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
144 GdkPixbuf *pixbuf;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
145 GtkIconSet *iconset;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
146 gchar *filename;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
147
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
148 if (stock_icons[i].dir == NULL) {
4670
ada933d434cb [gaim-migrate @ 4981]
Christian Hammond <chipx86@chipx86.com>
parents: 4514
diff changeset
149
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
150 /* GTK+ Stock icon */
4670
ada933d434cb [gaim-migrate @ 4981]
Christian Hammond <chipx86@chipx86.com>
parents: 4514
diff changeset
151 iconset = gtk_style_lookup_icon_set(gtk_widget_get_style(win),
ada933d434cb [gaim-migrate @ 4981]
Christian Hammond <chipx86@chipx86.com>
parents: 4514
diff changeset
152 stock_icons[i].filename);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
153 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
154 else {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
155 filename = find_file(stock_icons[i].dir, stock_icons[i].filename);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
156
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
157 if (filename == NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
158 continue;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
159
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
160 pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
161
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
162 g_free(filename);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
163
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
164 iconset = gtk_icon_set_new_from_pixbuf(pixbuf);
8346
0d980682678f [gaim-migrate @ 9070]
Nathan Walp <nwalp@pidgin.im>
parents: 8308
diff changeset
165
0d980682678f [gaim-migrate @ 9070]
Nathan Walp <nwalp@pidgin.im>
parents: 8308
diff changeset
166 g_object_unref(G_OBJECT(pixbuf));
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
167 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
168
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
169 gtk_icon_factory_add(icon_factory, stock_icons[i].name, iconset);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
170
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
171 gtk_icon_set_unref(iconset);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
172 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
173
4670
ada933d434cb [gaim-migrate @ 4981]
Christian Hammond <chipx86@chipx86.com>
parents: 4514
diff changeset
174 gtk_widget_destroy(win);
ada933d434cb [gaim-migrate @ 4981]
Christian Hammond <chipx86@chipx86.com>
parents: 4514
diff changeset
175
5024
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
176 /* register logo icon size */
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
177 gtk_icon_size_register(GAIM_ICON_SIZE_LOGO, 210, 150);
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4956
diff changeset
178
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
179 g_object_unref(G_OBJECT(icon_factory));
5523
fe76565d93c4 [gaim-migrate @ 5923]
Christian Hammond <chipx86@chipx86.com>
parents: 5115
diff changeset
180
fe76565d93c4 [gaim-migrate @ 5923]
Christian Hammond <chipx86@chipx86.com>
parents: 5115
diff changeset
181 /* Register the stock items. */
fe76565d93c4 [gaim-migrate @ 5923]
Christian Hammond <chipx86@chipx86.com>
parents: 5115
diff changeset
182 gtk_stock_add_static(stock_items, stock_item_count);
6009
5cd7a10c6ade [gaim-migrate @ 6457]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
183
5cd7a10c6ade [gaim-migrate @ 6457]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
184 stock_inited = TRUE;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
185 }