## GeditTab

GeditTab — A document tab

## Functions

void | gedit_tab_load_file ()
void | gedit_tab_load_stream ()
GeditView * | gedit_tab_get_view ()
GeditDocument * | gedit_tab_get_document ()
GeditTab * | gedit_tab_get_from_document ()
GeditTabState | gedit_tab_get_state ()
gboolean | gedit_tab_get_auto_save_enabled ()
void | gedit_tab_set_auto_save_enabled ()
gint | gedit_tab_get_auto_save_interval ()
void | gedit_tab_set_auto_save_interval ()
void | gedit_tab_set_info_bar ()

## Properties

gboolean | autosave | Read / Write
int | autosave-interval | Read / Write
gboolean | can-close | Read
char * | name | Read
GeditTabState | state | Read

## Types and Values

| GeditTab
enum | GeditTabState

## Object Hierarchy

        GEnum
        ╰── GeditTabState
        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GtkContainer
                    ╰── GtkBox
                        ╰── GeditTab

## Implemented Interfaces

GeditTab implements AtkImplementorIface, GtkBuildable and GtkOrientable.

## Description

GeditTab is a GtkContainer that contains a GeditView and can show other widgets such as a TeplInfoBar.

## Functions

### gedit_tab_load_file ()

    void
    gedit_tab_load_file (GeditTab *tab,
                         GFile *location,
                         const GtkSourceEncoding *encoding,
                         gint line_pos,
                         gint column_pos,
                         gboolean create);

This function tries to load `location` into `tab` . It is usually called only on a newly-created tab.

If `location` doesn't exist, the behavior depends on `create` :

- If `create` is `FALSE`, an error is shown.

- If `create` is `TRUE`, an empty GeditDocument is created without error (but the file is not yet created on disk).

The `tab` needs to be in `GEDIT_TAB_STATE_NORMAL`. The previous GtkTextBuffer's content is lost.

#### Parameters

tab | a GeditTab. |
location | the GFile to load. |
encoding | a GtkSourceEncoding, or `NULL`. | [nullable]
line_pos | the line position to visualize. |
column_pos | the column position to visualize. |
create | `TRUE` to show no errors if `location` doesn't exist. |

Since: 45

### gedit_tab_load_stream ()

    void
    gedit_tab_load_stream (GeditTab *tab,
                           GInputStream *stream,
                           const GtkSourceEncoding *encoding,
                           gint line_pos,
                           gint column_pos);

Loads `stream` into `tab` . This function is usually called only on a newly-created tab.

The `tab` needs to be in `GEDIT_TAB_STATE_NORMAL`. The previous GtkTextBuffer's content is lost.

#### Parameters

tab | a GeditTab. |
stream | the GInputStream to load, e.g. stdin. |
encoding | a GtkSourceEncoding, or `NULL`. | [nullable]
line_pos | the line position to visualize. |
column_pos | the column position to visualize. |

Since: 45

### gedit_tab_get_view ()

    GeditView *
    gedit_tab_get_view (GeditTab *tab);

#### Parameters

tab | a GeditTab. |

#### Returns

the GeditView of `tab` .

[transfer none]

### gedit_tab_get_document ()

    GeditDocument *
    gedit_tab_get_document (GeditTab *tab);

Convenience function. It is equivalent to call `gedit_tab_get_view()` followed by `gtk_text_view_get_buffer()`.

#### Parameters

tab | a GeditTab. |

#### Returns

the GeditDocument associated to `tab` .

[transfer none]

### gedit_tab_get_from_document ()

    GeditTab *
    gedit_tab_get_from_document (GeditDocument *doc);

#### Parameters

doc | a GeditDocument. |

#### Returns

the GeditTab associated with `doc` .

[transfer none][nullable]

### gedit_tab_get_state ()

    GeditTabState
    gedit_tab_get_state (GeditTab *tab);

#### Parameters

tab | a GeditTab. |

#### Returns

the current GeditTabState of `tab` .

### gedit_tab_get_auto_save_enabled ()

    gboolean
    gedit_tab_get_auto_save_enabled (GeditTab *tab);

#### Parameters

tab | a GeditTab. |

#### Returns

the value of the “autosave” property.

### gedit_tab_set_auto_save_enabled ()

    void
    gedit_tab_set_auto_save_enabled (GeditTab *tab,
                                     gboolean enable);

Sets the “autosave” property.

It does not install an autosave timeout if the document is new or is read-only.

#### Parameters

tab | a GeditTab. |
enable | the new value. |

### gedit_tab_get_auto_save_interval ()

    gint
    gedit_tab_get_auto_save_interval (GeditTab *tab);

#### Parameters

tab | a GeditTab. |

#### Returns

the value of the “autosave-interval” property.

### gedit_tab_set_auto_save_interval ()

    void
    gedit_tab_set_auto_save_interval (GeditTab *tab,
                                      gint interval);

Sets the “autosave-interval” property.

#### Parameters

tab | a GeditTab. |
interval | the new value. |

### gedit_tab_set_info_bar ()

    void
    gedit_tab_set_info_bar (GeditTab *tab,
                            GtkWidget *info_bar);

Sets the GtkInfoBar of `tab` . Note that there can be only one GtkInfoBar per GeditTab. If there was already an infobar set, it is destroyed and replaced by the new one.

See also TeplInfoBar, it permits to create a GtkInfoBar more easily.

#### Parameters

tab | a GeditTab. |
info_bar | a GtkInfoBar. |

## Types and Values

### GeditTab

    typedef struct _GeditTab GeditTab;

### enum GeditTabState

The state of a GeditTab. Note that the enumerators are not flags, so they cannot be combined. A GeditTab is in only one state at a time.

#### Members

GEDIT_TAB_STATE_NORMAL | Normal state. |
GEDIT_TAB_STATE_LOADING | Loading. |
GEDIT_TAB_STATE_REVERTING | Reverting. |
GEDIT_TAB_STATE_SAVING | Saving. |
GEDIT_TAB_STATE_PRINTING | Printing. |
GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW | Showing print preview. |
GEDIT_TAB_STATE_LOADING_ERROR | There is a loading error. |
GEDIT_TAB_STATE_REVERTING_ERROR | There is a reverting error. |
GEDIT_TAB_STATE_SAVING_ERROR | There is a saving error. |
GEDIT_TAB_STATE_GENERIC_ERROR | There is another kind of error. |
GEDIT_TAB_STATE_CLOSING | Closing. |
GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION | There is a notification about the document being externally modified. |

## Property Details

### The `“autosave”` property

      “autosave”                 gboolean

Whether the autosave feature is enabled.

Owner: GeditTab

Flags: Read / Write

Default value: TRUE

### The `“autosave-interval”` property

      “autosave-interval”        int

Time in minutes between two autosaves.

Owner: GeditTab

Flags: Read / Write

Allowed values: >= 0

Default value: 0

### The `“can-close”` property

      “can-close”                gboolean

Whether the tab can be closed.

Owner: GeditTab

Flags: Read

Default value: TRUE

### The `“name”` property

      “name”                     char *

The tab's name.

`GeditTab:name` has been deprecated since version 47 and should not be used in newly-written code.

Use the “tepl-short-title” property instead.

Owner: GeditTab

Flags: Read

Default value: NULL

### The `“state”` property

      “state”                    GeditTabState

The state of the GeditTab.

Owner: GeditTab

Flags: Read

Default value: GEDIT_TAB_STATE_NORMAL