diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-01-08 04:34:09 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-01-08 04:34:09 +0800 |
commit | 977e13469d48102bc3812140bdf3faf955e9f11a (patch) | |
tree | 133d157d8c0399adf9792a32207fcfa41ccbfeab /embed/mozilla | |
parent | c088c9ab24ffeafeef6b7b092facb6f3f57efc28 (diff) | |
download | gsoc2013-epiphany-977e13469d48102bc3812140bdf3faf955e9f11a.tar gsoc2013-epiphany-977e13469d48102bc3812140bdf3faf955e9f11a.tar.gz gsoc2013-epiphany-977e13469d48102bc3812140bdf3faf955e9f11a.tar.bz2 gsoc2013-epiphany-977e13469d48102bc3812140bdf3faf955e9f11a.tar.lz gsoc2013-epiphany-977e13469d48102bc3812140bdf3faf955e9f11a.tar.xz gsoc2013-epiphany-977e13469d48102bc3812140bdf3faf955e9f11a.tar.zst gsoc2013-epiphany-977e13469d48102bc3812140bdf3faf955e9f11a.zip |
More work on the start here page.
2003-01-07 Marco Pesenti Gritti <marco@it.gnome.org>
* data/starthere/Makefile.am:
* data/starthere/index.xml.in:
* data/starthere/section.css:
* data/starthere/section.xsl:
* embed/mozilla/StartHereProtocolHandler.cpp:
* embed/mozilla/mozilla-embed-shell.cpp:
* lib/ephy-file-helpers.c: (ephy_ensure_dir_exists),
(ephy_find_file_recursive), (ephy_file_find):
* lib/ephy-file-helpers.h:
* lib/ephy-start-here.c: (ephy_start_here_init),
(ephy_start_here_finalize), (is_my_lang), (mozilla_bookmarks),
(attach_content), (build_content), (ephy_start_here_get_page),
(ephy_start_here_get_base_uri):
* lib/ephy-start-here.h:
More work on the start here page.
Diffstat (limited to 'embed/mozilla')
-rw-r--r-- | embed/mozilla/StartHereProtocolHandler.cpp | 22 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed-shell.cpp | 35 |
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); |