TeplApplication: Tepl 5 Reference Manual

## TeplApplication TeplApplication — An extension of GtkApplication |

## Functions

TeplApplication * | tepl_application_get_from_gtk_application ()
TeplApplication * | tepl_application_get_default ()
GtkApplication * | tepl_application_get_application ()
AmtkActionInfoStore * | tepl_application_get_app_action_info_store ()
AmtkActionInfoStore * | tepl_application_get_tepl_action_info_store ()
GtkApplicationWindow * | tepl_application_get_active_main_window ()
void | tepl_application_open_simple ()
void | tepl_application_handle_activate ()
void | tepl_application_handle_open ()
void | tepl_application_handle_metadata ()

## Properties

GtkApplication * | application | Read / Write / Construct Only

## Types and Values

struct | TeplApplication

## Object Hierarchy

        GObject
        ╰── TeplApplication

## Includes

    #include <tepl/tepl.h>

## Description

TeplApplication extends the GtkApplication class.

For some features, the Tepl framework gets the default GtkApplication with `g_application_get_default()`, for example to call `g_application_hold()`, `g_application_mark_busy()`, etc. Normally a GTK application has only one GApplication per process, so this shouldn't cause any problem.

Note that TeplApplication extends the GtkApplication class but without subclassing it, because several libraries might want to extend GtkApplication 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 GtkApplication. Corresponding AmtkActionInfo's are available with `tepl_application_get_tepl_action_info_store()`.

#### For the File menu

- `"app.tepl-new-window"`: creates a new main window with `tepl_abstract_factory_create_main_window()`.

## Functions

### tepl_application_get_from_gtk_application ()

    TeplApplication *
    tepl_application_get_from_gtk_application
                                   (GtkApplication *gtk_app);

Returns the TeplApplication of `gtk_app` . The returned object is guaranteed to be the same for the lifetime of `gtk_app` .

#### Parameters

gtk_app | a GtkApplication. |

#### Returns

the TeplApplication of `gtk_app` .

[transfer none]

Since: 2.0

### tepl_application_get_default ()

    TeplApplication *
    tepl_application_get_default (void);

Convenience function that calls `g_application_get_default()` followed by `tepl_application_get_from_gtk_application()`. The object returned by `g_application_get_default()` must be a GtkApplication.

#### Returns

the default TeplApplication.

[transfer none]

Since: 2.0

### tepl_application_get_application ()

    GtkApplication *
    tepl_application_get_application (TeplApplication *tepl_app);

#### Parameters

tepl_app | a TeplApplication. |

#### Returns

the GtkApplication of `tepl_app` .

[transfer none]

Since: 2.0

### tepl_application_get_app_action_info_store ()

    AmtkActionInfoStore *
    tepl_application_get_app_action_info_store
                                   (TeplApplication *tepl_app);

Returns an initially empty AmtkActionInfoStore reserved for the application-specific actions. Libraries should not add AmtkActionInfo's to this store. Libraries should provide their own store if they want to share AmtkActionInfo's.

#### Parameters

tepl_app | a TeplApplication. |

#### Returns

the AmtkActionInfoStore reserved for the application.

[transfer none]

Since: 2.0

### tepl_application_get_tepl_action_info_store ()

    AmtkActionInfoStore *
    tepl_application_get_tepl_action_info_store
                                   (TeplApplication *tepl_app);

The returned AmtkActionInfoStore contains AmtkActionInfo's for all the GAction's listed in the class description of TeplApplicationWindow and the class description of TeplApplication.

#### Parameters

tepl_app | a TeplApplication. |

#### Returns

the AmtkActionInfoStore of the Tepl library.

[transfer none]

Since: 3.0

### tepl_application_get_active_main_window ()

    GtkApplicationWindow *
    tepl_application_get_active_main_window
                                   (TeplApplication *tepl_app);

Like `gtk_application_get_active_window()`, but returns the main window in the sense of `tepl_application_window_is_main_window()`.

#### Parameters

tepl_app | a TeplApplication. |

#### Returns

the active main GtkApplicationWindow, or `NULL`.

[transfer none][nullable]

Since: 4.0

### tepl_application_open_simple ()

    void
    tepl_application_open_simple (TeplApplication *tepl_app,
                                  GFile *file);

Calls `g_application_open()` with a single file and an empty hint.

#### Parameters

tepl_app | a TeplApplication. |
file | a GFile. |

Since: 2.0

### tepl_application_handle_activate ()

    void
    tepl_application_handle_activate (TeplApplication *tepl_app);

Connects a generic function handler for the “activate” signal.

If no main windows exist, it creates one with `tepl_abstract_factory_create_main_window()`. If a main window already exists, it calls `gtk_window_present()` on the most recently focused window of the application.

#### Parameters

tepl_app | a TeplApplication. |

Since: 4.0

### tepl_application_handle_open ()

    void
    tepl_application_handle_open (TeplApplication *tepl_app);

Connects a generic function handler for the “open” signal.

It calls `tepl_application_window_open_file()` for each GFile to open, on the active main window as returned by `tepl_application_get_active_main_window()`. If the active main window is `NULL`, it creates one with `tepl_abstract_factory_create_main_window()`.

#### Parameters

tepl_app | a TeplApplication. |

Since: 4.0

### tepl_application_handle_metadata ()

    void
    tepl_application_handle_metadata (TeplApplication *tepl_app);

This function:

- Connects to the “startup” signal to call `tepl_metadata_manager_load_from_disk()`.

- Connects to the “shutdown” signal to call `tepl_metadata_manager_save_to_disk()` with `trim` set to `TRUE`.

It gets the GFile by calling `tepl_abstract_factory_create_metadata_manager_file()`.

#### Parameters

tepl_app | a TeplApplication. |

Since: 5.0

## Types and Values

### struct TeplApplication

    struct TeplApplication;

## Property Details

### The `“application”` property

      “application”              GtkApplication *

The GtkApplication.

Owner: TeplApplication

Flags: Read / Write / Construct Only

Since: 2.0