summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2011-12-31 00:00:54 +0000
committerVincent Sanders <vince@netsurf-browser.org>2011-12-31 00:00:54 +0000
commite0596793e1a1c34786586cb18ee4fc8652ef7c50 (patch)
tree3e51933e2ea15d3f0cbf235884f5a684efa1d7c8 /gtk
parentbe20f89884da134b09a96f459bd47e4badb0af39 (diff)
downloadnetsurf-e0596793e1a1c34786586cb18ee4fc8652ef7c50.tar.gz
netsurf-e0596793e1a1c34786586cb18ee4fc8652ef7c50.tar.bz2
load default favicon once
svn path=/trunk/netsurf/; revision=13357
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gui.c13
-rw-r--r--gtk/gui.h2
-rw-r--r--gtk/scaffolding.c6
-rw-r--r--gtk/toolbar.c10
4 files changed, 20 insertions, 11 deletions
diff --git a/gtk/gui.c b/gtk/gui.c
index 18331264f..5d58958e7 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -87,6 +87,8 @@ char *res_dir_location;
char *print_options_file_location;
char *languages_file_location;
+GdkPixbuf *favicon_pixbuf; /* favicon default pixbuf */
+
struct glade_file_location_s *glade_file_location;
static GtkWindow *nsgtk_warning_window;
@@ -389,6 +391,17 @@ static void gui_init(int argc, char** argv, char **respath)
search_default_ico_location = filepath_find(respath, "default.ico");
LOG(("Using '%s' as default search ico", search_default_ico_location));
+ /* Default favicon */
+ resource_filename = filepath_find(respath, "favicon.png");
+ if (resource_filename != NULL) {
+ favicon_pixbuf = gdk_pixbuf_new_from_file(resource_filename, NULL);
+ free(resource_filename);
+ if (favicon_pixbuf == NULL) {
+ favicon_pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, false, 8, 16,16);
+
+ }
+ }
+
/* Toolbar inicies file */
toolbar_indices_file_location = filepath_find(respath, "toolbarIndices");
LOG(("Using '%s' as custom toolbar settings file", toolbar_indices_file_location));
diff --git a/gtk/gui.h b/gtk/gui.h
index 40f41a078..c7333d55d 100644
--- a/gtk/gui.h
+++ b/gtk/gui.h
@@ -54,6 +54,8 @@ extern char *options_file_location; /**< location where user options are written
extern char *res_dir_location;
extern char *print_options_file_location;
+extern GdkPixbuf *favicon_pixbuf; /* favicon default pixbuf */
+
uint32_t gtk_gui_gdkkey_to_nskey(GdkEventKey *);
#endif /* GTK_GUI_H */
diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c
index 53c8a4fc2..e8f28a17e 100644
--- a/gtk/scaffolding.c
+++ b/gtk/scaffolding.c
@@ -2012,10 +2012,8 @@ void gui_window_set_icon(struct gui_window *_g, hlcache_handle *icon)
}
if (icon_pixbuf == NULL) {
- char imagepath[strlen(res_dir_location) +
- SLEN("favicon.png") + 1];
- sprintf(imagepath, "%sfavicon.png", res_dir_location);
- icon_pixbuf = gdk_pixbuf_new_from_file(imagepath, NULL);
+ g_object_ref(favicon_pixbuf);
+ icon_pixbuf = favicon_pixbuf;
}
if (icon_pixbuf == NULL) {
diff --git a/gtk/toolbar.c b/gtk/toolbar.c
index 3d2fe64cd..7fa2764df 100644
--- a/gtk/toolbar.c
+++ b/gtk/toolbar.c
@@ -704,10 +704,6 @@ GtkWidget *nsgtk_toolbar_make_widget(nsgtk_scaffolding *g,
return GTK_WIDGET(gtk_tool_button_new(GTK_WIDGET(
theme->image[HISTORY_BUTTON]), ""));
case URL_BAR_ITEM: {
- char imagefile[strlen(res_dir_location) + SLEN("favicon.png")
- + 1];
- sprintf(imagefile, "%sfavicon.png", res_dir_location);
- GdkPixbuf *iconbuf = gdk_pixbuf_new_from_file(imagefile, NULL);
GtkWidget *entry = nsgtk_entry_new();
GtkWidget *w = GTK_WIDGET(gtk_tool_item_new());
@@ -716,9 +712,9 @@ GtkWidget *nsgtk_toolbar_make_widget(nsgtk_scaffolding *g,
return NULL;
}
- if (iconbuf != NULL) {
- nsgtk_entry_set_icon_from_pixbuf(entry, GTK_ENTRY_ICON_PRIMARY, iconbuf);
- }
+ nsgtk_entry_set_icon_from_pixbuf(entry,
+ GTK_ENTRY_ICON_PRIMARY,
+ favicon_pixbuf);
gtk_container_add(GTK_CONTAINER(w), entry);
gtk_tool_item_set_expand(GTK_TOOL_ITEM(w), TRUE);