## TeplWindowState TeplWindowState — Handle GtkWindow state settings |

## Functions

void | tepl_window_state_init ()

## Includes

    #include <tepl/tepl.h>

## Description

A utility for GtkWindow. It permits to handle and remember some of its state:

- Its size.

- Whether it is maximized.

It is especially useful for the main window of an application, where it is generally desirable to restore the state.

It is assumed that GSettings is used. When creating the first window, the initial state is taken from the provided GSettings keys. When a window is closed the GSettings are saved. When opening another window of the same type, its initial state is copied from the last focused window of that type.

## Functions

### tepl_window_state_init ()

    void
    tepl_window_state_init (GtkWindow *window,
                            GSettings *settings,
                            GType window_type);

When creating a new GtkWindow, you can call this function to initialize some of its state. Then things will be taken care of to remember the state.

The provided GSettings object must have at least these keys:

- `"maximized"` of type boolean.

- `"width"` of type integer.

- `"height"` of type integer.

The `window_type` (for example a subclass of GtkApplicationWindow for the main window) permits to use this utility for different types of windows. Each window type will need its own set of GSettings keys (in a different sub-schema because the key names must be the same).

A good place to call this function is in the GObject ``init()`` function.

#### Parameters

window | a GtkWindow. |
settings | a GSettings object. |
window_type | the type of GtkWindow. |

Since: 6.12