Mercurial > pidgin.yaz
changeset 21698:1d13939502cd
I find this less painful to the eyes.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Fri, 30 Nov 2007 19:02:20 +0000 |
parents | 52bbf38a1cd2 |
children | 760a8e024142 |
files | pidgin/pidginstock.c |
diffstat | 1 files changed, 34 insertions(+), 54 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/pidginstock.c Fri Nov 30 18:58:56 2007 +0000 +++ b/pidgin/pidginstock.c Fri Nov 30 19:02:20 2007 +0000 @@ -347,7 +347,7 @@ size_t i; GtkWidget *win; GtkIconSize microscopic, extra_small, small, medium, large, huge; - + if (stock_initted) return; @@ -372,7 +372,7 @@ { /* GTK+ Stock icon */ iconset = gtk_style_lookup_icon_set(gtk_widget_get_style(win), - stock_icons[i].filename); + stock_icons[i].filename); } else { @@ -386,11 +386,11 @@ gtk_icon_source_set_direction_wildcarded(source, TRUE); gtk_icon_source_set_size_wildcarded(source, TRUE); gtk_icon_source_set_state_wildcarded(source, TRUE); - + iconset = gtk_icon_set_new(); gtk_icon_set_add_source(iconset, source); - + gtk_icon_source_free(source); g_free(filename); } @@ -401,7 +401,7 @@ } /* register custom icon sizes */ - + microscopic = gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_MICROSCOPIC, 11, 11); extra_small = gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL, 16, 16); small = gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_SMALL, 22, 22); @@ -414,61 +414,41 @@ GtkIconSet *iconset; iconset = gtk_icon_set_new(); - if (sized_stock_icons[i].microscopic) - add_sized_icon(iconset, microscopic, - sized_stock_icons[i].dir, sized_stock_icons[i].rtl, - "11", sized_stock_icons[i].filename); - if (sized_stock_icons[i].extra_small) - add_sized_icon(iconset, extra_small, - sized_stock_icons[i].dir, sized_stock_icons[i].rtl, - "16", sized_stock_icons[i].filename); - if (sized_stock_icons[i].small) - add_sized_icon(iconset, small, - sized_stock_icons[i].dir, sized_stock_icons[i].rtl, - "22", sized_stock_icons[i].filename); - if (sized_stock_icons[i].medium) - add_sized_icon(iconset, medium, - sized_stock_icons[i].dir, sized_stock_icons[i].rtl, - "32", sized_stock_icons[i].filename); - if (sized_stock_icons[i].large) - add_sized_icon(iconset, large, - sized_stock_icons[i].dir, sized_stock_icons[i].rtl, - "48", sized_stock_icons[i].filename); - if (sized_stock_icons[i].huge) - add_sized_icon(iconset, huge, - sized_stock_icons[i].dir, sized_stock_icons[i].rtl, - "64", sized_stock_icons[i].filename); + +#define ADD_SIZED_ICON(name, size) do { \ + if (sized_stock_icons[i].name) \ + add_sized_icon(iconset, name, \ + sized_stock_icons[i].dir, sized_stock_icons[i].rtl, \ + size, sized_stock_icons[i].filename); \ + } while (0) + ADD_SIZED_ICON(microscopic, "11"); + ADD_SIZED_ICON(extra_small, "16"); + ADD_SIZED_ICON(small, "22"); + ADD_SIZED_ICON(medium, "32"); + ADD_SIZED_ICON(large, "48"); + ADD_SIZED_ICON(huge, "64"); +#undef ADD_SIZED_ICON gtk_icon_factory_add(icon_factory, sized_stock_icons[i].name, iconset); gtk_icon_set_unref(iconset); if (sized_stock_icons[i].translucent_name) { iconset = gtk_icon_set_new(); - if (sized_stock_icons[i].microscopic) - add_translucent_sized_icon(iconset, microscopic, - sized_stock_icons[i].dir, sized_stock_icons[i].rtl, - "11", sized_stock_icons[i].filename); - if (sized_stock_icons[i].extra_small) - add_translucent_sized_icon(iconset, extra_small, - sized_stock_icons[i].dir, sized_stock_icons[i].rtl, - "16", sized_stock_icons[i].filename); - if (sized_stock_icons[i].small) - add_translucent_sized_icon(iconset, small, - sized_stock_icons[i].dir, sized_stock_icons[i].rtl, - "22", sized_stock_icons[i].filename); - if (sized_stock_icons[i].medium) - add_translucent_sized_icon(iconset, medium, - sized_stock_icons[i].dir, sized_stock_icons[i].rtl, - "32", sized_stock_icons[i].filename); - if (sized_stock_icons[i].large) - add_translucent_sized_icon(iconset, large, - sized_stock_icons[i].dir, sized_stock_icons[i].rtl, - "48", sized_stock_icons[i].filename); - if (sized_stock_icons[i].huge) - add_translucent_sized_icon(iconset, huge, - sized_stock_icons[i].dir, sized_stock_icons[i].rtl, - "64", sized_stock_icons[i].filename); - + +#define ADD_TRANS_ICON(name, size) do { \ + if (sized_stock_icons[i].name) \ + add_translucent_sized_icon(iconset, name, \ + sized_stock_icons[i].dir, sized_stock_icons[i].rtl, \ + size, sized_stock_icons[i].filename); \ + } while (0) + ADD_TRANS_ICON(microscopic, "11"); + ADD_TRANS_ICON(extra_small, "16"); + ADD_TRANS_ICON(small, "22"); + ADD_TRANS_ICON(medium, "32"); + ADD_TRANS_ICON(large, "48"); + ADD_TRANS_ICON(huge, "64"); +#undef ADD_TRANS_ICON + gtk_icon_factory_add(icon_factory, sized_stock_icons[i].translucent_name, iconset); gtk_icon_set_unref(iconset); }