Tue, 27 May 2003 03:38:52 +0000
[gaim-migrate @ 5937]
This is:
-AIM over OSCAR use Christian's new, kick ass
gaim_notify_email stuff for new mail notification. This
should be good, but it's kind of a pain to test. Let me
know if you have any problems
-Minor fix to the translation README
-2 minor changes to the doxygen of 2 major header files
(this means you'll have to recompile a lot of files :-) )
-If your global proxy setting is "No Proxy" and your global
proxy host is empty, but $http_proxy is set to something,
gaim used to switch your global proxy setting to "HTTP." It
no longer does this. This makes more sense to me. If you
disagree, please let me know--this is open to debate, and
what not. Also, the use of environmental proxy settings
will be changed a bit in the next day or two
| 4359 | 1 | /** |
| 2 | * @file stock.c GTK+ Stock resources | |
| 3 | * | |
| 4 | * gaim | |
| 5 | * | |
| 6 | * Copyright (C) 2002-2003, Christian Hammond <chipx86@gnupdate.org> | |
| 7 | * | |
| 8 | * This program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 21 | * | |
| 22 | */ | |
| 23 | #include "stock.h" | |
| 24 | #include "core.h" | |
| 25 | #include <gtk/gtk.h> | |
| 26 | #include <string.h> | |
| 27 | ||
|
4363
08b6dea58732
[gaim-migrate @ 4629]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
28 | #ifdef _WIN32 |
|
08b6dea58732
[gaim-migrate @ 4629]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
29 | #include "win32dep.h" |
|
08b6dea58732
[gaim-migrate @ 4629]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
30 | #endif |
|
08b6dea58732
[gaim-migrate @ 4629]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
31 | |
| 4359 | 32 | static struct StockIcon |
| 33 | { | |
| 34 | const char *name; | |
| 35 | const char *dir; | |
| 36 | const char *filename; | |
| 37 | ||
| 38 | } const stock_icons[] = | |
| 39 | { | |
|
5024
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
40 | { GAIM_STOCK_ABOUT, "buttons", "about_menu.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
41 | { GAIM_STOCK_ACCOUNTS, "buttons", "accounts.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
42 | { GAIM_STOCK_BGCOLOR, "buttons", "change-bgcolor-small.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
43 | { GAIM_STOCK_BLOCK, NULL, GTK_STOCK_STOP }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
44 | { GAIM_STOCK_CHAT, NULL, GTK_STOCK_JUMP_TO }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
45 | { GAIM_STOCK_DOWNLOAD, NULL, GTK_STOCK_GO_DOWN }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
46 | { GAIM_STOCK_DIALOG_AUTH, "dialogs", "gaim_auth.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
47 | { GAIM_STOCK_DIALOG_COOL, "dialogs", "gaim_cool.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
48 | { GAIM_STOCK_DIALOG_ERROR, "dialogs", "gaim_error.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
49 | { GAIM_STOCK_DIALOG_INFO, "dialogs", "gaim_info.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
50 | { GAIM_STOCK_DIALOG_QUESTION, "dialogs", "gaim_question.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
51 | { GAIM_STOCK_DIALOG_WARNING, "dialogs", "gaim_warning.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
52 | { GAIM_STOCK_FGCOLOR, "buttons", "change-fgcolor-small.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
53 | { GAIM_STOCK_EDIT, "buttons", "edit.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
54 | { GAIM_STOCK_FILE_CANCELED, NULL, GTK_STOCK_CANCEL }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
55 | { GAIM_STOCK_FILE_DONE, NULL, GTK_STOCK_APPLY }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
56 | { GAIM_STOCK_FILE_TRANSFER, NULL, GTK_STOCK_REVERT_TO_SAVED }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
57 | { GAIM_STOCK_ICON_AWAY, "icons", "away.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
58 | { GAIM_STOCK_ICON_AWAY_MSG, "icons", "msgpend.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
59 | { GAIM_STOCK_ICON_CONNECT, "icons", "connect.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
60 | { GAIM_STOCK_ICON_OFFLINE, "icons", "offline.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
61 | { GAIM_STOCK_ICON_ONLINE, "icons", "online.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
62 | { GAIM_STOCK_ICON_ONLINE_MSG, "icons", "msgunread.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
63 | { GAIM_STOCK_IGNORE, NULL, GTK_STOCK_DIALOG_ERROR }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
64 | { GAIM_STOCK_IM, NULL, GTK_STOCK_CONVERT }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
65 | { GAIM_STOCK_IMAGE, "buttons", "insert-image-small.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
66 | { GAIM_STOCK_INFO, NULL, GTK_STOCK_FIND }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
67 | { GAIM_STOCK_INVITE, NULL, GTK_STOCK_JUMP_TO }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
68 | { GAIM_STOCK_LINK, "buttons", "insert-link-small.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
69 | { GAIM_STOCK_LOGO, "gaim", "logo.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
70 | { GAIM_STOCK_PRIVACY, NULL, GTK_STOCK_PROPERTIES }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
71 | { GAIM_STOCK_SEND, NULL, GTK_STOCK_CONVERT }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
72 | { GAIM_STOCK_SIGN_ON, NULL, GTK_STOCK_EXECUTE }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
73 | { GAIM_STOCK_SIGN_OFF, NULL, GTK_STOCK_CLOSE }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
74 | { GAIM_STOCK_SMILEY, "buttons", "insert-smiley-small.png" }, |
|
5523
bf704f74966a
[gaim-migrate @ 5923]
Christian Hammond <chipx86@chipx86.com>
parents:
5115
diff
changeset
|
75 | { GAIM_STOCK_OPEN_MAIL, NULL, GTK_STOCK_JUMP_TO }, |
|
5024
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
76 | { GAIM_STOCK_TEXT_BIGGER, "buttons", "text_bigger.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
77 | { GAIM_STOCK_TEXT_NORMAL, "buttons", "text_normal.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
78 | { GAIM_STOCK_TEXT_SMALLER, "buttons", "text_smaller.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
79 | { GAIM_STOCK_TYPED, "gaim", "typed.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
80 | { GAIM_STOCK_TYPING, "gaim", "typing.png" }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
81 | { GAIM_STOCK_UPLOAD, NULL, GTK_STOCK_GO_UP }, |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
82 | { GAIM_STOCK_WARN, NULL, GTK_STOCK_DIALOG_WARNING } |
| 4359 | 83 | }; |
| 84 | ||
|
5523
bf704f74966a
[gaim-migrate @ 5923]
Christian Hammond <chipx86@chipx86.com>
parents:
5115
diff
changeset
|
85 | const GtkStockItem stock_items[] = |
|
bf704f74966a
[gaim-migrate @ 5923]
Christian Hammond <chipx86@chipx86.com>
parents:
5115
diff
changeset
|
86 | { |
|
bf704f74966a
[gaim-migrate @ 5923]
Christian Hammond <chipx86@chipx86.com>
parents:
5115
diff
changeset
|
87 | { GAIM_STOCK_OPEN_MAIL, N_("_Open Mail"), 0, 0, NULL } |
|
bf704f74966a
[gaim-migrate @ 5923]
Christian Hammond <chipx86@chipx86.com>
parents:
5115
diff
changeset
|
88 | }; |
|
bf704f74966a
[gaim-migrate @ 5923]
Christian Hammond <chipx86@chipx86.com>
parents:
5115
diff
changeset
|
89 | |
| 4359 | 90 | static gint stock_icon_count = sizeof(stock_icons) / sizeof(*stock_icons); |
|
5523
bf704f74966a
[gaim-migrate @ 5923]
Christian Hammond <chipx86@chipx86.com>
parents:
5115
diff
changeset
|
91 | static gint stock_item_count = sizeof(stock_items) / sizeof(*stock_items); |
| 4359 | 92 | |
| 93 | static gchar * | |
| 94 | find_file(const char *dir, const char *base) | |
| 95 | { | |
| 96 | char *filename; | |
| 97 | ||
| 98 | if (base == NULL) | |
| 99 | return NULL; | |
| 100 | ||
| 101 | if (!strcmp(dir, "gaim")) | |
| 102 | filename = g_build_filename(DATADIR, "pixmaps", "gaim", base, NULL); | |
| 103 | else | |
|
5523
bf704f74966a
[gaim-migrate @ 5923]
Christian Hammond <chipx86@chipx86.com>
parents:
5115
diff
changeset
|
104 | filename = g_build_filename(DATADIR, "pixmaps", "gaim", dir, base, NULL); |
| 4359 | 105 | |
| 106 | if (!g_file_test(filename, G_FILE_TEST_EXISTS)) { | |
|
4866
1c0f16f3859c
[gaim-migrate @ 5196]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
107 | g_critical("Unable to load stock pixmap %s\n", base); |
| 4359 | 108 | |
| 109 | g_free(filename); | |
| 110 | ||
| 111 | return NULL; | |
| 112 | } | |
| 113 | ||
| 114 | return filename; | |
| 115 | } | |
| 116 | ||
| 117 | void | |
| 118 | setup_stock() | |
| 119 | { | |
| 120 | GtkIconFactory *icon_factory; | |
| 121 | int i; | |
|
4670
8b9f47138de1
[gaim-migrate @ 4981]
Christian Hammond <chipx86@chipx86.com>
parents:
4514
diff
changeset
|
122 | GtkWidget *win; |
| 4359 | 123 | |
| 124 | /* Setup the icon factory. */ | |
| 125 | icon_factory = gtk_icon_factory_new(); | |
| 126 | ||
| 127 | gtk_icon_factory_add_default(icon_factory); | |
| 128 | ||
|
4670
8b9f47138de1
[gaim-migrate @ 4981]
Christian Hammond <chipx86@chipx86.com>
parents:
4514
diff
changeset
|
129 | /* Er, yeah, a hack, but it works. :) */ |
|
8b9f47138de1
[gaim-migrate @ 4981]
Christian Hammond <chipx86@chipx86.com>
parents:
4514
diff
changeset
|
130 | win = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
|
8b9f47138de1
[gaim-migrate @ 4981]
Christian Hammond <chipx86@chipx86.com>
parents:
4514
diff
changeset
|
131 | gtk_widget_realize(win); |
|
8b9f47138de1
[gaim-migrate @ 4981]
Christian Hammond <chipx86@chipx86.com>
parents:
4514
diff
changeset
|
132 | |
| 4359 | 133 | for (i = 0; i < stock_icon_count; i++) { |
| 134 | GdkPixbuf *pixbuf; | |
| 135 | GtkIconSet *iconset; | |
| 136 | gchar *filename; | |
| 137 | ||
| 138 | if (stock_icons[i].dir == NULL) { | |
|
4670
8b9f47138de1
[gaim-migrate @ 4981]
Christian Hammond <chipx86@chipx86.com>
parents:
4514
diff
changeset
|
139 | |
| 4359 | 140 | /* GTK+ Stock icon */ |
|
4670
8b9f47138de1
[gaim-migrate @ 4981]
Christian Hammond <chipx86@chipx86.com>
parents:
4514
diff
changeset
|
141 | iconset = gtk_style_lookup_icon_set(gtk_widget_get_style(win), |
|
8b9f47138de1
[gaim-migrate @ 4981]
Christian Hammond <chipx86@chipx86.com>
parents:
4514
diff
changeset
|
142 | stock_icons[i].filename); |
| 4359 | 143 | } |
| 144 | else { | |
| 145 | filename = find_file(stock_icons[i].dir, stock_icons[i].filename); | |
| 146 | ||
| 147 | if (filename == NULL) | |
| 148 | continue; | |
| 149 | ||
| 150 | pixbuf = gdk_pixbuf_new_from_file(filename, NULL); | |
| 151 | ||
| 152 | g_free(filename); | |
| 153 | ||
| 154 | iconset = gtk_icon_set_new_from_pixbuf(pixbuf); | |
| 155 | } | |
| 156 | ||
| 157 | gtk_icon_factory_add(icon_factory, stock_icons[i].name, iconset); | |
| 158 | ||
| 159 | gtk_icon_set_unref(iconset); | |
| 160 | } | |
| 161 | ||
|
4670
8b9f47138de1
[gaim-migrate @ 4981]
Christian Hammond <chipx86@chipx86.com>
parents:
4514
diff
changeset
|
162 | gtk_widget_destroy(win); |
|
8b9f47138de1
[gaim-migrate @ 4981]
Christian Hammond <chipx86@chipx86.com>
parents:
4514
diff
changeset
|
163 | |
|
5024
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
164 | /* register logo icon size */ |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
165 | gtk_icon_size_register(GAIM_ICON_SIZE_LOGO, 210, 150); |
|
3b5412e4b483
[gaim-migrate @ 5361]
Robert McQueen <robot101@debian.org>
parents:
4956
diff
changeset
|
166 | |
| 4359 | 167 | g_object_unref(G_OBJECT(icon_factory)); |
|
5523
bf704f74966a
[gaim-migrate @ 5923]
Christian Hammond <chipx86@chipx86.com>
parents:
5115
diff
changeset
|
168 | |
|
bf704f74966a
[gaim-migrate @ 5923]
Christian Hammond <chipx86@chipx86.com>
parents:
5115
diff
changeset
|
169 | /* Register the stock items. */ |
|
bf704f74966a
[gaim-migrate @ 5923]
Christian Hammond <chipx86@chipx86.com>
parents:
5115
diff
changeset
|
170 | gtk_stock_add_static(stock_items, stock_item_count); |
| 4359 | 171 | } |