## DhSidebar DhSidebar — The sidebar |

## Functions

GtkWidget * | dh_sidebar_new ()
DhSidebar * | dh_sidebar_new2 ()
DhProfile * | dh_sidebar_get_profile ()
DhLink * | dh_sidebar_get_selected_link ()
void | dh_sidebar_select_uri ()
void | dh_sidebar_set_search_string ()
void | dh_sidebar_set_search_focus ()

## Properties

DhProfile * | profile | Read / Write / Construct Only

## Signals

void | link-selected | Run Last

## Types and Values

struct | DhSidebar

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GtkContainer
                    ╰── GtkGrid
                        ╰── DhSidebar

## Implemented Interfaces

DhSidebar implements AtkImplementorIface, GtkBuildable and GtkOrientable.

## Includes

    #include <devhelp/devhelp.h>

## Description

In the Devhelp application, there is one DhSidebar per main window, displayed in the left side panel.

A DhSidebar contains:

- a GtkSearchEntry at the top;

- a DhBookTree (a subclass of GtkTreeView);

- another GtkTreeView (displaying a list, not a tree) with a DhKeywordModel as its model.

When the GtkSearchEntry is empty, the DhBookTree is shown. When the GtkSearchEntry is not empty, it shows the search results in the other GtkTreeView. The two GtkTreeView's cannot be both visible at the same time, it's either one or the other.

DhSidebar emits the “link-selected” signal. When that happens, the Devhelp application opens the DhLink in a WebKitWebView shown at the right side of the main window.

## Functions

### dh_sidebar_new ()

    GtkWidget *
    dh_sidebar_new (DhBookManager *book_manager);

`dh_sidebar_new` has been deprecated since version 3.30 and should not be used in newly-written code.

Use `dh_sidebar_new2()` instead.

#### Parameters

book_manager | a DhBookManager. This parameter is deprecated, you should just pass `NULL`. | [nullable]

#### Returns

a new DhSidebar widget.

[transfer floating]

### dh_sidebar_new2 ()

    DhSidebar *
    dh_sidebar_new2 (DhProfile *profile);

#### Parameters

profile | a DhProfile, or `NULL` for the default profile. | [nullable]

#### Returns

a new DhSidebar widget.

[transfer floating]

Since: 3.30

### dh_sidebar_get_profile ()

    DhProfile *
    dh_sidebar_get_profile (DhSidebar *sidebar);

#### Parameters

sidebar | a DhSidebar. |

#### Returns

the DhProfile of `sidebar` .

[transfer none]

Since: 3.30

### dh_sidebar_get_selected_link ()

    DhLink *
    dh_sidebar_get_selected_link (DhSidebar *sidebar);

Note: the return value of this function is not necessarily the same as the last DhLink emitted by the “link-selected” signal. See the documentation of “link-selected”.

#### Parameters

sidebar | a DhSidebar. |

#### Returns

the currently selected DhLink in the visible GtkTreeView of `sidebar` , or `NULL` if the selection is empty or if a language group row is selected. Unref with `dh_link_unref()` when no longer needed.

[transfer full][nullable]

Since: 3.30

### dh_sidebar_select_uri ()

    void
    dh_sidebar_select_uri (DhSidebar *sidebar,
                           const gchar *uri);

Calls `dh_book_tree_select_uri()`.

#### Parameters

sidebar | a DhSidebar. |
uri | the URI to select. |

### dh_sidebar_set_search_string ()

    void
    dh_sidebar_set_search_string (DhSidebar *sidebar,
                                  const gchar *str);

#### Parameters

sidebar | a DhSidebar. |
str | the string to search. |

### dh_sidebar_set_search_focus ()

    void
    dh_sidebar_set_search_focus (DhSidebar *sidebar);

Gives the focus to the search entry.

#### Parameters

sidebar | a DhSidebar. |

## Types and Values

### struct DhSidebar

    struct DhSidebar;

## Property Details

### The `“profile”` property

      “profile”                  DhProfile *

The DhProfile. If set to `NULL`, the default profile as returned by `dh_profile_get_default()` is used.

Flags: Read / Write / Construct Only

Since: 3.30

## Signal Details

### The `“link-selected”` signal

    void
    user_function (DhSidebar *sidebar,
                   DhLink    *link,
                   gpointer   user_data)

The ::link-selected signal is emitted when:

1. One row in one of the GtkTreeView's is selected and contains a DhLink (i.e. when the row is not a language group);

2. Or if there is an exact match returned by `dh_keyword_model_filter()` when a search occurs.

Note that `dh_sidebar_get_selected_link()` takes into account only the former, not the latter. So the last `link` emitted with this signal is not necessarily the same as the current return value of `dh_sidebar_get_selected_link()`.

#### Parameters

sidebar | a DhSidebar. |
link | the selected DhLink. |
user_data | user data set when the signal handler was connected. |

Flags: Run Last