summaryrefslogtreecommitdiff
path: root/beos/beos_gui.cpp
diff options
context:
space:
mode:
authorFran├žois Revel <mmu_man@netsurf-browser.org>2010-08-02 23:35:35 +0000
committerFran├žois Revel <mmu_man@netsurf-browser.org>2010-08-02 23:35:35 +0000
commit982dc9e128a773b9db6fae60181db32b03a4b647 (patch)
treecaad3d2162f65a2fc771a5cdd784badcb4bf7359 /beos/beos_gui.cpp
parent59f13bbf24d5cae3d00ca3c1bc7d9cbd6f501e4f (diff)
downloadnetsurf-982dc9e128a773b9db6fae60181db32b03a4b647.tar.gz
netsurf-982dc9e128a773b9db6fae60181db32b03a4b647.tar.bz2
Fix BeOS build:
- struct content -> hlcache_handle - login window (though it won't work yet as the message isn't handled, and since we don't have the window pointer anymore we can't add the alert as subset of the window...), - rsrc fetcher, - netsurf_init() args (but the replicant is still broken due to this), - export the realpath() hack as it's needed elsewhere too. svn path=/trunk/netsurf/; revision=10677
Diffstat (limited to 'beos/beos_gui.cpp')
-rw-r--r--beos/beos_gui.cpp51
1 files changed, 33 insertions, 18 deletions
diff --git a/beos/beos_gui.cpp b/beos/beos_gui.cpp
index b0f23b61b..768ae7680 100644
--- a/beos/beos_gui.cpp
+++ b/beos/beos_gui.cpp
@@ -45,6 +45,7 @@ extern "C" {
#include <hubbub/hubbub.h>
#include "content/content.h"
+#include "content/content_protected.h"
#include "content/fetch.h"
#include "content/fetchers/fetch_curl.h"
#include "content/urldb.h"
@@ -82,6 +83,7 @@ extern "C" {
static void *myrealloc(void *ptr, size_t len, void *pw);
+void gui_init(int argc, char** argv);
/* Where to search for shared resources. Must have trailing / */
@@ -121,7 +123,7 @@ static int sEventPipe[2];
#if 0 /* GTK */
static void nsbeos_create_ssl_verify_window(struct browser_window *bw,
- struct content *c, const struct ssl_cert_info *certs,
+ hlcache_handle *c, const struct ssl_cert_info *certs,
unsigned long num);
static void nsbeos_ssl_accept(BButton *w, gpointer data);
static void nsbeos_ssl_reject(BButton *w, gpointer data);
@@ -226,6 +228,7 @@ NSBrowserApplication::QuitRequested()
// XXX doesn't work
+#if 0
static char *generate_default_css()
{
BString text;
@@ -276,9 +279,11 @@ static char *generate_default_css()
return strdup(url);
}
+#endif
/* realpath fallback on R5 */
#if !defined(__HAIKU__) && !defined(B_BEOS_VERSION_DANO)
+extern "C" char *realpath(const char *f, char *buf);
char *realpath(const char *f, char *buf)
{
BPath path(f, NULL, true);
@@ -441,12 +446,23 @@ static void gui_init2(int argc, char** argv)
/** Normal entry point from OS */
int main(int argc, char** argv)
{
+ char buf[PATH_MAX];
setbuf(stderr, NULL);
+ BPath options;
+ if (find_directory(B_USER_SETTINGS_DIRECTORY, &options, true) == B_OK) {
+ options.Append("x-vnd.NetSurf");
+ }
+
+ find_resource(buf, "messages", "./beos/res/messages");
+ LOG(("Using '%s' as Messages file", buf));
+ //messages_load(buf);
+
/* initialise netsurf */
- netsurf_init(argc, argv);
+ netsurf_init(&argc, &argv, options.Path(), buf);
- gui_init2(argc, argv);
+ gui_init(argc, argv);
+ gui_init2(argc, argv);
netsurf_main_loop();
@@ -585,10 +601,6 @@ void gui_init(int argc, char** argv)
option_ca_path = strdup(buf);
}
- find_resource(buf, "messages", "./beos/res/messages");
- LOG(("Using '%s' as Messages file", buf));
- messages_load(buf);
-
//find_resource(buf, "mime.types", "/etc/mime.types");
beos_fetch_filetype_init();
@@ -863,20 +875,22 @@ gui_window_save_link(struct gui_window *g, const char *url, const char *title)
* Send the source of a content to a text editor.
*/
-void nsbeos_gui_view_source(struct content *content, struct selection *selection)
+void nsbeos_gui_view_source(struct hlcache_handle *content, struct selection *selection)
{
char *temp_name;
bool done = false;
BPath path;
status_t err;
+ size_t size;
+ const char *source = content_get_source_data(content, &size);
- if (!content || !content->source_data) {
+ if (!content || !source) {
warn_user("MiscError", "No document source");
return;
}
/* try to load local files directly. */
- temp_name = url_to_path(content->url);
+ temp_name = url_to_path(content_get_url(content));
if (temp_name) {
path.SetTo(temp_name);
BEntry entry;
@@ -904,12 +918,12 @@ void nsbeos_gui_view_source(struct content *content, struct selection *selection
warn_user("IOError", strerror(err));
return;
}
- err = file.Write(content->source_data, content->source_size);
+ err = file.Write(source, size);
if (err < B_OK) {
warn_user("IOError", strerror(err));
return;
}
- const char *mime = content->mime_type;
+ const char *mime = content_get_mime_type(content);
if (mime)
file.WriteAttr("BEOS:TYPE", B_MIME_STRING_TYPE, 0LL,
mime, strlen(mime) + 1);
@@ -926,10 +940,10 @@ void nsbeos_gui_view_source(struct content *content, struct selection *selection
#if 0
if (selection && selection->defined) {
int32 line = -1;
- if (content->type == CONTENT_HTML) {
+ if (content_get_type(content) == CONTENT_HTML) {
// XXX: use selection, find line in source code
}
- if (content->type == CONTENT_TEXTPLAIN) {
+ if (content_get_type(content) == CONTENT_TEXTPLAIN) {
line = MAKELINE_FROM_IDX(start_idx);
}
// not CSS!
@@ -1046,12 +1060,13 @@ void die(const char * const error)
}
-void hotlist_visited(struct content *content)
+void hotlist_visited(hlcache_handle *content)
{
}
-void gui_cert_verify(struct browser_window *bw, struct content *c,
- const struct ssl_cert_info *certs, unsigned long num)
+void gui_cert_verify(const char *url, const struct ssl_cert_info *certs,
+ unsigned long num, nserror (*cb)(bool proceed, void *pw),
+ void *cbpw)
{
CALLED();
#if 0 /* GTK */
@@ -1060,7 +1075,7 @@ void gui_cert_verify(struct browser_window *bw, struct content *c,
}
static void nsbeos_create_ssl_verify_window(struct browser_window *bw,
- struct content *c, const struct ssl_cert_info *certs,
+ hlcache_handle *c, const struct ssl_cert_info *certs,
unsigned long num)
{
CALLED();