[devhelp] BookList: add new()



commit e74de2a7b51660c7c85bd5041a7ba33fcea53771
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Apr 27 13:27:36 2018 +0200

    BookList: add new()
    
    It's no longer an abstract class. Instead of creating a subclass it's
    now possible to create a simple DhBookList and fill it externally.

 devhelp/dh-book-list.c              |   12 ++++++++++++
 devhelp/dh-book-list.h              |   14 ++++++++------
 docs/reference/devhelp-sections.txt |    1 +
 3 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/devhelp/dh-book-list.c b/devhelp/dh-book-list.c
index 6012afb..238251e 100644
--- a/devhelp/dh-book-list.c
+++ b/devhelp/dh-book-list.c
@@ -165,6 +165,18 @@ dh_book_list_init (DhBookList *book_list)
 }
 
 /**
+ * dh_book_list_new:
+ *
+ * Returns: (transfer full): a new empty #DhBookList object.
+ * Since: 3.30
+ */
+DhBookList *
+dh_book_list_new (void)
+{
+        return g_object_new (DH_TYPE_BOOK_LIST, NULL);
+}
+
+/**
  * dh_book_list_get_books:
  * @book_list: a #DhBookList.
  *
diff --git a/devhelp/dh-book-list.h b/devhelp/dh-book-list.h
index c2c7c4b..0fcfe3e 100644
--- a/devhelp/dh-book-list.h
+++ b/devhelp/dh-book-list.h
@@ -72,15 +72,17 @@ struct _DhBookListClass {
         gpointer padding[12];
 };
 
-GType   dh_book_list_get_type           (void);
+GType           dh_book_list_get_type           (void);
 
-GList * dh_book_list_get_books          (DhBookList *book_list);
+DhBookList *    dh_book_list_new                (void);
 
-void    dh_book_list_add_book           (DhBookList *book_list,
-                                         DhBook     *book);
+GList *         dh_book_list_get_books          (DhBookList *book_list);
 
-void    dh_book_list_remove_book        (DhBookList *book_list,
-                                         DhBook     *book);
+void            dh_book_list_add_book           (DhBookList *book_list,
+                                                 DhBook     *book);
+
+void            dh_book_list_remove_book        (DhBookList *book_list,
+                                                 DhBook     *book);
 
 G_END_DECLS
 
diff --git a/docs/reference/devhelp-sections.txt b/docs/reference/devhelp-sections.txt
index c63257b..0d9905c 100644
--- a/docs/reference/devhelp-sections.txt
+++ b/docs/reference/devhelp-sections.txt
@@ -54,6 +54,7 @@ dh_book_get_type
 <FILE>dh-book-list</FILE>
 DhBookList
 DhBookListClass
+dh_book_list_new
 dh_book_list_get_books
 dh_book_list_add_book
 dh_book_list_remove_book


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]