Hello community, here is the log from the commit of package yelp checked in at Wed Apr 19 13:52:12 CEST 2006. -------- --- GNOME/yelp/yelp.changes 2006-04-05 13:15:13.000000000 +0200 +++ STABLE/yelp/yelp.changes 2006-04-19 08:52:31.000000000 +0200 @@ -1,0 +2,5 @@ +Wed Apr 19 08:50:08 CEST 2006 - hpj@suse.de + +- Added a patch to pick up the SUSE manuals if present. + +------------------------------------------------------------------- New: ---- yelp-2.14.0-process-suse-manuals.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yelp.spec ++++++ --- /var/tmp/diff_new_pack.gC8ezT/_old 2006-04-19 13:51:45.000000000 +0200 +++ /var/tmp/diff_new_pack.gC8ezT/_new 2006-04-19 13:51:45.000000000 +0200 @@ -19,7 +19,7 @@ Group: System/GUI/GNOME Autoreqprov: on Version: 2.14.0 -Release: 9 +Release: 14 Summary: The GNOME 2.x Desktop Help Browser Source: ftp://ftp.gnome.org/pub/GNOME/sources/yelp/2.12/%{name}-%{version}.tar.bz2 Source1: help-title.png @@ -31,6 +31,7 @@ Patch5: yelp-desktop.patch Patch6: yelp-2.13.5-use-susehelp.patch Patch7: yelp-beagle-signal-and-ref-fixes.patch +Patch8: yelp-2.14.0-process-suse-manuals.patch PreReq: filesystem gconf2 Requires: gnome-doc-utils Requires: libbeagle >= 0.2.0 @@ -58,6 +59,7 @@ %patch5 %patch6 -p1 %patch7 +%patch8 -p1 %build rename no nb po/no.* @@ -107,6 +109,8 @@ %{prefix}/share/icons/hicolor/192x192/apps/yelp-icon-big.png %changelog -n yelp +* Wed Apr 19 2006 - hpj@suse.de +- Added a patch to pick up the SUSE manuals if present. * Wed Apr 05 2006 - hpj@suse.de - Updated patch to be better at finding HTML index files. * Sun Mar 19 2006 - hpj@suse.de ++++++ yelp-2.14.0-process-suse-manuals.patch ++++++ diff -upr yelp-2.14.0-pre/src/yelp-toc-pager.c yelp-2.14.0-post/src/yelp-toc-pager.c --- yelp-2.14.0-pre/src/yelp-toc-pager.c 2006-04-18 22:10:49.000000000 -0500 +++ yelp-2.14.0-post/src/yelp-toc-pager.c 2006-04-19 00:32:46.000000000 -0500 @@ -137,6 +137,7 @@ static GtkTreeModel * toc_pager_get_sect static gboolean toc_process_pending (YelpTocPager *pager); +static gboolean process_suse_manuals (YelpTocPager *pager); static gboolean process_libmenu (YelpTocPager *pager); static gboolean process_libmenu_node (YelpTocPager *pager); static gboolean process_xslt (YelpTocPager *pager); @@ -374,6 +375,7 @@ toc_process_pending (YelpTocPager *pager static ProcessFunction process_funcs[] = { process_libmenu, process_libmenu_node, + process_suse_manuals, process_xslt, #ifdef ENABLE_SCROLLKEEPER process_read_menu, @@ -470,6 +472,143 @@ pop_stack_frame (YelpTocPager *pager) priv->libmenu_stack = g_slist_delete_link (priv->libmenu_stack, priv->libmenu_stack); } +static gchar * +suse_manual_make_meta_path (const gchar *language) +{ + return g_strdup_printf ("/usr/share/susehelp/meta/suselinux-manual_%s", language); +} + +static gchar * +suse_manual_make_desktop_path (const gchar *language) +{ + gchar *meta_path; + gchar *desktop_path; + + meta_path = suse_manual_make_meta_path (language); + desktop_path = g_strdup_printf ("%s/.directory", meta_path); + g_free (meta_path); + + return desktop_path; +} + +static gchar * +suse_manual_make_index_path (const gchar *language) +{ + return g_strdup_printf ("/usr/share/doc/manual/suselinux-manual_%s/manual/index.html", language); +} + +static const gchar *common_desktop_entry_group = "Desktop Entry"; +static const gchar *kde_desktop_entry_group = "KDE Desktop Entry"; + +static gchar * +suse_manual_get_title (const gchar *language) +{ + GKeyFile *key_file; + gchar *desktop_path; + const gchar *desktop_entry_group; + gchar *title = NULL; + gboolean result; + + desktop_path = suse_manual_make_desktop_path (language); + + key_file = g_key_file_new (); + result = g_key_file_load_from_file (key_file, desktop_path, 0, NULL); + + g_free (desktop_path); + + if (!result) + goto out; + + desktop_entry_group = common_desktop_entry_group; + + if (!g_key_file_has_group (key_file, desktop_entry_group)) { + desktop_entry_group = kde_desktop_entry_group; + + if (!g_key_file_has_group (key_file, desktop_entry_group)) + goto out; + } + + title = g_key_file_get_locale_string (key_file, desktop_entry_group, "Name", NULL, NULL); + if (!title) { + /* Work around desktop files that don't have a C locale name */ + title = g_key_file_get_string (key_file, desktop_entry_group, "Name", NULL); + } + + if (!title) { + /* Same, different approach */ + title = g_key_file_get_locale_string (key_file, desktop_entry_group, "Name", language, NULL); + } + + if (!title) { + /* Last ditch, just make something up */ + title = g_strdup_printf ("SUSE Linux Documentation (%s)", language); + } + +out: + g_key_file_free (key_file); + return title; +} + +static xmlNode * +process_suse_manual (const gchar *language) +{ + gchar *title = NULL; + gchar *path = NULL; + xmlNode *node = NULL; + + title = suse_manual_get_title (language); + if (!title) + goto out; + + path = suse_manual_make_index_path (language); + if (!g_file_test (path, G_FILE_TEST_IS_REGULAR)) + goto out; + + node = xmlNewNode (NULL, "doc"); + xmlNewNsProp (node, NULL, "href", path); + xmlNewTextChild (node, NULL, "title", title); + +out: + g_free (title); + g_free (path); + return node; +} + +static gboolean +process_suse_manuals (YelpTocPager *pager) +{ + YelpTocPagerPriv *priv = YELP_TOC_PAGER (pager)->priv; + xmlNode *root_element; + gboolean found_manuals = FALSE; + gint i; + + static const gchar *language [] = + { + "cs", "de", "en", "es", "fr", "it", "ja", "pt_BR", "zh_CN", "zh_TW", NULL + }; + + /* process_libmenu_node () insists on setting this up */ + g_assert (priv->toc_doc); + + root_element = xmlDocGetRootElement (priv->toc_doc); + + for (i = 0; language [i]; i++) { + xmlNode *node; + + node = process_suse_manual (language [i]); + if (!node) + continue; + + xmlAddChild (root_element, node); + + /* We don't use this for anything right now, but it could come in handy + * if we want to put manuals in a branch. */ + found_manuals = TRUE; + } + + return FALSE; /* Don't run again */ +} + static GTimer *timer; /* iterator points to next node to process and is incremented at the end of the function. NULL means finished with this level. Parent ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun...
participants (1)
-
root@suse.de