[epiphany] Move default bookmarks to separate rdf file instead of hard-coded values



commit 72b49fe58f5feaa36ae4851415a76588793f1510
Author: Vincent Untz <vuntz gnome org>
Date:   Thu Jul 30 12:51:48 2009 +0200

    Move default bookmarks to separate rdf file instead of hard-coded values
    
    Bug #300190

 data/Makefile.am               |   15 ++++++++++++++-
 data/default-bookmarks.rdf.in  |   23 +++++++++++++++++++++++
 po/POTFILES.in                 |    1 +
 src/bookmarks/Makefile.am      |    1 +
 src/bookmarks/ephy-bookmarks.c |   23 +----------------------
 5 files changed, 40 insertions(+), 23 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index ec74a1e..e17a252 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -42,6 +42,17 @@ service_DATA = $(service_in_files:.service.in=.service)
 $(service_DATA): $(service_in_files) Makefile
 	@sed -e "s|\ bindir\@|$(bindir)|" $< > $@
 
+# Default bookmarks
+# We don't put translations in the resulting rdf since the code can get
+# the translations via gettext (although it can also get translations
+# from the rdf if they are there and not available via gettext)
+default_bookmarksdir = $(pkgdatadir)
+default_bookmarks_in_files = default-bookmarks.rdf.in
+default_bookmarks_DATA = $(default_bookmarks_in_files:.rdf.in=.rdf)
+$(default_bookmarks_DATA): $(default_bookmarks_in_files) Makefile $(INTLTOOL_MERGE)
+	LC_ALL=C $(INTLTOOL_MERGE) -x -u /tmp $< $  tmp
+	sed -e "s|\ pkgdatadir\@|$(pkgdatadir)|g" $  tmp > $@ || rm -f $  tmp
+	rm -f $  tmp
 
 install-data-local: $(schema_DATA)
 if GCONF_SCHEMAS_INSTALL
@@ -63,6 +74,7 @@ EXTRA_DIST = \
 	$(xsl_DATA)			\
 	$(service_DATA)			\
 	$(m4data_DATA)			\
+	$(default_bookmarks_in_files)	\
 	epiphany-service.xml		\
 	check-mime.py
 
@@ -70,4 +82,5 @@ DISTCLEANFILES = \
 	$(service_DATA)		\
 	$(schema_in_files:.schemas.in=.schemas)	\
 	$(pkgconfig_DATA)	\
-	$(desktop_DATA)
+	$(desktop_DATA)		\
+	$(default_bookmarks_DATA)
diff --git a/data/default-bookmarks.rdf.in b/data/default-bookmarks.rdf.in
new file mode 100644
index 0000000..5c23ea6
--- /dev/null
+++ b/data/default-bookmarks.rdf.in
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<rdf:RDF xmlns="http://purl.org/rss/1.0/"; xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:ephy="http://gnome.org/ns/epiphany#"; xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";>
+  <channel rdf:about="file://@pkgdatadir@/default-bookmarks.rdf">
+    <title>Epiphany bookmarks</title>
+    <link>http://www.gnome.org/projects/epiphany/</link>
+    <items>
+      <rdf:Seq>
+        <rdf:li rdf:resource="http://www.google.com"/>
+      </rdf:Seq>
+    </items>
+  </channel>
+  <item rdf:about="http://www.google.com";>
+    <_title>Search the web</_title>
+    <!-- Translators you should change these links to respect your locale.
+         For instance in .nl these should be
+	 "http://www.google.nl"; and "http://www.google.nl/search?q=%s"; -->
+    <_link>http://www.google.com</_link>
+    <!-- Translators you should change these links to respect your locale.
+         For instance in .nl these should be
+	 "http://www.google.nl"; and "http://www.google.nl/search?q=%s"; -->
+    <_ephy:smartlink>http://www.google.com/search?q=%s&amp;ie=UTF-8&amp;oe=UTF-8</_ephy:smartlink>
+  </item>
+</rdf:RDF>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 1137436..d29c2ce 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -2,6 +2,7 @@
 # List of source files containing translatable strings.
 # Please keep this file sorted alphabetically.
 data/bme.desktop.in.in
+[type: gettext/xml] data/default-bookmarks.rdf.in
 data/epiphany.desktop.in.in
 data/epiphany-lockdown.schemas.in
 data/epiphany.schemas.in
diff --git a/src/bookmarks/Makefile.am b/src/bookmarks/Makefile.am
index bf87823..5266445 100644
--- a/src/bookmarks/Makefile.am
+++ b/src/bookmarks/Makefile.am
@@ -111,6 +111,7 @@ libephybookmarks_la_CPPFLAGS = \
 	-I$(top_srcdir)/embed		\
 	-I$(top_srcdir)/lib/widgets	\
 	-I$(top_srcdir)/lib/egg		\
+	-DDATADIR=\""$(pkgdatadir)"\" 	\
 	$(AM_CPPFLAGS)
 
 libephybookmarks_la_CFLAGS = \
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index c8f06d2..81137c7 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -94,21 +94,6 @@ struct _EphyBookmarksPrivate
 #endif
 };
 
-typedef struct
-{
-	const char *title;
-	const char *location;
-} EphyBookmarksBookmarkInfo;
-
-static const EphyBookmarksBookmarkInfo default_bookmarks [] =
-{
-	/* Translators you should change these links to respect your locale.
-	 * For instance in .nl these should be
-	 * "http://www.google.nl"; and "http://www.google.nl/search?q=%s";
-	 */
-	{ N_("Search the web"), N_("http://www.google.com/search?q=%s&ie=UTF-8&oe=UTF-8";) }
-};
-
 static const char *default_topics [] =
 {
 	N_("Entertainment"),
@@ -152,13 +137,7 @@ ephy_bookmarks_init_defaults (EphyBookmarks *eb)
 		ephy_bookmarks_add_keyword (eb, _(default_topics[i]));
 	}
 
-	for (i = 0; i < G_N_ELEMENTS (default_bookmarks); i++)
-	{
-		EphyNode *bmk;
-
-		bmk = ephy_bookmarks_add (eb, _(default_bookmarks[i].title),
-					  _(default_bookmarks[i].location));
-	}
+	ephy_bookmarks_import_rdf (eb, DATADIR "/default-bookmarks.rdf");
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]