[yelp] [yelp-mallard-document] Show .page.stub files in editor mode
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp] [yelp-mallard-document] Show .page.stub files in editor mode
- Date: Thu, 1 Apr 2010 22:15:51 +0000 (UTC)
commit d9b3ebf1b5209b874bd358209935da555178c7a2
Author: Shaun McCance <shaunm gnome org>
Date: Thu Apr 1 13:23:23 2010 -0500
[yelp-mallard-document] Show .page.stub files in editor mode
libyelp/yelp-mallard-document.c | 15 +++++++++++++--
libyelp/yelp-settings.c | 27 ++++++++++++++++++++++++---
libyelp/yelp-settings.h | 1 +
stylesheets/mal2html.xsl.in | 10 +++++++++-
4 files changed, 47 insertions(+), 6 deletions(-)
---
diff --git a/libyelp/yelp-mallard-document.c b/libyelp/yelp-mallard-document.c
index 12f89ec..da1b22f 100644
--- a/libyelp/yelp-mallard-document.c
+++ b/libyelp/yelp-mallard-document.c
@@ -275,11 +275,14 @@ mallard_think (YelpMallardDocument *mallard)
GError *error = NULL;
YelpDocument *document;
gchar **search_path;
+ gboolean editor_mode;
GFile *gfile;
GFileEnumerator *children;
GFileInfo *pageinfo;
+ editor_mode = yelp_settings_get_editor_mode (yelp_settings_get_default ());
+
search_path = yelp_uri_get_search_path (priv->uri);
if (!search_path || search_path[0] == NULL ||
@@ -306,7 +309,8 @@ mallard_think (YelpMallardDocument *mallard)
GFile *pagefile;
filename = g_file_info_get_attribute_as_string (pageinfo,
G_FILE_ATTRIBUTE_STANDARD_NAME);
- if (!g_str_has_suffix (filename, ".page")) {
+ if (!g_str_has_suffix (filename, ".page") &&
+ !(editor_mode && g_str_has_suffix (filename, ".page.stub"))) {
g_free (filename);
g_object_unref (pageinfo);
continue;
@@ -637,7 +641,14 @@ mallard_page_data_run (MallardPageData *page_data)
(GCallback) transform_error,
page_data);
- params = yelp_settings_get_all_params (settings, 0, NULL);
+ if (g_str_has_suffix (page_data->filename, ".page.stub")) {
+ gint end;
+ params = yelp_settings_get_all_params (settings, 2, &end);
+ params[end++] = g_strdup ("yelp.stub");
+ params[end++] = g_strdup ("true()");
+ }
+ else
+ params = yelp_settings_get_all_params (settings, 0, NULL);
yelp_transform_start (page_data->transform,
page_data->xmldoc,
diff --git a/libyelp/yelp-settings.c b/libyelp/yelp-settings.c
index 29e5948..1f838d6 100644
--- a/libyelp/yelp-settings.c
+++ b/libyelp/yelp-settings.c
@@ -63,7 +63,8 @@ enum {
PROP_GTK_SETTINGS,
PROP_GTK_ICON_THEME,
PROP_FONT_ADJUSTMENT,
- PROP_SHOW_TEXT_CURSOR
+ PROP_SHOW_TEXT_CURSOR,
+ PROP_EDITOR_MODE
};
gchar *icon_names[YELP_SETTINGS_NUM_ICONS];
@@ -174,7 +175,15 @@ yelp_settings_class_init (YelpSettingsClass *klass)
FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_NAME |
G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-
+
+ g_object_class_install_property (object_class,
+ PROP_EDITOR_MODE,
+ g_param_spec_boolean ("editor-mode",
+ _("Editor Mode"),
+ _("Enable features useful to editors"),
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
settings_signals[COLORS_CHANGED] =
g_signal_new ("colors-changed",
@@ -259,6 +268,9 @@ yelp_settings_get_property (GObject *object,
case PROP_SHOW_TEXT_CURSOR:
g_value_set_boolean (value, settings->priv->show_text_cursor);
break;
+ case PROP_EDITOR_MODE:
+ g_value_set_boolean (value, settings->priv->editor_mode);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -353,6 +365,9 @@ yelp_settings_set_property (GObject *object,
case PROP_SHOW_TEXT_CURSOR:
settings->priv->show_text_cursor = g_value_get_boolean (value);
break;
+ case PROP_EDITOR_MODE:
+ settings->priv->editor_mode = g_value_get_boolean (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -669,11 +684,17 @@ yelp_settings_set_show_text_cursor (YelpSettings *settings,
g_object_set (settings, "show-text-cursor", show, NULL);
}
+gboolean
+yelp_settings_get_editor_mode (YelpSettings *settings)
+{
+ return settings->priv->editor_mode;
+}
+
void
yelp_settings_set_editor_mode (YelpSettings *settings,
gboolean editor_mode)
{
- settings->priv->editor_mode = editor_mode;
+ g_object_set (settings, "editor-mode", editor_mode, NULL);
}
/******************************************************************************/
diff --git a/libyelp/yelp-settings.h b/libyelp/yelp-settings.h
index 6a23044..0c8fbd0 100644
--- a/libyelp/yelp-settings.h
+++ b/libyelp/yelp-settings.h
@@ -122,6 +122,7 @@ gboolean yelp_settings_get_show_text_cursor (YelpSettings *sett
void yelp_settings_set_show_text_cursor (YelpSettings *settings,
gboolean show);
+gboolean yelp_settings_get_editor_mode (YelpSettings *settings);
void yelp_settings_set_editor_mode (YelpSettings *settings,
gboolean editor_mode);
diff --git a/stylesheets/mal2html.xsl.in b/stylesheets/mal2html.xsl.in
index 38a6e8e..0794925 100644
--- a/stylesheets/mal2html.xsl.in
+++ b/stylesheets/mal2html.xsl.in
@@ -10,7 +10,7 @@
<xsl:include href="yelp-common.xsl"/>
-<xsl:param name="yelp.javascript"/>
+<xsl:param name="yelp.stub" select="false()"/>
<xsl:param name="mal2html.editor_mode" select="$yelp.editor_mode"/>
@@ -84,6 +84,14 @@ div.version {
}
div.version:hover { opacity: 1.0; }
</xsl:text>
+<xsl:if test="$yelp.stub">
+<xsl:text>
+body, div.body {
+ background-color: </xsl:text>
+ <xsl:value-of select="$theme.color.red_background"/><xsl:text>;
+}
+</xsl:text>
+</xsl:if>
</xsl:if>
</xsl:template>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]