aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2003-11-21 19:00:24 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2003-11-21 19:00:24 +0800
commitc371819f2c4fef7c069b69c3f4037a3e5276450e (patch)
tree78988a3e1c09a09a94ebbc829d0b0b13f39a5419 /lib
parentf3b45df76a7b9147372d6815d2d3edca73270fb3 (diff)
downloadgsoc2013-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')
-rw-r--r--lib/ephy-stock-icons.c35
-rw-r--r--lib/ephy-stock-icons.h9
2 files changed, 31 insertions, 13 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));
diff --git a/lib/ephy-stock-icons.h b/lib/ephy-stock-icons.h
index 85b878dc7..b41353b08 100644
--- a/lib/ephy-stock-icons.h
+++ b/lib/ephy-stock-icons.h
@@ -28,13 +28,14 @@ G_BEGIN_DECLS
#define EPHY_STOCK_HISTORY "epiphany-history"
#define EPHY_STOCK_BOOKMARKS "epiphany-bookmarks"
#define EPHY_STOCK_BOOKMARK_PAGE "epiphany-bookmark-page"
-#define EPHY_STOCK_NEW_TAB "epiphany-new-tab"
-#define EPHY_STOCK_FULLSCREEN "epiphany-fullscreen"
-#define EPHY_STOCK_VIEWSOURCE "epiphany-viewsource"
-#define EPHY_STOCK_SEND_LINK "epiphany-send-link"
#define EPHY_STOCK_ENTRY "epiphany-entry"
#define EPHY_STOCK_DOWNLOAD "epiphany-download"
+#define STOCK_NEW_TAB "stock_new-tab"
+#define STOCK_FULLSCREEN "stock_fullscreen"
+#define STOCK_VIEW_SOURCE "stock_view-html-source"
+#define STOCK_SEND_MAIL "stock_mail_send"
+
void ephy_stock_icons_init (void);
G_END_DECLS