aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
Diffstat (limited to 'embed')
-rw-r--r--embed/mozilla/StartHereProtocolHandler.cpp22
-rw-r--r--embed/mozilla/mozilla-embed-shell.cpp35
2 files changed, 50 insertions, 7 deletions
diff --git a/embed/mozilla/StartHereProtocolHandler.cpp b/embed/mozilla/StartHereProtocolHandler.cpp
index 4ea95294c..2d2bb3c35 100644
--- a/embed/mozilla/StartHereProtocolHandler.cpp
+++ b/embed/mozilla/StartHereProtocolHandler.cpp
@@ -41,7 +41,6 @@ class GStartHereProtocolHandler : public nsIProtocolHandler
virtual ~GStartHereProtocolHandler();
nsCOMPtr<nsIChannel> mChannel;
- nsCOMPtr<nsIURI> mURI;
};
/* Implementation file */
@@ -115,10 +114,9 @@ NS_IMETHODIMP GStartHereProtocolHandler::NewChannel(nsIURI *aURI,
nsresult rv;
EphyStartHere *sh;
char *buf;
+ const char *aBaseURI;
PRUint32 bytesWritten;
-
- mURI = aURI;
-
+
nsCAutoString path;
rv = aURI->GetPath(path);
if (NS_FAILED(rv)) return rv;
@@ -134,9 +132,16 @@ NS_IMETHODIMP GStartHereProtocolHandler::NewChannel(nsIURI *aURI,
sh = ephy_start_here_new ();
buf = ephy_start_here_get_page (sh, "index");
- rv = stream->Write (buf, strlen (buf), &bytesWritten);
- g_free (buf);
+ aBaseURI = ephy_start_here_get_base_uri (sh);
+ rv = stream->Write (buf, strlen (buf), &bytesWritten);
+ if (NS_FAILED (rv)) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIURI> uri;
+ nsCAutoString spec(aBaseURI);
+ rv = NS_NewURI(getter_AddRefs(uri), spec.get());
+ if (NS_FAILED (rv)) return NS_ERROR_FAILURE;
+
nsCOMPtr<nsIInputStream> iStream;
PRUint32 size;
@@ -146,10 +151,13 @@ NS_IMETHODIMP GStartHereProtocolHandler::NewChannel(nsIURI *aURI,
rv = sStream->NewInputStream(0, getter_AddRefs(iStream));
if (NS_FAILED(rv)) return rv;
- rv = NS_NewInputStreamChannel(getter_AddRefs(mChannel), mURI,
+ rv = NS_NewInputStreamChannel(getter_AddRefs(mChannel), uri,
iStream, NS_LITERAL_CSTRING("text/xml"),
NS_LITERAL_CSTRING("utf-8"), size);
+ g_free (buf);
+ g_object_unref (sh);
+
NS_IF_ADDREF (*_retval = mChannel);
return rv;
diff --git a/embed/mozilla/mozilla-embed-shell.cpp b/embed/mozilla/mozilla-embed-shell.cpp
index 8a66191b9..6b8c5e8f1 100644
--- a/embed/mozilla/mozilla-embed-shell.cpp
+++ b/embed/mozilla/mozilla-embed-shell.cpp
@@ -184,6 +184,39 @@ mozilla_embed_shell_class_init (MozillaEmbedShellClass *klass)
}
static void
+mozilla_load_language_prefs (MozillaEmbedShell *shell)
+{
+ GString *langs;
+ const GList *l;
+
+ langs = g_string_new (NULL);
+
+ l = gnome_i18n_get_language_list ("LC_MESSAGES");
+ for (; l != NULL; l = l->next)
+ {
+ char *lang = (char *)l->data;
+ int len;
+ char *lg, *enc;
+
+ g_print ("%s\n", lang);
+
+ lg = strchr (lang, '_');
+ enc = strchr (lang, '.');
+
+ len = strlen (lang);
+ if (enc) len = enc - lang;
+ if (lg) len = lg - lang;
+
+ g_string_append (langs, ",");
+ g_string_append_len (langs, lang, len);
+ }
+
+ mozilla_prefs_set_string ("intl.accept_languages", langs->str + 1);
+
+ g_string_free (langs, TRUE);
+}
+
+static void
mozilla_load_proxy_prefs (MozillaEmbedShell *shell)
{
char *tmp;
@@ -424,6 +457,8 @@ mozilla_embed_shell_init (MozillaEmbedShell *mes)
}
mozilla_load_proxy_prefs (mes);
+
+ mozilla_load_language_prefs (mes);
mozilla_init_single (mes);