From b112dec78d5e8289ded3f61db96e495690ae96b5 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 14 Feb 2013 18:21:11 +0000 Subject: change browser_window_create and refactor all callsites --- cocoa/BrowserView.m | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'cocoa/BrowserView.m') diff --git a/cocoa/BrowserView.m b/cocoa/BrowserView.m index 63efac468..aed2230b9 100644 --- a/cocoa/BrowserView.m +++ b/cocoa/BrowserView.m @@ -575,12 +575,43 @@ static browser_mouse_state cocoa_mouse_flags_for_event( NSEvent *evt ) - (IBAction) cmOpenURLInTab: (id) sender; { - browser_window_create( [[sender representedObject] UTF8String], browser, NULL, true, true ); + nsurl *url; + nserror error; + + error = nsurl_create([[sender representedObject] UTF8String], &url); + if (error == NSERROR_OK) { + error = browser_window_create(BROWSER_WINDOW_GO_FLAG_VERIFIABLE | + BROWSER_WINDOW_GO_FLAG_HISTORY | + BROWSER_WINDOW_GO_FLAG_TAB, + url, + NULL, + browser, + NULL); + nsurl_unref(url); + } + if (error != NSERROR_OK) { + warn_user(messages_get_errorcode(error), 0); + } } - (IBAction) cmOpenURLInWindow: (id) sender; { - browser_window_create( [[sender representedObject] UTF8String], browser, NULL, true, false ); + nsurl *url; + nserror error; + + error = nsurl_create([[sender representedObject] UTF8String], &url); + if (error == NSERROR_OK) { + error = browser_window_create(BROWSER_WINDOW_GO_FLAG_VERIFIABLE | + BROWSER_WINDOW_GO_FLAG_HISTORY, + url, + NULL, + browser, + NULL); + nsurl_unref(url); + } + if (error != NSERROR_OK) { + warn_user(messages_get_errorcode(error), 0); + } } - (IBAction) cmDownloadURL: (id) sender; -- cgit v1.2.3