aboutsummaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--ChangeLog15
-rw-r--r--lib/ephy-stock-icons.c35
-rw-r--r--lib/ephy-stock-icons.h9
-rw-r--r--src/ephy-window.c8
4 files changed, 50 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 7c3a64a2b..522fefb00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+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.
+
2003-11-20 Marco Pesenti Gritti <marco@gnome.org>
* data/glade/prefs-dialog.glade:
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
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 5e38f5f6f..3afd3b597 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -87,7 +87,7 @@ static GtkActionEntry ephy_menu_entries [] = {
{ "FileNewWindow", GTK_STOCK_NEW, N_("_New Window"), "<control>N",
N_("Open a new window"),
G_CALLBACK (window_cmd_file_new_window) },
- { "FileNewTab", EPHY_STOCK_NEW_TAB, N_("New _Tab"), "<control>T",
+ { "FileNewTab", STOCK_NEW_TAB, N_("New _Tab"), "<control>T",
N_("Open a new tab"),
G_CALLBACK (window_cmd_file_new_tab) },
{ "FileOpen", GTK_STOCK_OPEN, N_("_Open..."), "<control>O",
@@ -99,7 +99,7 @@ static GtkActionEntry ephy_menu_entries [] = {
{ "FilePrint", GTK_STOCK_PRINT, N_("_Print..."), "<control>P",
N_("Print the current page"),
G_CALLBACK (window_cmd_file_print) },
- { "FileSendTo", EPHY_STOCK_SEND_LINK, N_("S_end To..."), NULL,
+ { "FileSendTo", STOCK_SEND_MAIL, N_("S_end To..."), NULL,
N_("Send a link of the current page"),
G_CALLBACK (window_cmd_file_send_to) },
{ "FileCloseWindow", GTK_STOCK_CLOSE, N_("_Close"), "<control>W",
@@ -163,7 +163,7 @@ static GtkActionEntry ephy_menu_entries [] = {
{ "ViewEncoding", NULL, N_("Text _Encoding"), NULL,
N_("Change the text encoding"),
NULL },
- { "ViewPageSource", EPHY_STOCK_VIEWSOURCE, N_("_Page Source"), "<control>U",
+ { "ViewPageSource", STOCK_VIEW_SOURCE, N_("_Page Source"), "<control>U",
N_("View the source code of the page"),
G_CALLBACK (window_cmd_view_page_source) },
@@ -234,7 +234,7 @@ static GtkToggleActionEntry ephy_menu_toggle_entries [] =
{ "ViewStatusbar", NULL, N_("St_atusbar"), NULL,
N_("Show or hide statusbar"),
G_CALLBACK (window_cmd_view_statusbar), TRUE },
- { "ViewFullscreen", EPHY_STOCK_FULLSCREEN, N_("_Fullscreen"), "F11",
+ { "ViewFullscreen", STOCK_FULLSCREEN, N_("_Fullscreen"), "F11",
N_("Browse at full screen"),
G_CALLBACK (window_cmd_view_fullscreen), FALSE}
};