summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-09-25 07:44:05 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-09-25 07:44:05 +0000
commit5af318eebe18cbac3eed9b860fcf997850ad9259 (patch)
tree9a94efb3ff972e0b0045ad687b75e15856284888
parenta2fc9324cf8fe627e54985871159932d6d13a154 (diff)
downloadlibcss-5af318eebe18cbac3eed9b860fcf997850ad9259.tar.gz
libcss-5af318eebe18cbac3eed9b860fcf997850ad9259.tar.bz2
Add API to get/set a stylesheet's disabled state
svn path=/trunk/libcss/; revision=5435
-rw-r--r--include/libcss/stylesheet.h5
-rw-r--r--src/stylesheet.c36
2 files changed, 39 insertions, 2 deletions
diff --git a/include/libcss/stylesheet.h b/include/libcss/stylesheet.h
index 2f433a6..30be5ae 100644
--- a/include/libcss/stylesheet.h
+++ b/include/libcss/stylesheet.h
@@ -27,12 +27,13 @@ css_error css_stylesheet_append_data(css_stylesheet *sheet,
const uint8_t *data, size_t len);
css_error css_stylesheet_data_done(css_stylesheet *sheet);
-/** \todo Need api for setting/clearing disabled flag */
-
css_error css_stylesheet_get_url(css_stylesheet *sheet, const char **url);
css_error css_stylesheet_get_title(css_stylesheet *sheet, const char **title);
css_error css_stylesheet_get_origin(css_stylesheet *sheet, css_origin *origin);
css_error css_stylesheet_get_media(css_stylesheet *sheet, uint32_t *media);
+css_error css_stylesheet_get_disabled(css_stylesheet *sheet, bool *disabled);
+css_error css_stylesheet_set_disabled(css_stylesheet *sheet, bool disabled);
+
#endif
diff --git a/src/stylesheet.c b/src/stylesheet.c
index 159c7a0..b61bb56 100644
--- a/src/stylesheet.c
+++ b/src/stylesheet.c
@@ -199,6 +199,42 @@ css_error css_stylesheet_get_media(css_stylesheet *sheet, uint32_t *media)
return CSS_OK;
}
+/**
+ * Get disabled status of a stylesheet
+ *
+ * \param sheet The stylesheet to consider
+ * \param disabled Pointer to location to receive disabled state
+ * \return CSS_OK on success, appropriate error otherwise
+ */
+css_error css_stylesheet_get_disabled(css_stylesheet *sheet, bool *disabled)
+{
+ if (sheet == NULL || disabled == NULL)
+ return CSS_BADPARM;
+
+ *disabled = sheet->disabled;
+
+ return CSS_OK;
+}
+
+/**
+ * Set a stylesheet's disabled state
+ *
+ * \param sheet The stylesheet to modify
+ * \param disabled The new disabled state
+ * \return CSS_OK on success, appropriate error otherwise
+ */
+css_error css_stylesheet_set_disabled(css_stylesheet *sheet, bool disabled)
+{
+ if (sheet == NULL)
+ return CSS_BADPARM;
+
+ sheet->disabled = disabled;
+
+ /** \todo needs to trigger some event announcing styles have changed */
+
+ return CSS_OK;
+}
+
/******************************************************************************
* Private API below here *
******************************************************************************/