## GtkSourceUndoManager

GtkSourceUndoManager — Undo manager interface for GtkSourceView

## Synopsis

    #include <gtksourceview/gtksourceundomanager.h>

                        GtkSourceUndoManager;
                        GtkSourceUndoManagerIface;
    gboolean            gtk_source_undo_manager_can_undo    (GtkSourceUndoManager *manager);
    gboolean            gtk_source_undo_manager_can_redo    (GtkSourceUndoManager *manager);
    void                gtk_source_undo_manager_undo        (GtkSourceUndoManager *manager);
    void                gtk_source_undo_manager_redo        (GtkSourceUndoManager *manager);
    void                gtk_source_undo_manager_begin_not_undoable_action
                                                            (GtkSourceUndoManager *manager);
    void                gtk_source_undo_manager_end_not_undoable_action
                                                            (GtkSourceUndoManager *manager);
    void                gtk_source_undo_manager_can_undo_changed
                                                            (GtkSourceUndoManager *manager);
    void                gtk_source_undo_manager_can_redo_changed
                                                            (GtkSourceUndoManager *manager);

## Object Hierarchy

      GInterface
       +----GtkSourceUndoManager

## Prerequisites

GtkSourceUndoManager requires GObject.

## Signals

      "can-redo-changed"                               : Run Last / Action
      "can-undo-changed"                               : Run Last / Action

## Description

The GtkSourceUndoManager interface can be implemented to provide custom undo management to a GtkSourceBuffer. Use gtk_source_buffer_set_undo_manager to install a custom undo manager for a particular source buffer.

Use gtk_source_undo_manager_can_undo_changed and gtk_source_undo_manager_can_redo_changed when respectively the undo state or redo state of the undo stack has changed.

## Details

### GtkSourceUndoManager

    typedef struct _GtkSourceUndoManager GtkSourceUndoManager;

### GtkSourceUndoManagerIface

    typedef struct {
    	GTypeInterface parent;

    	/* Interface functions */
    	gboolean (*can_undo)                  (GtkSourceUndoManager *manager);
    	gboolean (*can_redo)                  (GtkSourceUndoManager *manager);

    	void     (*undo)                      (GtkSourceUndoManager *manager);
    	void     (*redo)                      (GtkSourceUndoManager *manager);

    	void     (*begin_not_undoable_action) (GtkSourceUndoManager *manager);
    	void     (*end_not_undoable_action)   (GtkSourceUndoManager *manager);

    	/* Signals */
    	void     (*can_undo_changed)          (GtkSourceUndoManager *manager);
    	void     (*can_redo_changed)          (GtkSourceUndoManager *manager);
    } GtkSourceUndoManagerIface;

### gtk_source_undo_manager_can_undo ()

    gboolean            gtk_source_undo_manager_can_undo    (GtkSourceUndoManager *manager);

Get whether there are undo operations available.

`manager` : | A GtkSourceUndoManager
Returns : | `TRUE` if there are undo operations available, `FALSE` otherwise

Since 2.10

### gtk_source_undo_manager_can_redo ()

    gboolean            gtk_source_undo_manager_can_redo    (GtkSourceUndoManager *manager);

Get whether there are redo operations available.

`manager` : | A GtkSourceUndoManager
Returns : | `TRUE` if there are redo operations available, `FALSE` otherwise

Since 2.10

### gtk_source_undo_manager_undo ()

    void                gtk_source_undo_manager_undo        (GtkSourceUndoManager *manager);

Perform a single undo. Calling this function when there are no undo operations available is an error. Use gtk_source_undo_manager_can_undo to find out if there are undo operations available.

`manager` : | A GtkSourceUndoManager

Since 2.10

### gtk_source_undo_manager_redo ()

    void                gtk_source_undo_manager_redo        (GtkSourceUndoManager *manager);

Perform a single redo. Calling this function when there are no redo operations available is an error. Use gtk_source_undo_manager_can_redo to find out if there are redo operations available.

`manager` : | A GtkSourceUndoManager

Since 2.10

### gtk_source_undo_manager_begin_not_undoable_action ()

    void                gtk_source_undo_manager_begin_not_undoable_action
                                                            (GtkSourceUndoManager *manager);

Begin a not undoable action on the buffer. All changes between this call and the call to gtk_source_undo_manager_end_not_undoable_action cannot be undone. This function should be re-entrant.

`manager` : | A GtkSourceUndoManager

Since 2.10

### gtk_source_undo_manager_end_not_undoable_action ()

    void                gtk_source_undo_manager_end_not_undoable_action
                                                            (GtkSourceUndoManager *manager);

Ends a not undoable action on the buffer.

`manager` : | A GtkSourceUndoManager

Since 2.10

### gtk_source_undo_manager_can_undo_changed ()

    void                gtk_source_undo_manager_can_undo_changed
                                                            (GtkSourceUndoManager *manager);

Emits the "can-undo-changed" signal.

`manager` : | A GtkSourceUndoManager

Since 2.10

### gtk_source_undo_manager_can_redo_changed ()

    void                gtk_source_undo_manager_can_redo_changed
                                                            (GtkSourceUndoManager *manager);

Emits the "can-redo-changed" signal.

`manager` : | A GtkSourceUndoManager

Since 2.10

## Signal Details

### The `"can-redo-changed"` signal

    void                user_function                      (GtkSourceUndoManager *manager,
                                                            gpointer              user_data)      : Run Last / Action

Emitted when the ability to redo has changed.

`manager` : | The GtkSourceUndoManager
`user_data` : | user data set when the signal handler was connected.

Since 2.10

### The `"can-undo-changed"` signal

    void                user_function                      (GtkSourceUndoManager *manager,
                                                            gpointer              user_data)      : Run Last / Action

Emitted when the ability to undo has changed.

`manager` : | The GtkSourceUndoManager
`user_data` : | user data set when the signal handler was connected.

Since 2.10

## See Also

GtkTextBuffer, GtkSourceView