aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-01-07 21:28:22 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-01-07 21:28:22 +0800
commit07e1bf23744ac4305406c416e1361582948a1d3e (patch)
treed24a68d5e11adb2cc0df438f8f8e78fe47f4339b
parent5d3540a4c4e9606adef1575b92c0142f65f1ee86 (diff)
downloadgsoc2013-epiphany-07e1bf23744ac4305406c416e1361582948a1d3e.tar
gsoc2013-epiphany-07e1bf23744ac4305406c416e1361582948a1d3e.tar.gz
gsoc2013-epiphany-07e1bf23744ac4305406c416e1361582948a1d3e.tar.bz2
gsoc2013-epiphany-07e1bf23744ac4305406c416e1361582948a1d3e.tar.lz
gsoc2013-epiphany-07e1bf23744ac4305406c416e1361582948a1d3e.tar.xz
gsoc2013-epiphany-07e1bf23744ac4305406c416e1361582948a1d3e.tar.zst
gsoc2013-epiphany-07e1bf23744ac4305406c416e1361582948a1d3e.zip
Architecture for translatable xml/xsl start page.
2003-01-07 Marco Pesenti Gritti <marco@it.gnome.org> * configure.in: * data/Makefile.am: * data/start_here.html: * data/starthere/Makefile.am: * data/starthere/index.xml.in: * data/starthere/section.xsl: * embed/mozilla/StartHereProtocolHandler.cpp: * lib/Makefile.am: * lib/widgets/ephy-autocompletion-window.c: (hack_tree_view_move_selection): * po/POTFILES.in: Architecture for translatable xml/xsl start page.
-rw-r--r--ChangeLog21
-rw-r--r--configure.in1
-rw-r--r--data/Makefile.am6
-rw-r--r--data/start_here.html23
-rw-r--r--data/starthere/Makefile.am12
-rw-r--r--data/starthere/index.xml.in8
-rw-r--r--data/starthere/section.xsl23
-rw-r--r--embed/mozilla/StartHereProtocolHandler.cpp52
-rw-r--r--lib/Makefile.am2
-rw-r--r--lib/widgets/ephy-autocompletion-window.c2
-rw-r--r--po/POTFILES.in1
11 files changed, 108 insertions, 43 deletions
diff --git a/ChangeLog b/ChangeLog
index 462d4e15f..567bf2244 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2003-01-07 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * configure.in:
+ * data/Makefile.am:
+ * data/start_here.html:
+ * data/starthere/Makefile.am:
+ * data/starthere/index.xml.in:
+ * data/starthere/section.xsl:
+ * embed/mozilla/StartHereProtocolHandler.cpp:
+ * lib/Makefile.am:
+ * lib/widgets/ephy-autocompletion-window.c:
+ (hack_tree_view_move_selection):
+ * po/POTFILES.in:
+
+ Architecture for translatable xml/xsl start page.
+
+2003-01-06 Vincent Untz <vincent@vuntz.net>
+
+ * lib/widgets/ephy-autocompletion-window.c: declare all variables
+ before the first instruction.
+
2003-01-06 Marco Pesenti Gritti <marco@it.gnome.org>
* TODO:
diff --git a/configure.in b/configure.in
index 163345eb6..553b71633 100644
--- a/configure.in
+++ b/configure.in
@@ -159,6 +159,7 @@ data/Makefile
data/glade/Makefile
data/art/Makefile
data/ui/Makefile
+data/starthere/Makefile
lib/Makefile
lib/widgets/Makefile
lib/toolbar/Makefile
diff --git a/data/Makefile.am b/data/Makefile.am
index e5d584df7..452cdd623 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = ui art glade
+SUBDIRS = ui art glade starthere
@INTLTOOL_SERVER_RULE@
@INTLTOOL_DESKTOP_RULE@
@@ -16,9 +16,6 @@ Applications_DATA = $(DESKTOP_FILES)
schemadir = $(sysconfdir)/gconf/schemas
schema_DATA = epiphany.schemas
-startheredir = $(pkgdatadir)
-starthere_DATA = start_here.html
-
EXTRA_DIST = $(glade_DATA)
install-data-local:
@@ -32,6 +29,5 @@ CLEANFILES = $(server_DATA) $(Applications_DATA)
EXTRA_DIST = $(server_in_files) \
$(schema_DATA) \
- $(starthere_DATA) \
$(DESKTOP_IN_FILES)
diff --git a/data/start_here.html b/data/start_here.html
deleted file mode 100644
index 73a0e908e..000000000
--- a/data/start_here.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<html>
-<head>
-</head>
-<body>
-<h1>Welcome ...</h1>
-<h2>Smart Bookmarks</h2>
-<p>
-Right click the icon and choose "Add Bookmark" from the menu list.
-</p>
-<dl>
-<li>
-<a type="text/smartbookmark" href="http://www.google.com/" rel="http://www.google.com/search?q=%s" title="Search the web - Google">
-Search the web - Google
-</a>
-</li>
-<li>
-<a type="text/smartbookmark" href="http://images.google.com/" rel="http://images.google.com/images?q=%s" title="Search images - Google">
-Search images - Google
-</a>
-</li>
-</ol>
-</body>
-</html>
diff --git a/data/starthere/Makefile.am b/data/starthere/Makefile.am
new file mode 100644
index 000000000..411c442cf
--- /dev/null
+++ b/data/starthere/Makefile.am
@@ -0,0 +1,12 @@
+@INTLTOOL_XML_RULE@
+
+xmldir = $(pkgdatadir)/starthere
+xml_in_files = index.xml.in
+xml_DATA = $(xml_in_files:.xml.in=.xml)
+
+xsldir = $(pkgdatadir)/starthere
+xsl_DATA = section.xsl
+
+EXTRA_DIST = $(xml_DATA) \
+ $(xml_in_files)
+
diff --git a/data/starthere/index.xml.in b/data/starthere/index.xml.in
new file mode 100644
index 000000000..b24de14f1
--- /dev/null
+++ b/data/starthere/index.xml.in
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="section.xsl"?>
+<section>
+<_title>The web browser</_title>
+<_paragraph>What you use it for ?</_paragraph>
+<_title>Getting started</_title>
+<_paragraph>How I begin ? Import bookmarks, proxy settings</_paragraph>
+</section>
diff --git a/data/starthere/section.xsl b/data/starthere/section.xsl
new file mode 100644
index 000000000..6b349c626
--- /dev/null
+++ b/data/starthere/section.xsl
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0">
+
+<!-- root rule -->
+<xsl:template match="/">
+ <xsl:apply-templates/>
+</xsl:template>
+
+<!-- main rule for document element -->
+<xsl:template match="section">
+<html>
+ <head>
+ </head>
+ <body>
+ <xsl:apply-templates/>
+ </body>
+</html>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/embed/mozilla/StartHereProtocolHandler.cpp b/embed/mozilla/StartHereProtocolHandler.cpp
index 47a1af310..4ea95294c 100644
--- a/embed/mozilla/StartHereProtocolHandler.cpp
+++ b/embed/mozilla/StartHereProtocolHandler.cpp
@@ -17,6 +17,7 @@
*/
#include "ephy-file-helpers.h"
+#include "ephy-start-here.h"
#include "nsCOMPtr.h"
#include "nsIFactory.h"
@@ -26,6 +27,7 @@
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsXPComFactory.h"
+#include "nsIStorageStream.h"
static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
@@ -110,25 +112,47 @@ NS_IMETHODIMP GStartHereProtocolHandler::NewURI(const nsACString &aSpec,
NS_IMETHODIMP GStartHereProtocolHandler::NewChannel(nsIURI *aURI,
nsIChannel **_retval)
{
- nsresult rv;
+ nsresult rv;
+ EphyStartHere *sh;
+ char *buf;
+ PRUint32 bytesWritten;
+
+ mURI = aURI;
- nsCAutoString path;
- rv = aURI->GetPath(path);
- if (NS_FAILED(rv)) return rv;
+ nsCAutoString path;
+ rv = aURI->GetPath(path);
+ if (NS_FAILED(rv)) return rv;
- char *httpSpec = g_strconcat ("file:///",
- ephy_file ("start_here.html"),
- NULL);
-
- if (!httpSpec) return NS_ERROR_OUT_OF_MEMORY;
+ nsCOMPtr<nsIStorageStream> sStream;
+ nsCOMPtr<nsIOutputStream> stream;
+
+ rv = NS_NewStorageStream(16384, (PRUint32)-1, getter_AddRefs(sStream));
+ if (NS_FAILED(rv)) return rv;
- nsCOMPtr<nsIIOService> serv(do_GetIOService(&rv));
- if (NS_FAILED(rv)) return rv;
+ rv = sStream->GetOutputStream(0, getter_AddRefs(stream));
+ if (NS_FAILED(rv)) return rv;
- // now we have an HTTP url, give the user an HTTP channel
- rv = serv->NewChannel(nsDependentCString(httpSpec), nsnull, nsnull, _retval);
+ sh = ephy_start_here_new ();
+ buf = ephy_start_here_get_page (sh, "index");
+ rv = stream->Write (buf, strlen (buf), &bytesWritten);
+ g_free (buf);
+
+ nsCOMPtr<nsIInputStream> iStream;
+ PRUint32 size;
- return rv;
+ rv = sStream->GetLength(&size);
+ if (NS_FAILED(rv)) return rv;
+
+ rv = sStream->NewInputStream(0, getter_AddRefs(iStream));
+ if (NS_FAILED(rv)) return rv;
+
+ rv = NS_NewInputStreamChannel(getter_AddRefs(mChannel), mURI,
+ iStream, NS_LITERAL_CSTRING("text/xml"),
+ NS_LITERAL_CSTRING("utf-8"), size);
+
+ NS_IF_ADDREF (*_retval = mChannel);
+
+ return rv;
}
/* boolean allowPort (in long port, in string scheme); */
diff --git a/lib/Makefile.am b/lib/Makefile.am
index a3c74cd15..7648fe31c 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -43,6 +43,8 @@ libephy_la_SOURCES = \
ephy-prefs.h \
ephy-prefs-utils.c \
ephy-prefs-utils.h \
+ ephy-start-here.c \
+ ephy-start-here.h \
ephy-state.c \
ephy-state.h \
ephy-string.c \
diff --git a/lib/widgets/ephy-autocompletion-window.c b/lib/widgets/ephy-autocompletion-window.c
index 9c639a52a..a070c282a 100644
--- a/lib/widgets/ephy-autocompletion-window.c
+++ b/lib/widgets/ephy-autocompletion-window.c
@@ -650,8 +650,8 @@ hack_tree_view_move_selection (GtkTreeView *tv, GtkTreeView *alternate, int dir)
GtkTreeSelection *ts = gtk_tree_view_get_selection (tv);
GtkTreeModel *model;
GList *selected = NULL;
- selected = gtk_tree_selection_get_selected_rows (ts, &model);
gboolean prev_result = TRUE;
+ selected = gtk_tree_selection_get_selected_rows (ts, &model);
gtk_tree_selection_unselect_all (ts);
diff --git a/po/POTFILES.in b/po/POTFILES.in
index b2e3047ca..688f550e9 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -3,6 +3,7 @@
data/GNOME_Epiphany_Automation.server.in
data/GNOME_Epiphany_NautilusView.server.in
data/epiphany.desktop.in
+data/starthere/index.xml.in
data/epiphany.schemas.in
data/glade/epiphany.glade
data/glade/prefs-dialog.glade