DhBookList

DhBookList — Base class for a list of DhBook's

Functions

Signals

void add-book Run Last
void remove-book Run Last

Types and Values

struct DhBookList
struct DhBookListClass

Object Hierarchy

    GObject
    ╰── DhBookList
        ╰── DhBookListDirectory

Includes

#include <devhelp/devhelp.h>

Description

DhBookList is a base class for a list of DhBook's.

The default implementation maintains an internal GList when books are added and removed with the “add-book” and “remove-book” signals, and returns that GList in dh_book_list_get_books().

The DhBookList base class doesn't listen to the DhBook “deleted” and “updated” signals. It is for example handled by DhBookListDirectory.

Functions

dh_book_list_new ()

DhBookList *
dh_book_list_new (void);

Returns

a new empty DhBookList object.

[transfer full]

Since: 3.30


dh_book_list_get_default ()

DhBookList *
dh_book_list_get_default (void);

Gets the default DhBookList object. It is created with DhBookListBuilder, dh_book_list_builder_add_default_sub_book_lists() is called, and dh_book_list_builder_read_books_disabled_setting() is called with the default DhSettings object as returned by dh_settings_get_default().

Returns

the default DhBookList object.

[transfer none]

Since: 3.30


dh_book_list_get_books ()

GList *
dh_book_list_get_books (DhBookList *book_list);

Gets the list of DhBook's part of book_list , in no particular order. Each book ID in the list is unique (see dh_book_get_id()).

Parameters

book_list

a DhBookList.

 

Returns

the GList of DhBook's part of book_list .

[transfer none][element-type DhBook]

Since: 3.30


dh_book_list_add_book ()

void
dh_book_list_add_book (DhBookList *book_list,
                       DhBook *book);

Emits the “add-book” signal.

It is a programmer error to call this function if book is already inserted in book_list .

Parameters

book_list

a DhBookList.

 

book

a DhBook.

 

Since: 3.30


dh_book_list_remove_book ()

void
dh_book_list_remove_book (DhBookList *book_list,
                          DhBook *book);

Emits the “remove-book” signal.

It is a programmer error to call this function if book is not present in book_list .

Parameters

book_list

a DhBookList.

 

book

a DhBook.

 

Since: 3.30

Types and Values

struct DhBookList

struct DhBookList;

struct DhBookListClass

struct DhBookListClass {
        GObjectClass parent_class;

        /* Signals */
        void    (* add_book)            (DhBookList *book_list,
                                         DhBook     *book);

        void    (* remove_book)         (DhBookList *book_list,
                                         DhBook     *book);

        /* Vfuncs */
        GList * (* get_books)           (DhBookList *book_list);
};

Members

add_book ()

Virtual function pointer for the “add-book” signal.

 

remove_book ()

Virtual function pointer for the “remove-book” signal.

 

get_books ()

Virtual function pointer for dh_book_list_get_books(). Returns the DhBookList internal GList by default. If you override this vfunc ensure that each book ID is unique in the returned list.

 

Signal Details

The “add-book” signal

void
user_function (DhBookList *book_list,
               DhBook     *book,
               gpointer    user_data)

The ::add-book signal is emitted when a DhBook is added to a DhBookList.

The default object method handler adds book to the internal GList of book_list after verifying that book is not already present in the list.

Parameters

book_list

the DhBookList emitting the signal.

 

book

the DhBook being added.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 3.30


The “remove-book” signal

void
user_function (DhBookList *book_list,
               DhBook     *book,
               gpointer    user_data)

The ::remove-book signal is emitted when a DhBook is removed from a DhBookList.

The default object method handler removes book from the internal GList of book_list , and verifies that book was present in the list and that book was not inserted several times.

Parameters

book_list

the DhBookList emitting the signal.

 

book

the DhBook being removed.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 3.30