summaryrefslogtreecommitdiff
path: root/cocoa/gui.m
diff options
context:
space:
mode:
authorSven Weidauer <sven.weidauer@gmail.com>2011-01-25 17:16:17 +0000
committerSven Weidauer <sven.weidauer@gmail.com>2011-01-25 17:16:17 +0000
commit67c9970e544f987fc275c7a5eac67a9123e94868 (patch)
treecbd78a08a266fb7b82a4c31d33de04793084a82a /cocoa/gui.m
parentcca607fbe85ae6b6ad517a08eee80ac6a6e83c50 (diff)
downloadnetsurf-67c9970e544f987fc275c7a5eac67a9123e94868.tar.gz
Implemented favicons. Doesn't work for .ICO files
svn path=/trunk/netsurf/; revision=11485
Diffstat (limited to 'cocoa/gui.m')
-rw-r--r--cocoa/gui.m15
1 files changed, 14 insertions, 1 deletions
diff --git a/cocoa/gui.m b/cocoa/gui.m
index 03a9b1015..83c0cbd65 100644
--- a/cocoa/gui.m
+++ b/cocoa/gui.m
@@ -32,6 +32,8 @@
#import "desktop/401login.h"
#import "utils/utils.h"
+#import "image/ico.h"
+
char *default_stylesheet_url;
char *adblock_stylesheet_url;
char *quirks_stylesheet_url;
@@ -236,7 +238,18 @@ void gui_window_stop_throbber(struct gui_window *g)
void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
{
- // ignore
+ NSBitmapImageRep *bmp = icon != NULL ? (NSBitmapImageRep *)content_get_bitmap( icon ) : NULL;
+
+ NSImage *image = nil;
+ if (bmp != nil) {
+ image = [[NSImage alloc] initWithSize: NSMakeSize( 32, 32 )];
+ [image addRepresentation: bmp];
+ } else {
+ image = [[NSApp applicationIconImage] retain];
+ }
+
+ [(BrowserViewController *)g setFavicon: image];
+ [image release];
}
void gui_window_set_search_ico(hlcache_handle *ico)