Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/31b1c72ddc66512c3a9cef4e59b94bdafc713ad4
...commit
http://git.netsurf-browser.org/netsurf.git/commit/31b1c72ddc66512c3a9cef4e59b94bdafc713ad4
...tree
http://git.netsurf-browser.org/netsurf.git/tree/31b1c72ddc66512c3a9cef4e59b94bdafc713ad4
The branch, master has been updated
via 31b1c72ddc66512c3a9cef4e59b94bdafc713ad4 (commit)
via 35146ef0c8f72526683f306a07d5cc70a070fe85 (commit)
from bcce8cc7b41f869fa2b022f85622cd389082d0f5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=31b1c72ddc66512c3a9cef4e59b94bdafc713ad4
commit 31b1c72ddc66512c3a9cef4e59b94bdafc713ad4
Author: François Revol <[email protected]>
Commit: François Revol <[email protected]>
haiku: add a file extension when viewing source
Pe still requires it to detect the language, this makes it easier.
diff --git a/frontends/beos/gui.cpp b/frontends/beos/gui.cpp
index 254fa90..c1b1536 100644
--- a/frontends/beos/gui.cpp
+++ b/frontends/beos/gui.cpp
@@ -840,13 +840,28 @@ void nsbeos_gui_view_source(struct hlcache_handle
*content)
* allow it to be re-used next time NetSurf is started. The
* memory overhead from doing this is under 1 byte per
* filename. */
- const char *filename = filename_request();
- if (!filename) {
+ BString filename(filename_request());
+ if (filename.IsEmpty()) {
beos_warn_user("NoMemory", 0);
return;
}
+
+ lwc_string *mime = content_get_mime_type(content);
+
+ /* provide an extension, as Pe still doesn't sniff the MIME */
+ if (mime) {
+ BMimeType type(lwc_string_data(mime));
+ BMessage extensions;
+ if (type.GetFileExtensions(&extensions) == B_OK) {
+ BString ext;
+ if (extensions.FindString("extensions", &ext)
== B_OK)
+ filename << "." << ext;
+ }
+ /* we unref(mime) later on, we just leak on error */
+ }
+
path.SetTo(TEMP_FILENAME_PREFIX);
- path.Append(filename);
+ path.Append(filename.String());
BFile file(path.Path(), B_WRITE_ONLY | B_CREATE_FILE);
err = file.InitCheck();
if (err < B_OK) {
@@ -858,7 +873,7 @@ void nsbeos_gui_view_source(struct hlcache_handle *content)
beos_warn_user("IOError", strerror(err));
return;
}
- lwc_string *mime = content_get_mime_type(content);
+
if (mime) {
file.WriteAttr("BEOS:TYPE", B_MIME_STRING_TYPE, 0LL,
lwc_string_data(mime), lwc_string_length(mime)
+ 1);
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=35146ef0c8f72526683f306a07d5cc70a070fe85
commit 35146ef0c8f72526683f306a07d5cc70a070fe85
Author: François Revol <[email protected]>
Commit: François Revol <[email protected]>
haiku: try to open source in preferred app for source-code first
We still fall back to the hardcoded list, but we first check for the
user's prefered code editor.
diff --git a/frontends/beos/gui.cpp b/frontends/beos/gui.cpp
index 8c6614d..254fa90 100644
--- a/frontends/beos/gui.cpp
+++ b/frontends/beos/gui.cpp
@@ -877,6 +877,7 @@ void nsbeos_gui_view_source(struct hlcache_handle *content)
// apps to try
const char *editorSigs[] = {
+ "text/x-source-code",
"application/x-vnd.beunited.pe",
"application/x-vnd.XEmacs",
"application/x-vnd.Haiku-StyledEdit",
@@ -891,10 +892,11 @@ void nsbeos_gui_view_source(struct hlcache_handle
*content)
BMessenger msgr(editorSigs[i], team);
if (msgr.SendMessage(&m) >= B_OK)
break;
+
}
err = be_roster->Launch(editorSigs[i], (BMessage *)&m, &team);
- if (err >= B_OK)
+ if (err >= B_OK || err == B_ALREADY_RUNNING)
break;
}
}
-----------------------------------------------------------------------
Summary of changes:
frontends/beos/gui.cpp | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/frontends/beos/gui.cpp b/frontends/beos/gui.cpp
index 8c6614d..c1b1536 100644
--- a/frontends/beos/gui.cpp
+++ b/frontends/beos/gui.cpp
@@ -840,13 +840,28 @@ void nsbeos_gui_view_source(struct hlcache_handle
*content)
* allow it to be re-used next time NetSurf is started. The
* memory overhead from doing this is under 1 byte per
* filename. */
- const char *filename = filename_request();
- if (!filename) {
+ BString filename(filename_request());
+ if (filename.IsEmpty()) {
beos_warn_user("NoMemory", 0);
return;
}
+
+ lwc_string *mime = content_get_mime_type(content);
+
+ /* provide an extension, as Pe still doesn't sniff the MIME */
+ if (mime) {
+ BMimeType type(lwc_string_data(mime));
+ BMessage extensions;
+ if (type.GetFileExtensions(&extensions) == B_OK) {
+ BString ext;
+ if (extensions.FindString("extensions", &ext)
== B_OK)
+ filename << "." << ext;
+ }
+ /* we unref(mime) later on, we just leak on error */
+ }
+
path.SetTo(TEMP_FILENAME_PREFIX);
- path.Append(filename);
+ path.Append(filename.String());
BFile file(path.Path(), B_WRITE_ONLY | B_CREATE_FILE);
err = file.InitCheck();
if (err < B_OK) {
@@ -858,7 +873,7 @@ void nsbeos_gui_view_source(struct hlcache_handle *content)
beos_warn_user("IOError", strerror(err));
return;
}
- lwc_string *mime = content_get_mime_type(content);
+
if (mime) {
file.WriteAttr("BEOS:TYPE", B_MIME_STRING_TYPE, 0LL,
lwc_string_data(mime), lwc_string_length(mime)
+ 1);
@@ -877,6 +892,7 @@ void nsbeos_gui_view_source(struct hlcache_handle *content)
// apps to try
const char *editorSigs[] = {
+ "text/x-source-code",
"application/x-vnd.beunited.pe",
"application/x-vnd.XEmacs",
"application/x-vnd.Haiku-StyledEdit",
@@ -891,10 +907,11 @@ void nsbeos_gui_view_source(struct hlcache_handle
*content)
BMessenger msgr(editorSigs[i], team);
if (msgr.SendMessage(&m) >= B_OK)
break;
+
}
err = be_roster->Launch(editorSigs[i], (BMessage *)&m, &team);
- if (err >= B_OK)
+ if (err >= B_OK || err == B_ALREADY_RUNNING)
break;
}
}
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org