## TeplApplicationWindow

TeplApplicationWindow — An extension of GtkApplicationWindow

## Functions

TeplApplicationWindow * | tepl_application_window_get_from_gtk_application_window ()
GtkApplicationWindow * | tepl_application_window_get_application_window ()
void | tepl_application_window_set_tab_group ()
gboolean | tepl_application_window_is_main_window ()
GtkWindowGroup * | tepl_application_window_get_window_group ()
gboolean | tepl_application_window_get_handle_title ()
void | tepl_application_window_set_handle_title ()
void | tepl_application_window_open_file ()

## Properties

GtkApplicationWindow * | application-window | Read / Write / Construct Only
gboolean | handle-title | Read / Write / Construct

## Types and Values

struct | TeplApplicationWindow

## Object Hierarchy

        GObject
        ╰── TeplApplicationWindow

## Implemented Interfaces

TeplApplicationWindow implements TeplTabGroup.

## Includes

    #include <tepl/tepl.h>

## Description

TeplApplicationWindow extends the GtkApplicationWindow class.

An application needs to call `tepl_application_window_set_tab_group()` to benefit from the TeplTabGroup interface implemented by this class.

Note that TeplApplicationWindow extends the GtkApplicationWindow class but without subclassing it, because several libraries might want to extend GtkApplicationWindow and an application needs to be able to use all those extensions at the same time.

### GActions

This class adds the following GAction's to the GtkApplicationWindow. Corresponding AmtkActionInfo's are available with `tepl_application_get_tepl_action_info_store()`.

#### For the File menu

- `"win.tepl-new-file"`: creates a new TeplTab, appends it with `tepl_tab_group_append_tab()` and set it as the active tab.

- `"win.tepl-open"`: shows a GtkFileChooser to open a new file.

- `"win.tepl-save"`: saves the current file.

- `"win.tepl-save-as"`: shows a GtkFileChooser to save the current file to a different location.

#### For the Edit menu

- `"win.tepl-undo"`: calls `gtk_source_buffer_undo()` on the active buffer.

- `"win.tepl-redo"`: calls `gtk_source_buffer_redo()` on the active buffer.

The following actions require the `AMTK_FACTORY_IGNORE_ACCELS_FOR_APP` flag, because otherwise accelerators don't work in other text widgets than the active view (e.g. in a GtkEntry):

- `"win.tepl-cut"`: calls `tepl_view_cut_clipboard()` on the active view.

- `"win.tepl-copy"`: calls `tepl_view_copy_clipboard()` on the active view.

- `"win.tepl-paste"`: calls `tepl_view_paste_clipboard()` on the active view.

- `"win.tepl-delete"`: calls `tepl_view_delete_selection()` on the active view.

- `"win.tepl-select-all"`: calls `tepl_view_select_all()` on the active view.

- `"win.tepl-indent"`: calls `gtk_source_view_indent_lines()` on the selected text of the active view.

- `"win.tepl-unindent"`: calls `gtk_source_view_unindent_lines()` on the selected text of the active view.

See the `tepl_menu_shell_append_edit_actions()` convenience function.

#### For the Search menu

- `"win.tepl-goto-line"`: shows the TeplGotoLineBar of all TeplTab's belonging to TeplApplicationWindow. Even though each TeplTab has a different TeplGotoLineBar, all TeplGotoLineBar's of the TeplTabGroup have their “visible” state synchronized, so when one TeplGotoLineBar is hidden, all the other TeplGotoLineBar's are hidden as well. The user may think that there is only one TeplGotoLineBar per window, with the TeplGotoLineBar remembering a different state (mainly the content of the GtkSearchEntry) for each TeplTab. To remember the state for each TeplTab, the easiest is to have a different widget for each TeplTab, hence the current implementation.

## Functions

### tepl_application_window_get_from_gtk_application_window ()

    TeplApplicationWindow *
    tepl_application_window_get_from_gtk_application_window
                                   (GtkApplicationWindow *gtk_window);

Returns the TeplApplicationWindow of `gtk_window` . The returned object is guaranteed to be the same for the lifetime of `gtk_window` .

#### Parameters

gtk_window | a GtkApplicationWindow. |

#### Returns

the TeplApplicationWindow of `gtk_window` .

[transfer none]

Since: 2.0

### tepl_application_window_get_application_window ()

    GtkApplicationWindow *
    tepl_application_window_get_application_window
                                   (TeplApplicationWindow *tepl_window);

#### Parameters

tepl_window | a TeplApplicationWindow. |

#### Returns

the GtkApplicationWindow of `tepl_window` .

[transfer none]

Since: 2.0

### tepl_application_window_set_tab_group ()

    void
    tepl_application_window_set_tab_group (TeplApplicationWindow *tepl_window,
                                           TeplTabGroup *tab_group);

Sets the TeplTabGroup of `tepl_window` . This function can be called only once, it is not possible to change the TeplTabGroup afterwards (this restriction may be lifted in the future if there is a compelling use-case).

TeplApplicationWindow implements the TeplTabGroup interface by delegating the requests to `tab_group` .

#### Parameters

tepl_window | a TeplApplicationWindow. |
tab_group | a TeplTabGroup. |

Since: 3.0

### tepl_application_window_is_main_window ()

    gboolean
    tepl_application_window_is_main_window
                                   (GtkApplicationWindow *gtk_window);

Returns `TRUE` iff `gtk_window` has an associated TeplTabGroup (i.e. if `tepl_application_window_set_tab_group()` has been called).

This function takes a GtkApplicationWindow parameter to avoid creating the TeplApplicationWindow object if it hasn't been created.

#### Parameters

gtk_window | a GtkApplicationWindow. |

#### Returns

whether `gtk_window` is considered a main application window.

Since: 4.0

### tepl_application_window_get_window_group ()

    GtkWindowGroup *
    tepl_application_window_get_window_group
                                   (TeplApplicationWindow *tepl_window);

Gets the GtkWindowGroup in which `tepl_window` resides.

You should call this function only on main windows, to add secondary windows to the GtkWindowGroup.

#### Parameters

tepl_window | a TeplApplicationWindow. |

#### Returns

the GtkWindowGroup.

[transfer none]

Since: 4.0

### tepl_application_window_get_handle_title ()

    gboolean
    tepl_application_window_get_handle_title
                                   (TeplApplicationWindow *tepl_window);

#### Parameters

tepl_window | a TeplApplicationWindow. |

#### Returns

the value of the “handle-title” property.

Since: 4.0

### tepl_application_window_set_handle_title ()

    void
    tepl_application_window_set_handle_title
                                   (TeplApplicationWindow *tepl_window,
                                    gboolean handle_title);

Sets the “handle-title” property.

#### Parameters

tepl_window | a TeplApplicationWindow. |
handle_title | the new value. |

Since: 4.0

### tepl_application_window_open_file ()

    void
    tepl_application_window_open_file (TeplApplicationWindow *tepl_window,
                                       GFile *location,
                                       gboolean jump_to);

Opens a file in `tepl_window` . If the active tab is untouched (see `tepl_buffer_is_untouched()`), then the file is loaded in that tab. Otherwise a new tab is created.

This function is asynchronous, the file loading is done with the `tepl_tab_load_file()` function. There is no way to know when the file loading is finished.

#### Parameters

tepl_window | a TeplApplicationWindow. |
location | a GFile. |
jump_to | whether to set the tab where the file is loaded as the active tab. |

Since: 4.0

## Types and Values

### struct TeplApplicationWindow

    struct TeplApplicationWindow;

## Property Details

### The `“application-window”` property

      “application-window”       GtkApplicationWindow *

The GtkApplicationWindow.

Owner: TeplApplicationWindow

Flags: Read / Write / Construct Only

Since: 2.0

### The `“handle-title”` property

      “handle-title”             gboolean

Whether to handle the “title”. The title is probably not appropriate if a GtkHeaderBar is used, the title is meant to be used only for applications with a traditional UI.

If `TRUE`, the title will contain:

- the “tepl-full-title” of the active buffer.

- if the active view is not “editable”, the `"[Read-Only]"` string.

- the application name as returned by `g_get_application_name()`.

If the active view is `NULL`, the title contains only the application name.

Owner: TeplApplicationWindow

Flags: Read / Write / Construct

Default value: FALSE

Since: 4.0