[yelp] Add ability to view text files
- From: Don Scorgie <dscorgie src gnome org>
- To: svn-commits-list gnome org
- Subject: [yelp] Add ability to view text files
- Date: Wed, 29 Apr 2009 15:31:17 -0400 (EDT)
commit e7698c7b903845e8e2719869192cac97e6acfa5e
Author: Josselin Mouette <joss malsain org>
Date: Wed Apr 29 20:30:22 2009 +0100
Add ability to view text files
---
ChangeLog | 8 ++++++++
src/yelp-utils.c | 4 +++-
src/yelp-utils.h | 1 +
src/yelp-window.c | 13 +++++++++++--
4 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index efcc44b..1c69919 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2009-04-29 Don Scorgie <dscorgie src gnome org>
+ * src/yelp-window.c:
+ * src/yelp-utils.c:
+ * src/yelp-utils.h:
+ Add plain text handler
+ Bug #565502 - patch from Josselin Mouette
+
+2009-04-29 Don Scorgie <dscorgie src gnome org>
+
* src/yelp-bookmarks.c:
* src/yelp-window.c:
Convert gnome-config useage to GKeyFile
diff --git a/src/yelp-utils.c b/src/yelp-utils.c
index aa64585..a868628 100644
--- a/src/yelp-utils.c
+++ b/src/yelp-utils.c
@@ -92,6 +92,8 @@ resolve_process_ghelp (char *uri, gchar **result)
type = YELP_RRN_TYPE_HTML;
else if (g_str_equal (mime, "application/xhtml+xml"))
type = YELP_RRN_TYPE_XHTML;
+ else if (g_str_equal (mime, "text/plain"))
+ type = YELP_RRN_TYPE_TEXT;
} else {
gint file_cut = 6;
@@ -209,7 +211,7 @@ resolve_full_file (const gchar *path)
} else if (resolve_is_man_path (path, NULL)) {
type = YELP_RRN_TYPE_MAN;
} else {
- type = YELP_RRN_TYPE_EXTERNAL;
+ type = YELP_RRN_TYPE_TEXT;
}
} else {
type = YELP_RRN_TYPE_EXTERNAL;
diff --git a/src/yelp-utils.h b/src/yelp-utils.h
index faf08e7..d5e482c 100644
--- a/src/yelp-utils.h
+++ b/src/yelp-utils.h
@@ -29,6 +29,7 @@ typedef enum {
YELP_RRN_TYPE_DOC = 0,
YELP_RRN_TYPE_MAN,
YELP_RRN_TYPE_INFO,
+ YELP_RRN_TYPE_TEXT,
YELP_RRN_TYPE_HTML,
YELP_RRN_TYPE_XHTML,
YELP_RRN_TYPE_TOC,
diff --git a/src/yelp-window.c b/src/yelp-window.c
index 462c4fd..7b0524e 100644
--- a/src/yelp-window.c
+++ b/src/yelp-window.c
@@ -1081,6 +1081,7 @@ yelp_window_load (YelpWindow *window, const gchar *uri)
break;
case YELP_RRN_TYPE_HTML:
case YELP_RRN_TYPE_XHTML:
+ case YELP_RRN_TYPE_TEXT:
priv->base_uri = g_strdup ("file:///fakefile");
window_do_load_html (window, real_uri, frag_id, type, TRUE);
break;
@@ -1124,7 +1125,8 @@ yelp_window_load (YelpWindow *window, const gchar *uri)
frag_id = g_strdup ("x-yelp-index");
if (priv->current_document || (priv->current_type == YELP_RRN_TYPE_HTML ||
- priv->current_type == YELP_RRN_TYPE_XHTML))
+ priv->current_type == YELP_RRN_TYPE_XHTML ||
+ priv->current_type == YELP_RRN_TYPE_TEXT))
need_hist = TRUE;
window_setup_window (window, type, real_uri, frag_id,
(gchar *) uri, current_base, need_hist);
@@ -1693,6 +1695,9 @@ window_do_load_html (YelpWindow *window,
case YELP_RRN_TYPE_XHTML:
yelp_html_open_stream (priv->html_view, "application/xhtml+xml");
break;
+ case YELP_RRN_TYPE_TEXT:
+ yelp_html_open_stream (priv->html_view, "text/plain");
+ break;
default:
g_assert_not_reached ();
}
@@ -1820,6 +1825,7 @@ html_frame_selected_cb (YelpHtml *html, gchar *uri, gboolean handled,
switch (window->priv->current_type) {
case YELP_RRN_TYPE_XHTML:
case YELP_RRN_TYPE_HTML:
+ case YELP_RRN_TYPE_TEXT:
handle = TRUE;
break;
default:
@@ -2137,6 +2143,9 @@ window_print_page_cb (GtkAction *action, YelpWindow *window)
case YELP_RRN_TYPE_XHTML:
yelp_html_open_stream (html, "application/xhtml+xml");
break;
+ case YELP_RRN_TYPE_TEXT:
+ yelp_html_open_stream (html, "text/plain");
+ break;
default:
g_assert_not_reached ();
}
@@ -2309,7 +2318,7 @@ history_load_entry (YelpWindow *window, YelpHistoryEntry *entry)
{
g_return_if_fail (YELP_IS_WINDOW (window));
- if (entry->type == YELP_RRN_TYPE_HTML || entry->type == YELP_RRN_TYPE_XHTML) {
+ if (entry->type == YELP_RRN_TYPE_HTML || entry->type == YELP_RRN_TYPE_XHTML || entry->type == YELP_RRN_TYPE_TEXT) {
window_do_load_html (window, entry->uri, entry->frag_id, entry->type, FALSE);
} else {
g_assert (entry->doc != NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]