Gentoo Archives: gentoo-commits

From: "Nirbheek Chauhan (nirbheek)" <nirbheek@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-util/devhelp/files: devhelp-0.23-fix-anchor-links.patch
Date: Fri, 26 Jun 2009 08:17:49
Message-Id: E1MK6d1-0001u9-RH@stork.gentoo.org
1 nirbheek 09/06/26 08:17:47
2
3 Added: devhelp-0.23-fix-anchor-links.patch
4 Log:
5 Fix bug 272886
6 (Portage version: 2.2_rc33/cvs/Linux i686)
7
8 Revision Changes Path
9 1.1 dev-util/devhelp/files/devhelp-0.23-fix-anchor-links.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-util/devhelp/files/devhelp-0.23-fix-anchor-links.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-util/devhelp/files/devhelp-0.23-fix-anchor-links.patch?rev=1.1&content-type=text/plain
13
14 Index: devhelp-0.23-fix-anchor-links.patch
15 ===================================================================
16 From af67fbedccab5044808a489a9f3a5540d42adcf2 Mon Sep 17 00:00:00 2001
17 From: Enrico Tröge <enrico.troeger@×××××.de>
18 Date: Thu, 19 Feb 2009 10:02:43 +0000
19 Subject: Use file: URIs instead of local paths, fixes use with more recent webkit
20
21 2009-02-19 Enrico Tröge <enrico.troeger@×××××.de>
22
23 * src/dh-assistant-view.c: (assistant_view_set_link):
24 * src/dh-book-tree.c: (book_tree_find_uri_foreach):
25 * src/dh-link.c: (link_free), (dh_link_new):
26 * src/dh-link.h: Use file: URIs instead of local paths, fixes use
27 with more recent webkit versions.
28
29 svn path=/trunk/; revision=1265
30 ---
31 Gentoo bug 272886
32 ---
33 --- a/src/dh-assistant-view.c
34 +++ b/src/dh-assistant-view.c
35 @@ -169,6 +169,7 @@ assistant_view_set_link (DhAssistantView *view,
36 gsize length;
37 gchar *key;
38 gsize key_length;
39 + gsize offset = 0;
40 const gchar *start;
41 const gchar *end;
42
43 @@ -203,7 +204,10 @@ assistant_view_set_link (DhAssistantView *view,
44 return;
45 }
46
47 - file = g_mapped_file_new (filename, FALSE, NULL);
48 + if (g_str_has_prefix (filename, "file://"))
49 + offset = 7;
50 +
51 + file = g_mapped_file_new (filename + offset, FALSE, NULL);
52 if (!file) {
53 g_free (filename);
54 return;
55 @@ -326,7 +330,7 @@ assistant_view_set_link (DhAssistantView *view,
56 * anchor links are handled internally in webkit.
57 */
58 tmp = g_path_get_dirname (filename);
59 - base = g_strconcat ("file://", tmp, "/fake", NULL);
60 + base = g_strconcat (tmp, "/fake", NULL);
61 g_free (tmp);
62
63 webkit_web_view_load_html_string (
64 --- a/src/dh-book-tree.c
65 +++ b/src/dh-book-tree.c
66 @@ -245,22 +245,14 @@ book_tree_find_uri_foreach (GtkTreeModel *model,
67 FindURIData *data)
68 {
69 DhLink *link;
70 - const gchar *uri;
71 gchar *link_uri;
72
73 gtk_tree_model_get (model, iter,
74 COL_LINK, &link,
75 -1);
76
77 - /* A bit hackish, could be made more generic. */
78 - if (g_str_has_prefix (data->uri, "file://")) {
79 - uri = data->uri + 7;
80 - } else {
81 - uri = data->uri;
82 - }
83 -
84 link_uri = dh_link_get_uri (link);
85 - if (g_str_has_prefix (uri, link_uri)) {
86 + if (g_str_has_prefix (data->uri, link_uri)) {
87 data->found = TRUE;
88 data->iter = *iter;
89 data->path = gtk_tree_path_copy (path);
90 diff --git a/src/dh-link.c b/src/dh-link.c
91 index 230af73..f320daa 100644
92 --- a/src/dh-link.c
93 +++ b/src/dh-link.c
94 @@ -33,7 +33,7 @@ struct _DhLink {
95 gchar *base;
96
97 gchar *name;
98 - gchar *uri;
99 + gchar *filename;
100
101 DhLink *book;
102 DhLink *page;
103 @@ -64,7 +64,7 @@ link_free (DhLink *link)
104 g_free (link->base);
105 g_free (link->id);
106 g_free (link->name);
107 - g_free (link->uri);
108 + g_free (link->filename);
109
110 if (link->book) {
111 dh_link_unref (link->book);
112 @@ -83,12 +83,12 @@ dh_link_new (DhLinkType type,
113 const gchar *name,
114 DhLink *book,
115 DhLink *page,
116 - const gchar *uri)
117 + const gchar *filename)
118 {
119 DhLink *link;
120
121 g_return_val_if_fail (name != NULL, NULL);
122 - g_return_val_if_fail (uri != NULL, NULL);
123 + g_return_val_if_fail (filename != NULL, NULL);
124
125 if (type == DH_LINK_TYPE_BOOK) {
126 g_return_val_if_fail (base != NULL, NULL);
127 @@ -110,7 +110,7 @@ dh_link_new (DhLinkType type,
128 }
129
130 link->name = g_strdup (name);
131 - link->uri = g_strdup (uri);
132 + link->filename = g_strdup (filename);
133
134 if (book) {
135 link->book = dh_link_ref (book);
136 @@ -205,11 +205,16 @@ dh_link_get_book_id (DhLink *link)
137 gchar *
138 dh_link_get_uri (DhLink *link)
139 {
140 - if (link->type == DH_LINK_TYPE_BOOK) {
141 - return g_strconcat (link->base, "/", link->uri, NULL);
142 - }
143 + gchar *base, *uri;
144 +
145 + if (link->type == DH_LINK_TYPE_BOOK)
146 + base = link->base;
147 + else
148 + base = link->book->base;
149 +
150 + uri = g_strconcat ("file://", base, "/", link->filename, NULL, NULL);
151
152 - return g_strconcat (link->book->base, "/", link->uri, NULL);
153 + return uri;
154 }
155
156 DhLinkType
157 --- a/src/dh-link.h
158 +++ b/src/dh-link.h
159 @@ -51,7 +51,7 @@ DhLink * dh_link_new (DhLinkType type,
160 const gchar *name,
161 DhLink *book,
162 DhLink *page,
163 - const gchar *uri);
164 + const gchar *filename);
165 void dh_link_free (DhLink *link);
166 gint dh_link_compare (gconstpointer a,
167 gconstpointer b);
168 --
169 cgit v0.8.2