diff options
author | Marco Pesenti Gritti <marco@gnome.org> | 2003-11-21 19:00:24 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2003-11-21 19:00:24 +0800 |
commit | c371819f2c4fef7c069b69c3f4037a3e5276450e (patch) | |
tree | 78988a3e1c09a09a94ebbc829d0b0b13f39a5419 /lib/ephy-stock-icons.c | |
parent | f3b45df76a7b9147372d6815d2d3edca73270fb3 (diff) | |
download | gsoc2013-epiphany-c371819f2c4fef7c069b69c3f4037a3e5276450e.tar gsoc2013-epiphany-c371819f2c4fef7c069b69c3f4037a3e5276450e.tar.gz gsoc2013-epiphany-c371819f2c4fef7c069b69c3f4037a3e5276450e.tar.bz2 gsoc2013-epiphany-c371819f2c4fef7c069b69c3f4037a3e5276450e.tar.lz gsoc2013-epiphany-c371819f2c4fef7c069b69c3f4037a3e5276450e.tar.xz gsoc2013-epiphany-c371819f2c4fef7c069b69c3f4037a3e5276450e.tar.zst gsoc2013-epiphany-c371819f2c4fef7c069b69c3f4037a3e5276450e.zip |
Pass a source based on filename instead of pixbuf for our own icon set, so
2003-11-21 Marco Pesenti Gritti <marco@gnome.org>
* lib/ephy-stock-icons.c: (ephy_stock_icons_init):
* lib/ephy-stock-icons.h:
Pass a source based on filename instead of pixbuf
for our own icon set, so that they are created only
when necessary.
Add code to insert icon theme icons in our icon set
and use icon theme icons when possible.
* src/ephy-window.c:
Update icons id.
Diffstat (limited to 'lib/ephy-stock-icons.c')
-rw-r--r-- | lib/ephy-stock-icons.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/lib/ephy-stock-icons.c b/lib/ephy-stock-icons.c index 7f05f0248..22b2b6038 100644 --- a/lib/ephy-stock-icons.c +++ b/lib/ephy-stock-icons.c @@ -30,8 +30,18 @@ void ephy_stock_icons_init (void) { GtkIconFactory *factory; + GtkIconSet *icon_set; + GtkIconSource *icon_source; int i; + static const char *icon_theme_items[] = + { + STOCK_NEW_TAB, + STOCK_FULLSCREEN, + STOCK_VIEW_SOURCE, + STOCK_SEND_MAIL + }; + static const char *items[] = { EPHY_STOCK_SECURE, @@ -39,10 +49,6 @@ ephy_stock_icons_init (void) EPHY_STOCK_HISTORY, EPHY_STOCK_BOOKMARKS, EPHY_STOCK_BOOKMARK_PAGE, - EPHY_STOCK_FULLSCREEN, - EPHY_STOCK_NEW_TAB, - EPHY_STOCK_VIEWSOURCE, - EPHY_STOCK_SEND_LINK, EPHY_STOCK_ENTRY, EPHY_STOCK_DOWNLOAD }; @@ -52,19 +58,30 @@ ephy_stock_icons_init (void) for (i = 0; i < (int) G_N_ELEMENTS (items); i++) { - GtkIconSet *icon_set; - GdkPixbuf *pixbuf; char *fn; + icon_set = gtk_icon_set_new (); + icon_source = gtk_icon_source_new (); + fn = g_strconcat (items[i], ".png", NULL); - pixbuf = gdk_pixbuf_new_from_file (ephy_file (fn), NULL); + gtk_icon_source_set_filename (icon_source, ephy_file (fn)); g_free (fn); - icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); + gtk_icon_set_add_source (icon_set, icon_source); gtk_icon_factory_add (factory, items[i], icon_set); gtk_icon_set_unref (icon_set); + g_free (icon_source); + } - g_object_unref (G_OBJECT (pixbuf)); + for (i = 0; i < (int) G_N_ELEMENTS (icon_theme_items); i++) + { + icon_set = gtk_icon_set_new (); + icon_source = gtk_icon_source_new (); + gtk_icon_source_set_icon_name (icon_source, icon_theme_items[i]); + gtk_icon_set_add_source (icon_set, icon_source); + gtk_icon_factory_add (factory, icon_theme_items[i], icon_set); + gtk_icon_set_unref (icon_set); + g_free (icon_source); } g_object_unref (G_OBJECT (factory)); |