OBS User unknown 2008-08-02 01:15:52 +00:00 committed by Git OBS Bridge
parent 0bb9930e3d
commit c072ab2d7d
4 changed files with 350 additions and 33 deletions

View File

@ -0,0 +1,298 @@
Index: src/bookmarks/ephy-bookmarks-import.c
===================================================================
--- src/bookmarks/ephy-bookmarks-import.c (révision 8368)
+++ src/bookmarks/ephy-bookmarks-import.c (copie de travail)
@@ -812,49 +812,65 @@ ephy_bookmarks_import_xbel (EphyBookmark
return ret >= 0 ? TRUE : FALSE;
}
-#define OLD_RDF_TEMPORARY_HACK
-
static void
-parse_rdf_subjects (xmlNodePtr node,
- GList **subjects)
+parse_rdf_lang_tag (xmlNode *child,
+ xmlChar **value,
+ int *best_match)
{
- xmlChar *subject;
-
-#ifdef OLD_RDF_TEMPORARY_HACK
- xmlNode *child;
+ const char * const *locales;
+ char *this_language;
+ xmlChar *lang;
+ xmlChar *content;
+ int i;
+
+ if (*best_match == 0)
+ /* there's no way we can do better */
+ return;
+
+ locales = g_get_language_names ();
+
+ content = xmlNodeGetContent (child);
+ if (!content)
+ return;
- child = node->children;
-
- while (child != NULL)
+ lang = xmlNodeGetLang (child);
+ if (lang == NULL)
{
- if (xmlStrEqual (child->name, (xmlChar *) "Bag"))
- {
- child = child->children;
-
- while (child != NULL)
- {
- if (xmlStrEqual (child->name, (xmlChar *) "li"))
- {
- subject = xmlNodeGetContent (child);
- *subjects = g_list_append (*subjects, subject);
- }
+ const char *translated;
- child = child->next;
- }
+ translated = _((char *) content);
+ if ((char *) content != translated)
+ {
+ /* if we have a translation for the content of the
+ * node, then we just use this */
+ if (*value) xmlFree (*value);
+ *value = (xmlChar *) g_strdup (translated);
+ *best_match = 0;
+ xmlFree (content);
return;
}
- child = child->next;
+ this_language = "C";
}
-#endif
+ else
+ this_language = (char *) lang;
- subject = xmlNodeGetContent (node);
- if (subject)
- {
- *subjects = g_list_append (*subjects, subject);
+ for (i = 0; locales[i] && i < *best_match; i++) {
+ if (!strcmp (locales[i], this_language)) {
+ /* if we've already encountered a less accurate
+ * translation, then free it */
+ if (*value) xmlFree (*value);
+
+ *value = xmlNodeGetContent (child);
+ *best_match = i;
+
+ break;
+ }
}
+
+ if (lang) xmlFree (lang);
}
static void
@@ -862,43 +878,59 @@ parse_rdf_item (EphyBookmarks *bookmarks
xmlNodePtr node)
{
xmlChar *title = NULL;
+ int best_match_title = INT_MAX;
xmlChar *link = NULL;
+ int best_match_link = INT_MAX;
+ /* we consider that it's better to use a non-localized smart link than
+ * a localized link */
+ gboolean use_smartlink = FALSE;
+ xmlChar *subject = NULL;
GList *subjects = NULL, *l = NULL;
xmlNode *child;
- EphyNode *bmk;
+ EphyNode *bmk = NULL;
child = node->children;
-#ifdef OLD_RDF_TEMPORARY_HACK
link = xmlGetProp (node, (xmlChar *) "about");
-#endif
while (child != NULL)
{
if (xmlStrEqual (child->name, (xmlChar *) "title"))
{
- title = xmlNodeGetContent (child);
+ parse_rdf_lang_tag (child, &title, &best_match_title);
}
-#ifndef OLD_RDF_TEMPORARY_HACK
- else if (xmlStrEqual (child->name, (xmlChar *) "link"))
+ else if (xmlStrEqual (child->name, (xmlChar *) "link") &&
+ !use_smartlink)
{
- link = xmlNodeGetContent (child);
+ parse_rdf_lang_tag (child, &link, &best_match_link);
}
-#endif
- else if (xmlStrEqual (child->name, (xmlChar *) "subject"))
+ else if (child->ns &&
+ xmlStrEqual (child->ns->prefix, (xmlChar *) "ephy") &&
+ xmlStrEqual (child->name, (xmlChar *) "smartlink"))
{
- parse_rdf_subjects (child, &subjects);
+ if (!use_smartlink)
+ {
+ use_smartlink = TRUE;
+ best_match_link = INT_MAX;
+ }
+
+ parse_rdf_lang_tag (child, &link, &best_match_link);
}
- else if (xmlStrEqual (child->name, (xmlChar *) "smartlink"))
+ else if (child->ns &&
+ xmlStrEqual (child->ns->prefix, (xmlChar *) "dc") &&
+ xmlStrEqual (child->name, (xmlChar *) "subject"))
{
- if (link) xmlFree (link);
- link = xmlNodeGetContent (child);
+ subject = xmlNodeGetContent (child);
+ if (subject)
+ subjects = g_list_prepend (subjects, subject);
}
child = child->next;
}
- bmk = bookmark_add (bookmarks, (char *) title, (char *) link);
+ if (title && link)
+ bmk = bookmark_add (bookmarks, (char *) title, (char *) link);
+
if (bmk)
{
l = subjects;
Index: src/bookmarks/Makefile.am
===================================================================
--- src/bookmarks/Makefile.am (révision 8368)
+++ src/bookmarks/Makefile.am (copie de travail)
@@ -107,6 +107,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 = \
Index: src/bookmarks/ephy-bookmarks.c
===================================================================
--- src/bookmarks/ephy-bookmarks.c (révision 8368)
+++ src/bookmarks/ephy-bookmarks.c (copie de travail)
@@ -101,15 +101,6 @@ typedef struct
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"),
@@ -151,13 +142,7 @@ ephy_bookmarks_init_defaults (EphyBookma
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
Index: data/default-bookmarks.rdf.xml.in
===================================================================
--- data/default-bookmarks.rdf.xml.in (révision 0)
+++ data/default-bookmarks.rdf.xml.in (révision 0)
@@ -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@/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>
Index: data/Makefile.am
===================================================================
--- data/Makefile.am (révision 8368)
+++ data/Makefile.am (copie de travail)
@@ -60,6 +60,17 @@ service_DATA = $(service_in_files:.servi
$(service_DATA): $(service_in_files) Makefile
@sed -e "s|\@bindir\@|$(bindir)|" $< > $@
+# Default bookmarks
+# intltool hack: we name the file .xml.in so that intltool knows it's xml
+# format and can analyze it.
+# 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.xml.in
+default_bookmarks_DATA = $(default_bookmarks_in_files:.rdf.xml.in=.rdf)
+$(default_bookmarks_DATA): $(default_bookmarks_in_files) Makefile
+ @sed -e "s|\@pkgdatadir\@|$(pkgdatadir)|;s|_title|title|g;s|_link|link|g;s|_ephy:smartlink|ephy:smartlink|g" $< > $@
install-data-local: $(schema_DATA)
if GCONF_SCHEMAS_INSTALL
@@ -83,6 +94,7 @@ EXTRA_DIST = \
$(xsl_DATA) \
$(service_DATA) \
$(m4data_DATA) \
+ $(default_bookmarks_in_files) \
epiphany-service.xml \
check-mime.py \
generate-font-schemas.py
@@ -92,4 +104,5 @@ DISTCLEANFILES = \
$(schema_in_files:.schemas.in=.schemas) \
$(pkgconfig_DATA) \
$(default_prefs_DATA) \
- $(desktop_DATA)
+ $(desktop_DATA) \
+ $(default_bookmarks_DATA)
Index: po/POTFILES.in
===================================================================
--- po/POTFILES.in (révision 8368)
+++ po/POTFILES.in (copie de travail)
@@ -2,6 +2,7 @@
# List of source files containing translatable strings.
# Please keep this file sorted alphabetically.
data/bme.desktop.in.in
+data/default-bookmarks.rdf.xml.in
data/epiphany.desktop.in.in
data/epiphany-lockdown.schemas.in
data/epiphany.schemas.in

View File

@ -1,29 +0,0 @@
Index: epiphany-2.19.6/data/epiphany-bookmarks-html.xsl
===================================================================
--- epiphany-2.19.6.orig/data/epiphany-bookmarks-html.xsl
+++ epiphany-2.19.6/data/epiphany-bookmarks-html.xsl
@@ -51,7 +51,7 @@ $Id: epiphany-bookmarks-html.xsl 6952 20
<dt><a href="{./purl:link}"><xsl:value-of select="./purl:title" /></a></dt>
</xsl:for-each>
- <!-- Force a linebreak; otherwise thinks will break for Topics with only 1 item -->
+ <!-- Force a linebreak; otherwise things will break for Topics with only 1 item -->
<xsl:text>
</xsl:text>
</dl></dt>
Index: epiphany-2.19.6/src/bookmarks/ephy-bookmarks.c
===================================================================
--- epiphany-2.19.6.orig/src/bookmarks/ephy-bookmarks.c
+++ epiphany-2.19.6/src/bookmarks/ephy-bookmarks.c
@@ -102,7 +102,10 @@ static const EphyBookmarksBookmarkInfo d
* 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") }
+ { N_("Search the web"), N_("http://www.google.com/search?q=%s&ie=UTF-8&oe=UTF-8") },
+ { N_("openSUSE News"), N_("http://news.opensuse.org/") }
+ /* I'm not sure how to do this properly, or if you even can:
+ { N_("openSUSE News Feed"), N_("http://news.opensuse.org/?feed=rss2") } */
};
static const char *default_topics [] =

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Wed Jul 30 03:29:27 CEST 2008 - vuntz@novell.com
- Add epiphany-bgo300190-default-bookmarks.patch to specify
default bookmarks via a RDF file. (bgo#300190)
- Remove epiphany-default-bookmarks.patch: this will go in a
separate branding package.
- Add epiphany-branding-upstream package.
-------------------------------------------------------------------
Fri Jul 18 13:34:47 CEST 2008 - rodrigo@suse.de

View File

@ -30,7 +30,7 @@ Requires: mozilla => %{mozilla_ver}
%endif
%endif
Version: 2.22.2
Release: 10
Release: 24
Requires: %{name}-lang = %{version}
License: GPL v2 or later
Group: Productivity/Networking/Web/Browsers
@ -38,13 +38,14 @@ Summary: GNOME Web Browser Based on the Mozilla Rendering Engine
Source: %{name}-%{version}.tar.bz2
# PATCH-FIX-OPENSUSE epiphany-browser-plugins.patch bnc222861 -- Handle suse specific plugins dir
Patch1: epiphany-browser-plugins.patch
# PATCH-FIX-OPENSUSE epiphany-default-bookmarks.patch bnc293690 -- openSUSE specific bookmarks
Patch2: epiphany-default-bookmarks.patch
# PATCH-FIX-OPENSUSE epiphany-libtool.patch -- Create libtool before use
Patch4: epiphany-libtool.patch
# PATCH-FEATURE-UPSTREAM epiphany-bgo300190-default-bookmarks.patch bgo300190 vuntz@novell.com -- Use rdf to specify default bookmarks
Patch5: epiphany-bgo300190-default-bookmarks.patch
Url: http://www.gnome.org/projects/epiphany/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires: python-gtk python-gnome iso-codes gnome-icon-theme
Requires: %{name}-branding
AutoReqProv: on
%gconf_schemas_prereq
@ -99,6 +100,33 @@ This package contains developer documentation for epiphany.
Authors:
--------
Marco Pesenti Gritti <marco@gnome.org>
Xan Lopez <xan@gnome.org>
Christian Persch <chpe@gnome.org>
Adam Hooper <adamh@cvs.gnome.org>
Jean-François Rameau <jframeau@cvs.gnome.org>
Crispin Flowerday <crispin@flowerday.cx>
%package branding-upstream
License: GPL v2 or later
Summary: Upstream branding of Epiphany
Group: Productivity/Networking/Web/Browsers
Provides: %{name}-branding = %{version}
Supplements: packageand(branding-upstream:%{name})
#BRAND: Provide a few files -
#BRAND: /usr/share/epiphany/default-bookmarks.rdf
#BRAND: the default bookmarks
#BRAND: /usr/share/epiphany/chrome/branding/brand.dtd
#BRAND: /usr/share/epiphany/chrome/branding/brand.properties
#BRAND: branding information that can be patched
%description branding-upstream
This package provides upstream Look and Feel for Epiphany.
Authors:
--------
Marco Pesenti Gritti <marco@gnome.org>
@ -112,8 +140,8 @@ Authors:
%prep
%setup -q
%patch1
%patch2 -p1
%patch4
%patch5
%build
#cp -i data/default-prefs-gecko-1-8.js data/default-prefs-xulrunner.js
@ -186,7 +214,18 @@ rm -rf $RPM_BUILD_ROOT
%defattr(-,root,root)
%{_datadir}/gtk-doc/html/epiphany
%files branding-upstream
%defattr(-,root,root)
%{_datadir}/epiphany/default-bookmarks.rdf
%{_datadir}/epiphany/chrome/branding/*
%changelog
* Wed Jul 30 2008 vuntz@novell.com
- Add epiphany-bgo300190-default-bookmarks.patch to specify
default bookmarks via a RDF file. (bgo#300190)
- Remove epiphany-default-bookmarks.patch: this will go in a
separate branding package.
- Add epiphany-branding-upstream package.
* Fri Jul 18 2008 rodrigo@suse.de
- Fixed tagging of patches
* Wed Jun 18 2008 maw@suse.de