## DhBook DhBook — A book, usually the documentation for one library |

## Functions

DhBook * | dh_book_new ()
GFile * | dh_book_get_index_file ()
const gchar * | dh_book_get_id ()
const gchar * | dh_book_get_title ()
const gchar * | dh_book_get_language ()
GList * | dh_book_get_links ()
GNode * | dh_book_get_tree ()
DhCompletion * | dh_book_get_completion ()
gint | dh_book_cmp_by_id ()
gint | dh_book_cmp_by_title ()

## Signals

void | deleted | Run Last
void | updated | Run Last

## Types and Values

struct | DhBook

## Object Hierarchy

        GObject
        ╰── DhBook

## Includes

    #include <devhelp/devhelp.h>

## Description

A DhBook usually contains the documentation for one library (or application), for example GLib or GTK+. A DhBook corresponds to one index file. An index file is a file with the extension `*.devhelp`, `*.devhelp2`, `*.devhelp.gz` or `*.devhelp2.gz`.

DhBook creates a GFileMonitor on the index file, and emits the “updated” or “deleted” signal in case the index file has changed on the filesystem. DhBookListDirectory listens to those DhBook signals, and emits in turn the DhBookList “remove-book” and “add-book” signals.

## Functions

### dh_book_new ()

    DhBook *
    dh_book_new (GFile *index_file);

#### Parameters

index_file | the index file. |

#### Returns

a new DhBook object, or `NULL` if parsing the index file failed.

[nullable]

### dh_book_get_index_file ()

    GFile *
    dh_book_get_index_file (DhBook *book);

#### Parameters

book | a DhBook. |

#### Returns

the index file.

[transfer none]

### dh_book_get_id ()

    const gchar *
    dh_book_get_id (DhBook *book);

Gets the book ID. In the Devhelp index file format version 2, it is actually the “name”, not the ID, but “book ID” is clearer, “book name” can be confused with the title.

#### Parameters

book | a DhBook. |

#### Returns

the book ID.

### dh_book_get_title ()

    const gchar *
    dh_book_get_title (DhBook *book);

#### Parameters

book | a DhBook. |

#### Returns

the book title.

### dh_book_get_language ()

    const gchar *
    dh_book_get_language (DhBook *book);

#### Parameters

book | a DhBook. |

#### Returns

the programming language used in `book` .

### dh_book_get_links ()

    GList *
    dh_book_get_links (DhBook *book);

#### Parameters

book | a DhBook. |

#### Returns

the list of all DhLink's part of `book` .

[element-type DhLink][transfer none]

### dh_book_get_tree ()

    GNode *
    dh_book_get_tree (DhBook *book);

Gets the general structure of the book, as a tree. The tree contains only DhLink's of type `DH_LINK_TYPE_BOOK` or `DH_LINK_TYPE_PAGE`. The other DhLink's are not contained in the tree. To have a list of all DhLink's part of the book, you need to call `dh_book_get_links()`.

#### Parameters

book | a DhBook. |

#### Returns

the tree of DhLink's part of `book` .

[transfer none]

### dh_book_get_completion ()

    DhCompletion *
    dh_book_get_completion (DhBook *book);

#### Parameters

book | a DhBook. |

#### Returns

the DhCompletion of `book` .

[transfer none]

Since: 3.28

### dh_book_cmp_by_id ()

    gint
    dh_book_cmp_by_id (DhBook *a,
                       DhBook *b);

Compares the DhBook's by their IDs, with `g_ascii_strcasecmp()`.

#### Parameters

a | a DhBook. |
b | a DhBook. |

#### Returns

an integer less than, equal to, or greater than zero, if `a` is <, == or > than `b` .

### dh_book_cmp_by_title ()

    gint
    dh_book_cmp_by_title (DhBook *a,
                          DhBook *b);

Compares the DhBook's by their title.

#### Parameters

a | a DhBook. |
b | a DhBook. |

#### Returns

an integer less than, equal to, or greater than zero, if `a` is <, == or > than `b` .

## Types and Values

### struct DhBook

    struct DhBook;

## Signal Details

### The `“deleted”` signal

    void
    user_function (DhBook  *book,
                   gpointer user_data)

The ::deleted signal is emitted when the index file has been deleted from the filesystem.

#### Parameters

book | the DhBook emitting the signal. |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“updated”` signal

    void
    user_function (DhBook  *book,
                   gpointer user_data)

The ::updated signal is emitted when the index file has been modified (but the file still exists).

#### Parameters

book | the DhBook emitting the signal. |
user_data | user data set when the signal handler was connected. |

Flags: Run Last