Ethereal-dev: [Ethereal-dev] HowTo add application specific stock icons

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Ulf Lamping <ulf.lamping@xxxxxx>
Date: Sat, 15 Nov 2003 14:02:11 +0100
Richard Urwin wrote:
Could you let me have a brief introduction on how to do this?
The color filter dialog currently has import and export buttons as text, since there was no stock Export icon.

HowTo add application specific stock icons:

First you have to create the icons you need, of course. You will need xpm file format for this (the gimp can generate these for instance). The toolbar uses 24*24 pixels, but I think GTK will scale this for you. If you have problems converting the icon, I can convert it for you.

The xpm file is simply an ascii file, which looks like a C header file :-), it is compiled into the source file, so it doesn't need to be mentioned by some of the packaging things.

Put this file(s) somewhere into the image dir (the toolbar icons are in image/toolbar ;-).

Then edit the toolbar.c and toolbar.h files. It should be obvious, as there are other stock icons already there, search for the following lines and append your icons the same way:

toolbar.c
#include "../image/toolbar/dfilter_24.xpm"
{ ETHEREAL_STOCK_DISPLAY_FILTER, "_DFilter", 0, 0, NULL },
{ ETHEREAL_STOCK_DISPLAY_FILTER, dfilter_24_xpm },

toolbar.h
#define ETHEREAL_STOCK_DISPLAY_FILTER  "Ethereal_Stock_DisplayFilter"


Now you can simply use your icon like the icons, coming with the GTK2 distribution, e.g:

dfilter_bt = gtk_button_new_from_stock(ETHEREAL_STOCK_DISPLAY_FILTER);

Hope this will help you,

Regards, ULFL