## BtEditApplication

BtEditApplication — class for a gtk based buzztrax editor application

## Functions

BtEditApplication * | bt_edit_application_new ()
gboolean | bt_edit_application_new_song ()
gboolean | bt_edit_application_load_song ()
gboolean | bt_edit_application_save_song ()
gboolean | bt_edit_application_run ()
gboolean | bt_edit_application_load_and_run ()
gboolean | bt_edit_application_quit ()
void | bt_edit_application_show_about ()
void | bt_edit_application_show_tip ()
void | bt_edit_application_crash_log_recover ()
void | bt_edit_application_attach_child_window ()
void | bt_edit_application_ui_lock ()
void | bt_edit_application_ui_unlock ()
gboolean | bt_edit_application_is_song_unsaved ()
void | bt_edit_application_set_song_unsaved ()

## Properties

BtIcRegistry * | ic-registry | Read
BtMainWindow * | main-window | Read
BtSong * | song | Read / Write
gboolean | unsaved | Read / Write

## Types and Values

struct | BtEditApplication

## Object Hierarchy

        GObject
        ╰── BtApplication
            ╰── BtEditApplication

## Includes

    #include "bt-edit.h"

## Description

Opens the BtMainWindow and provide application level function like load, save, run and exit.

It also provides functions to invoke some dialogs like about and tips.

The application instance will have exactly one active “song” at a time. I tracks undo/redo-able changes to the song via BtChangeLog and simple flagged changes via the “unsaved” property.

## Functions

### bt_edit_application_new ()

    BtEditApplication *
    bt_edit_application_new (void);

Create a new instance on first call and return a reference later on.

#### Returns

the new singleton instance

### bt_edit_application_new_song ()

    gboolean
    bt_edit_application_new_song (const BtEditApplication *self);

Creates a new blank song instance. If there is a previous song instance it will be freed.

#### Parameters

self | the application instance to create a new song in |

#### Returns

`TRUE` for success

### bt_edit_application_load_song ()

    gboolean
    bt_edit_application_load_song (const BtEditApplication *self,
                                   const char *file_name,
                                   GError **err);

Loads a new song. If there is a previous song instance it will be freed.

#### Parameters

self | the application instance to load a new song in |
file_name | the song filename to load |
err | where to store the error message in case of an error, or `NULL` |

#### Returns

true for success

### bt_edit_application_save_song ()

    gboolean
    bt_edit_application_save_song (const BtEditApplication *self,
                                   const char *file_name,
                                   GError **err);

Saves a song.

#### Parameters

self | the application instance to save a song from |
file_name | the song filename to save |
err | where to store the error message in case of an error, or `NULL` |

#### Returns

true for success

### bt_edit_application_run ()

    gboolean
    bt_edit_application_run (const BtEditApplication *self);

Start the gtk based editor application

#### Parameters

self | the application instance to run |

#### Returns

`TRUE` for success

### bt_edit_application_load_and_run ()

    gboolean
    bt_edit_application_load_and_run (const BtEditApplication *self,
                                      const gchar *input_file_name);

load the file of the supplied name and start the gtk based editor application

#### Parameters

self | the application instance to run |
input_file_name | the file to load initially |

#### Returns

true for success

### bt_edit_application_quit ()

    gboolean
    bt_edit_application_quit (const BtEditApplication *self);

End the application. Eventually asks the user for confirmation.

#### Parameters

self | the application instance to quit |

#### Returns

`TRUE` it ending the application was confirmed

### bt_edit_application_show_about ()

    void
    bt_edit_application_show_about (const BtEditApplication *self);

Shows the applications about window

#### Parameters

self | the application instance |

### bt_edit_application_show_tip ()

    void
    bt_edit_application_show_tip (const BtEditApplication *self);

Shows the tip of the day window

#### Parameters

self | the application instance |

Since: 0.6

### bt_edit_application_crash_log_recover ()

    void
    bt_edit_application_crash_log_recover (const BtEditApplication *self);

Shows the crash-log recover window if we have pending crash logs.

#### Parameters

self | the application instance |

Since: 0.6

### bt_edit_application_attach_child_window ()

    void
    bt_edit_application_attach_child_window
                                   (const BtEditApplication *self,
                                    GtkWindow *window);

The parent and transient relation ship to the applications main-window.

#### Parameters

self | the application instance |
window | a child window (e.g. dialog) |

Since: 0.6

### bt_edit_application_ui_lock ()

    void
    bt_edit_application_ui_lock (const BtEditApplication *self);

Sets the main window insensitive and show a wait cursor.

#### Parameters

self | the application instance |

### bt_edit_application_ui_unlock ()

    void
    bt_edit_application_ui_unlock (const BtEditApplication *self);

Sets the main window sensitive again and unset the wait cursor.

#### Parameters

self | the application instance |

### bt_edit_application_is_song_unsaved ()

    gboolean
    bt_edit_application_is_song_unsaved (const BtEditApplication *self);

Check if the song has unsaved changes.

#### Parameters

self | the application instance |

#### Returns

`TRUE` if there are pending changes

### bt_edit_application_set_song_unsaved ()

    void
    bt_edit_application_set_song_unsaved (const BtEditApplication *self);

Flag unsaved changes in the applications song.

#### Parameters

self | the application instance |

## Types and Values

### struct BtEditApplication

    struct BtEditApplication;

BtApplication subclass for the gtk editor application

## Property Details

### The `“ic-registry”` property

      “ic-registry”              BtIcRegistry *

the interaction controller registry of this application.

Flags: Read

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

      “main-window”              BtMainWindow *

the main window of this application.

Flags: Read

### The `“song”` property

      “song”                     BtSong *

the current song object.

Flags: Read / Write

### The `“unsaved”` property

      “unsaved”                  gboolean

tell whether the current state of the song has been saved.

Flags: Read / Write

Default value: TRUE

## See Also

BtMainWindow