[devhelp/wip/book-list] BookListBuilder: read optionally the "books-disabled" GSettings key
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp/wip/book-list] BookListBuilder: read optionally the "books-disabled" GSettings key
- Date: Thu, 26 Apr 2018 16:20:40 +0000 (UTC)
commit 55881c44a6ce6a35817943818e27f3a885daafd8
Author: Sébastien Wilmet <swilmet gnome org>
Date: Thu Apr 26 18:16:10 2018 +0200
BookListBuilder: read optionally the "books-disabled" GSettings key
devhelp/dh-book-list-builder.c | 35 ++++++++++++++++++++++++++++++++++-
devhelp/dh-book-list-builder.h | 5 +++++
docs/reference/devhelp-sections.txt | 1 +
3 files changed, 40 insertions(+), 1 deletions(-)
---
diff --git a/devhelp/dh-book-list-builder.c b/devhelp/dh-book-list-builder.c
index fdceccf..75a3e0c 100644
--- a/devhelp/dh-book-list-builder.c
+++ b/devhelp/dh-book-list-builder.c
@@ -39,6 +39,8 @@
struct _DhBookListBuilderPrivate {
/* List of DhBookList*. */
GList *sub_book_lists;
+
+ DhSettings *settings;
};
G_DEFINE_TYPE_WITH_PRIVATE (DhBookListBuilder, dh_book_list_builder, G_TYPE_OBJECT)
@@ -51,6 +53,8 @@ dh_book_list_builder_dispose (GObject *object)
g_list_free_full (builder->priv->sub_book_lists, g_object_unref);
builder->priv->sub_book_lists = NULL;
+ g_clear_object (&builder->priv->settings);
+
G_OBJECT_CLASS (dh_book_list_builder_parent_class)->dispose (object);
}
@@ -108,6 +112,34 @@ dh_book_list_builder_add_sub_book_list (DhBookListBuilder *builder,
}
/**
+ * dh_book_list_builder_read_books_disabled_setting:
+ * @builder: a #DhBookListBuilder.
+ * @settings: (nullable): a #DhSettings, or %NULL.
+ *
+ * Sets the #DhSettings object from which to read the "books-disabled"
+ * #GSettings key. If @settings is %NULL or if this function isn't called, then
+ * the #DhBookList object that will be created with
+ * dh_book_list_builder_create_object() will not read a "books-disabled"
+ * setting.
+ *
+ * With #DhBookListBuilder it is not possible to read the "books-disabled"
+ * settings from several #DhSettings objects and combine them. Only the last
+ * call to this function is taken into account when creating the #DhBookList
+ * with dh_book_list_builder_create_object().
+ *
+ * Since: 3.30
+ */
+void
+dh_book_list_builder_read_books_disabled_setting (DhBookListBuilder *builder,
+ DhSettings *settings)
+{
+ g_return_if_fail (DH_IS_BOOK_LIST_BUILDER (builder));
+ g_return_if_fail (settings == NULL || DH_IS_SETTINGS (settings));
+
+ g_set_object (&builder->priv->settings, settings);
+}
+
+/**
* dh_book_list_builder_create_object:
* @builder: a #DhBookListBuilder.
*
@@ -122,5 +154,6 @@ dh_book_list_builder_create_object (DhBookListBuilder *builder)
{
g_return_val_if_fail (DH_IS_BOOK_LIST_BUILDER (builder), NULL);
- return _dh_book_list_simple_new (builder->priv->sub_book_lists, NULL);
+ return _dh_book_list_simple_new (builder->priv->sub_book_lists,
+ builder->priv->settings);
}
diff --git a/devhelp/dh-book-list-builder.h b/devhelp/dh-book-list-builder.h
index 9cb0cc0..7acd816 100644
--- a/devhelp/dh-book-list-builder.h
+++ b/devhelp/dh-book-list-builder.h
@@ -23,6 +23,7 @@
#include <glib-object.h>
#include <devhelp/dh-book-list.h>
+#include <devhelp/dh-settings.h>
G_BEGIN_DECLS
@@ -57,6 +58,10 @@ DhBookListBuilder * dh_book_list_builder_new (void);
void dh_book_list_builder_add_sub_book_list (DhBookListBuilder *builder,
DhBookList *sub_book_list);
+void dh_book_list_builder_read_books_disabled_setting
+ (DhBookListBuilder *builder,
+ DhSettings *settings);
+
DhBookList * dh_book_list_builder_create_object (DhBookListBuilder *builder);
G_END_DECLS
diff --git a/docs/reference/devhelp-sections.txt b/docs/reference/devhelp-sections.txt
index 5e1c47a..c63257b 100644
--- a/docs/reference/devhelp-sections.txt
+++ b/docs/reference/devhelp-sections.txt
@@ -73,6 +73,7 @@ dh_book_list_get_type
DhBookListBuilder
dh_book_list_builder_new
dh_book_list_builder_add_sub_book_list
+dh_book_list_builder_read_books_disabled_setting
dh_book_list_builder_create_object
<SUBSECTION Standard>
DH_BOOK_LIST_BUILDER
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]