Fix the wireless settings button for AirPCap devices in the
[obnox/wireshark/wip.git] / gtk / stock_icons.c
1 /* stock_icons.c
2  * Wireshark specific stock icons
3  * Copyright 2003-2008, Ulf Lamping <ulf.lamping@web.de>
4  *
5  * $Id$
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 1998 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25
26 #ifdef HAVE_CONFIG_H
27 #include "config.h"
28 #endif
29
30 #include <gtk/gtk.h>
31
32 #include "gtk/stock_icons.h"
33
34 /* these icons are derived from the original stock icons */
35 #include "../image/toolbar/capture_interfaces_24.xpm"
36 #include "../image/toolbar/capture_options_24.xpm"
37 #include "../image/toolbar/capture_start_24.xpm"
38 #include "../image/toolbar/capture_stop_24.xpm"
39 #include "../image/toolbar/capture_restart_24.xpm"
40 #include "../image/toolbar/capture_filter_24.xpm"
41 #include "../image/toolbar/capture_details_24.xpm"
42 #include "../image/toolbar/display_filter_24.xpm"
43 #include "../image/wsicon16.xpm"
44 #include "../image/toolbar/colorize_24.xpm"
45 #include "../image/toolbar/autoscroll_24.xpm"
46 #include "../image/toolbar/resize_columns_24.xpm"
47 #include "../image/toolbar/time_24.xpm"
48 #include "../image/toolbar/internet_24.xpm"
49 #include "../image/toolbar/web_support_24.xpm"
50 #include "../image/toolbar/wiki_24.xpm"
51 #include "../image/toolbar/conversations_16.xpm"
52 #include "../image/toolbar/endpoints_16.xpm"
53 #include "../image/toolbar/expert_info_16.xpm"
54 #include "../image/toolbar/flow_graph_16.xpm"
55 #include "../image/toolbar/graphs_16.xpm"
56 #include "../image/toolbar/telephony_16.xpm"
57 #include "../image/toolbar/decode_as_16.xpm"
58 #include "../image/toolbar/checkbox_16.xpm"
59 #include "../image/toolbar/file_set_list_16.xpm"
60 #include "../image/toolbar/file_set_next_16.xpm"
61 #include "../image/toolbar/file_set_previous_16.xpm"
62 #include "../image/toolbar/icon_color_1.xpm"
63 #include "../image/toolbar/icon_color_2.xpm"
64 #include "../image/toolbar/icon_color_3.xpm"
65 #include "../image/toolbar/icon_color_4.xpm"
66 #include "../image/toolbar/icon_color_5.xpm"
67 #include "../image/toolbar/icon_color_6.xpm"
68 #include "../image/toolbar/icon_color_7.xpm"
69 #include "../image/toolbar/icon_color_8.xpm"
70 #include "../image/toolbar/icon_color_9.xpm"
71 #include "../image/toolbar/icon_color_0.xpm"
72 #include "../image/toolbar/decode_24.xpm"
73 #include "../image/toolbar/audio_player_24.xpm"
74 #include "../image/toolbar/voip_flow_24.xpm"
75 #include "../image/toolbar/telephone_16.xpm"
76 #include "../image/toolbar/analyze_24.xpm"
77 #include "../image/WiresharkDoc_24.xpm"
78
79 typedef struct stock_pixmap_tag{
80     const char *    name;
81     const char **   xpm_data;
82 } stock_pixmap_t;
83
84 /* generate application specific stock items */
85 void stock_icons_init(void) {
86     GtkIconFactory * factory;
87     gint32 i;
88     GdkPixbuf * pixbuf;
89     GtkIconSet *icon_set;
90
91
92     /* register non-standard pixmaps with the gtk-stock engine */
93     static const GtkStockItem stock_items[] = {
94         { WIRESHARK_STOCK_CAPTURE_INTERFACES,    "_Interfaces",    0, 0, NULL },
95         { WIRESHARK_STOCK_CAPTURE_OPTIONS,       "_Options",       0, 0, NULL },
96         { WIRESHARK_STOCK_CAPTURE_START,         "_Start",         0, 0, NULL },
97         { WIRESHARK_STOCK_CAPTURE_STOP,          "S_top",          0, 0, NULL },
98         { WIRESHARK_STOCK_CAPTURE_RESTART,       "_Restart",       0, 0, NULL },
99         { WIRESHARK_STOCK_CAPTURE_FILTER,        "_Capture Filter",   0, 0, NULL },
100         { WIRESHARK_STOCK_CAPTURE_FILTER_ENTRY,  "_Capture Filter:",  0, 0, NULL },
101         { WIRESHARK_STOCK_CAPTURE_DETAILS,       "_Details",       0, 0, NULL },
102 #ifdef HAVE_GEOIP
103         { WIRESHARK_STOCK_MAP,                   "Map",                   0, 0, NULL },
104 #endif
105         { WIRESHARK_STOCK_FOLLOW_STREAM,         "Follow Stream",         0, 0, NULL },
106         { WIRESHARK_STOCK_DISPLAY_FILTER,        "Display _Filter",       0, 0, NULL },
107         { WIRESHARK_STOCK_DISPLAY_FILTER_ENTRY,  "F_ilter:",  0, 0, NULL },
108         { WIRESHARK_STOCK_BROWSE,                "_Browse...",                0, 0, NULL },
109         { WIRESHARK_STOCK_CREATE_STAT,           "Create _Stat",           0, 0, NULL },
110         { WIRESHARK_STOCK_EXPORT,                "_Export...",                0, 0, NULL },
111         { WIRESHARK_STOCK_IMPORT,                "_Import...",                0, 0, NULL },
112         { WIRESHARK_STOCK_EDIT,                  "_Edit...",                  0, 0, NULL },
113         { WIRESHARK_STOCK_ADD_EXPRESSION,        "E_xpression..." ,        0, 0, NULL }, /* plus sign coming from icon */
114         { WIRESHARK_STOCK_CLEAR_EXPRESSION,      "Clea_r" ,                   0, 0, NULL },
115         { WIRESHARK_STOCK_APPLY_EXPRESSION,      "App_ly" ,                   0, 0, NULL },
116         { WIRESHARK_STOCK_SAVE_ALL,              "Save A_ll",             0, 0, NULL },
117         { WIRESHARK_STOCK_DONT_SAVE,             "Continue _without Saving",             0, 0, NULL },
118         { WIRESHARK_STOCK_QUIT_DONT_SAVE,        "Quit _without Saving",             0, 0, NULL },
119         { WIRESHARK_STOCK_ABOUT,                 "_About",                 0, 0, NULL },
120         { WIRESHARK_STOCK_COLORIZE,              "_Colorize",              0, 0, NULL },
121         { WIRESHARK_STOCK_AUTOSCROLL,            "_Auto Scroll",            0, 0, NULL },
122         { WIRESHARK_STOCK_RESIZE_COLUMNS,        "Resize Columns",        0, 0, NULL },
123         { WIRESHARK_STOCK_TIME,                  "Time",                  0, 0, NULL },
124         { WIRESHARK_STOCK_INTERNET,              "Internet",              0, 0, NULL },
125         { WIRESHARK_STOCK_WEB_SUPPORT,           "Web Support",           0, 0, NULL },
126         { WIRESHARK_STOCK_WIKI,                  "Wiki",                  0, 0, NULL },
127         { WIRESHARK_STOCK_CONVERSATIONS,         "Conversations",         0, 0, NULL },
128         { WIRESHARK_STOCK_ENDPOINTS,             "Endpoints",             0, 0, NULL },
129         { WIRESHARK_STOCK_EXPERT_INFO,           "Expert Info",           0, 0, NULL },
130         { WIRESHARK_STOCK_GRAPHS,                "Graphs",                0, 0, NULL },
131         { WIRESHARK_STOCK_FLOW_GRAPH,            "Flow Graph",            0, 0, NULL },
132         { WIRESHARK_STOCK_TELEPHONY,             "Telephony",             0, 0, NULL },
133         { WIRESHARK_STOCK_DECODE_AS,             "Decode As",             0, 0, NULL },
134         { WIRESHARK_STOCK_CHECKBOX,              "Checkbox",              0, 0, NULL },
135         { WIRESHARK_STOCK_FILE_SET_LIST,         "List Files",         0, 0, NULL },
136         { WIRESHARK_STOCK_FILE_SET_NEXT,         "Next File",         0, 0, NULL },
137         { WIRESHARK_STOCK_FILE_SET_PREVIOUS,     "Previous File",     0, 0, NULL },
138         { WIRESHARK_STOCK_FILTER_OUT_STREAM,     "Filter Out This Stream",     0, 0, NULL },
139         { WIRESHARK_STOCK_ENABLE,                "Enable",                0, 0, NULL },
140         { WIRESHARK_STOCK_DISABLE,               "Disable",               0, 0, NULL },
141         { WIRESHARK_STOCK_COLOR1,                "Color 1",                0, 0, NULL },
142         { WIRESHARK_STOCK_COLOR2,                "Color 2",                0, 0, NULL },
143         { WIRESHARK_STOCK_COLOR3,                "Color 3",                0, 0, NULL },
144         { WIRESHARK_STOCK_COLOR4,                "Color 4",                0, 0, NULL },
145         { WIRESHARK_STOCK_COLOR5,                "Color 5",                0, 0, NULL },
146         { WIRESHARK_STOCK_COLOR6,                "Color 6",                0, 0, NULL },
147         { WIRESHARK_STOCK_COLOR7,                "Color 7",                0, 0, NULL },
148         { WIRESHARK_STOCK_COLOR8,                "Color 8",                0, 0, NULL },
149         { WIRESHARK_STOCK_COLOR9,                "Color 9",                0, 0, NULL },
150         { WIRESHARK_STOCK_COLOR0,                "Color 10",               0, 0, NULL },
151         { WIRESHARK_STOCK_DECODE,                "Decode",                 0, 0, NULL },
152         { WIRESHARK_STOCK_AUDIO_PLAYER,          "Player",                 0, 0, NULL },
153         { WIRESHARK_STOCK_VOIP_FLOW,             "Flow",                   0, 0, NULL },
154         { WIRESHARK_STOCK_TELEPHONE,             "Telephone",              0, 0, NULL },
155         { WIRESHARK_STOCK_PREPARE_FILTER,        "Prepare Filter",         0, 0, NULL },
156         { WIRESHARK_STOCK_ANALYZE,               "Analyze",                0, 0, NULL },
157                 { WIRESHARK_STOCK_FILE,                  "File",                   0, 0, NULL }
158     };
159
160     static const stock_pixmap_t pixmaps[] = {
161         { WIRESHARK_STOCK_CAPTURE_INTERFACES,    capture_interfaces_24_xpm },
162         { WIRESHARK_STOCK_CAPTURE_OPTIONS,       capture_options_24_xpm },
163         { WIRESHARK_STOCK_CAPTURE_START,         capture_start_24_xpm },
164         { WIRESHARK_STOCK_CAPTURE_STOP,          capture_stop_24_xpm },
165         { WIRESHARK_STOCK_CAPTURE_RESTART,       capture_restart_24_xpm },
166         { WIRESHARK_STOCK_CAPTURE_FILTER,        capture_filter_24_xpm },
167         { WIRESHARK_STOCK_CAPTURE_FILTER_ENTRY,  capture_filter_24_xpm },
168         { WIRESHARK_STOCK_CAPTURE_DETAILS,       capture_details_24_xpm },
169 #ifdef HAVE_GEOIP
170         { WIRESHARK_STOCK_MAP,                   internet_24_xpm},
171 #endif
172         { WIRESHARK_STOCK_DISPLAY_FILTER,        display_filter_24_xpm },
173         { WIRESHARK_STOCK_DISPLAY_FILTER_ENTRY,  display_filter_24_xpm },
174         { WIRESHARK_STOCK_ABOUT,                 wsicon16_xpm },
175         { WIRESHARK_STOCK_COLORIZE,              colorize_24_xpm },
176         { WIRESHARK_STOCK_AUTOSCROLL,            autoscroll_24_xpm },
177         { WIRESHARK_STOCK_RESIZE_COLUMNS,        resize_columns_24_xpm},
178         { WIRESHARK_STOCK_TIME,                  time_24_xpm},
179         { WIRESHARK_STOCK_INTERNET,              internet_24_xpm},
180         { WIRESHARK_STOCK_WEB_SUPPORT,           web_support_24_xpm},
181         { WIRESHARK_STOCK_WIKI,                  wiki_24_xpm},
182         { WIRESHARK_STOCK_CONVERSATIONS,         conversations_16_xpm},
183         { WIRESHARK_STOCK_ENDPOINTS,             endpoints_16_xpm},
184         { WIRESHARK_STOCK_EXPERT_INFO,           expert_info_16_xpm},
185         { WIRESHARK_STOCK_GRAPHS,                graphs_16_xpm},
186         { WIRESHARK_STOCK_FLOW_GRAPH,            flow_graph_16_xpm},
187         { WIRESHARK_STOCK_TELEPHONY,             telephony_16_xpm},
188         { WIRESHARK_STOCK_DECODE_AS,             decode_as_16_xpm},
189         { WIRESHARK_STOCK_CHECKBOX,              checkbox_16_xpm},
190         { WIRESHARK_STOCK_FILE_SET_LIST,         file_set_list_16_xpm},
191         { WIRESHARK_STOCK_FILE_SET_NEXT,         file_set_next_16_xpm},
192         { WIRESHARK_STOCK_FILE_SET_PREVIOUS,     file_set_previous_16_xpm},
193         { WIRESHARK_STOCK_FILTER_OUT_STREAM,     display_filter_24_xpm},
194         { WIRESHARK_STOCK_ENABLE,                checkbox_16_xpm},
195         { WIRESHARK_STOCK_COLOR1,                icon_color_1_xpm},
196         { WIRESHARK_STOCK_COLOR2,                icon_color_2_xpm},
197         { WIRESHARK_STOCK_COLOR3,                icon_color_3_xpm},
198         { WIRESHARK_STOCK_COLOR4,                icon_color_4_xpm},
199         { WIRESHARK_STOCK_COLOR5,                icon_color_5_xpm},
200         { WIRESHARK_STOCK_COLOR6,                icon_color_6_xpm},
201         { WIRESHARK_STOCK_COLOR7,                icon_color_7_xpm},
202         { WIRESHARK_STOCK_COLOR8,                icon_color_8_xpm},
203         { WIRESHARK_STOCK_COLOR9,                icon_color_9_xpm},
204         { WIRESHARK_STOCK_COLOR0,                icon_color_0_xpm},
205         { WIRESHARK_STOCK_DECODE,                decode_24_xpm},
206         { WIRESHARK_STOCK_AUDIO_PLAYER,          audio_player_24_xpm},
207         { WIRESHARK_STOCK_VOIP_FLOW,             voip_flow_24_xpm},
208         { WIRESHARK_STOCK_TELEPHONE,             telephone_16_xpm},
209         { WIRESHARK_STOCK_PREPARE_FILTER,        display_filter_24_xpm},
210         { WIRESHARK_STOCK_ANALYZE,               analyze_24_xpm},
211                 { WIRESHARK_STOCK_FILE,                  WiresharkDoc_24_xpm},
212         { NULL, NULL }
213     };
214
215     /* Register our stock items */
216     gtk_stock_add (stock_items, G_N_ELEMENTS (stock_items));
217
218     /* Add our custom icon factory to the list of defaults */
219     factory = gtk_icon_factory_new();
220     gtk_icon_factory_add_default(factory);
221
222     /* Create the stock items to add into our icon factory */
223     for (i = 0; pixmaps[i].name != NULL; i++) {
224         /* The default icon */
225         pixbuf = gdk_pixbuf_new_from_xpm_data((const char **) (pixmaps[i].xpm_data));
226         g_assert(pixbuf);
227         icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
228
229         /* XXX - add different sized icons here (some 16*16 icons look a bit blurred) */
230         /*gtk_icon_set_add_source(icon_set, const GtkIconSource *source);*/
231
232         gtk_icon_factory_add (factory, pixmaps[i].name, icon_set);
233         gtk_icon_set_unref (icon_set);
234         g_object_unref (G_OBJECT (pixbuf));
235     }
236
237     /* use default stock icons for Wireshark specifics where the icon metapher makes sense */
238     /* PLEASE DON'T REUSE STOCK ICONS IF THEY ARE USUALLY USED FOR SOME DIFFERENT MEANING!!!) */
239     icon_set = gtk_icon_factory_lookup_default(GTK_STOCK_OPEN);
240     gtk_icon_factory_add(factory, WIRESHARK_STOCK_BROWSE, icon_set);
241     icon_set = gtk_icon_factory_lookup_default(GTK_STOCK_OK);
242     gtk_icon_factory_add(factory, WIRESHARK_STOCK_CREATE_STAT, icon_set);
243     icon_set = gtk_icon_factory_lookup_default(GTK_STOCK_SAVE);
244     gtk_icon_factory_add(factory, WIRESHARK_STOCK_EXPORT, icon_set);    /* XXX: needs a better icon */
245     icon_set = gtk_icon_factory_lookup_default(GTK_STOCK_OPEN);
246     gtk_icon_factory_add(factory, WIRESHARK_STOCK_IMPORT, icon_set);    /* XXX: needs a better icon */
247     icon_set = gtk_icon_factory_lookup_default(GTK_STOCK_PROPERTIES);
248     gtk_icon_factory_add(factory, WIRESHARK_STOCK_EDIT, icon_set);
249     icon_set = gtk_icon_factory_lookup_default(GTK_STOCK_ADD);
250     gtk_icon_factory_add(factory, WIRESHARK_STOCK_ADD_EXPRESSION, icon_set);
251     icon_set = gtk_icon_factory_lookup_default(GTK_STOCK_CLEAR);
252     gtk_icon_factory_add(factory, WIRESHARK_STOCK_CLEAR_EXPRESSION, icon_set);
253     icon_set = gtk_icon_factory_lookup_default(GTK_STOCK_APPLY);
254     gtk_icon_factory_add(factory, WIRESHARK_STOCK_APPLY_EXPRESSION, icon_set);
255     icon_set = gtk_icon_factory_lookup_default(GTK_STOCK_CLEAR);
256     gtk_icon_factory_add(factory, WIRESHARK_STOCK_DONT_SAVE, icon_set);
257     gtk_icon_factory_add(factory, WIRESHARK_STOCK_QUIT_DONT_SAVE, icon_set);
258     icon_set = gtk_icon_factory_lookup_default(GTK_STOCK_SAVE);
259     gtk_icon_factory_add(factory, WIRESHARK_STOCK_SAVE_ALL, icon_set);  /* XXX: needs a better icon */
260     icon_set = gtk_icon_factory_lookup_default(GTK_STOCK_CLOSE);
261     gtk_icon_factory_add(factory, WIRESHARK_STOCK_DISABLE, icon_set);
262
263     /* Drop our reference to the factory, GTK will hold a reference.*/
264     g_object_unref (G_OBJECT (factory));
265 }
266
267