## PlumaDocument

PlumaDocument

## Functions

GQuark | pluma_document_error_quark ()
PlumaDocument * | pluma_document_new ()
gchar * | pluma_document_get_uri ()
gchar * | pluma_document_get_uri_for_display ()
gchar * | pluma_document_get_short_name_for_display ()
gchar * | pluma_document_get_mime_type ()
gboolean | pluma_document_get_readonly ()
void | pluma_document_load ()
gboolean | pluma_document_insert_file ()
gboolean | pluma_document_load_cancel ()
void | pluma_document_save ()
void | pluma_document_save_as ()
gboolean | pluma_document_is_untouched ()
gboolean | pluma_document_is_untitled ()
gboolean | pluma_document_get_deleted ()
gboolean | pluma_document_goto_line ()
void | pluma_document_set_search_text ()
gchar * | pluma_document_get_search_text ()
gboolean | pluma_document_get_can_search_again ()
gboolean | pluma_document_search_forward ()
gboolean | pluma_document_search_backward ()
gint | pluma_document_replace_all ()
void | pluma_document_set_language ()
void | pluma_document_set_enable_search_highlighting ()
gboolean | pluma_document_get_enable_search_highlighting ()
#define | PLUMA_SEARCH_IS_DONT_SET_FLAGS()
#define | PLUMA_SEARCH_SET_DONT_SET_FLAGS()
#define | PLUMA_SEARCH_IS_ENTIRE_WORD()
#define | PLUMA_SEARCH_SET_ENTIRE_WORD()
#define | PLUMA_SEARCH_IS_CASE_SENSITIVE()
#define | PLUMA_SEARCH_SET_CASE_SENSITIVE()

## Properties

gboolean | can-search-again | Read
char * | content-type | Read / Write
gboolean | enable-search-highlighting | Read / Write
PlumaEncoding * | encoding | Read
char * | mime-type | Read
PlumaDocumentNewlineType | newline-type | Read / Write
gboolean | read-only | Read
char * | shortname | Read / Write
char * | uri | Read

## Signals

void | cursor-moved | Run Last
void | load | Run Last
void | loaded | Run Last
void | loading | Run Last
void | save | Run Last
void | saved | Run Last
void | saving | Run Last
void | search-highlight-updated | Run Last

## Types and Values

enum | PlumaSearchFlags
| PlumaDocumentPrivate
struct | PlumaDocument
enum | PlumaDocumentSaveFlags
#define | PLUMA_DOCUMENT_ERROR

## Object Hierarchy

        GObject
        ╰── GtkTextBuffer
            ╰── GtkSourceBuffer
                ╰── PlumaDocument

## Description

## Functions

### pluma_document_error_quark ()

    GQuark
    pluma_document_error_quark (void);

### pluma_document_new ()

    PlumaDocument *
    pluma_document_new (void);

### pluma_document_get_uri ()

    gchar *
    pluma_document_get_uri (PlumaDocument *doc);

### pluma_document_get_uri_for_display ()

    gchar *
    pluma_document_get_uri_for_display (PlumaDocument *doc);

Note: this never returns `NULL`.

### pluma_document_get_short_name_for_display ()

    gchar *
    pluma_document_get_short_name_for_display
                                   (PlumaDocument *doc);

Note: this never returns `NULL`.

### pluma_document_get_mime_type ()

    gchar *
    pluma_document_get_mime_type (PlumaDocument *doc);

Note: this never returns `NULL`.

### pluma_document_get_readonly ()

    gboolean
    pluma_document_get_readonly (PlumaDocument *doc);

### pluma_document_load ()

    void
    pluma_document_load (PlumaDocument *doc,
                         const gchar *uri,
                         const PlumaEncoding *encoding,
                         gint line_pos,
                         gboolean create);

Load a document. This results in the "load" signal to be emitted.

#### Parameters

doc | the PlumaDocument. |
uri | the uri where to load the document from. |
encoding | the PlumaEncoding to encode the document. |
line_pos | the line to show. |
create | whether the document should be created if it doesn't exist. |

### pluma_document_insert_file ()

    gboolean
    pluma_document_insert_file (PlumaDocument *doc,
                                GtkTextIter *iter,
                                const gchar *uri,
                                const PlumaEncoding *encoding);

### pluma_document_load_cancel ()

    gboolean
    pluma_document_load_cancel (PlumaDocument *doc);

Cancel load of a document.

#### Parameters

doc | the PlumaDocument. |

### pluma_document_save ()

    void
    pluma_document_save (PlumaDocument *doc,
                         PlumaDocumentSaveFlags flags);

Save the document to its previous location. This results in the "save" signal to be emitted.

#### Parameters

doc | the PlumaDocument. |
flags | optionnal PlumaDocumentSaveFlags. |

### pluma_document_save_as ()

    void
    pluma_document_save_as (PlumaDocument *doc,
                            const gchar *uri,
                            const PlumaEncoding *encoding,
                            PlumaDocumentSaveFlags flags);

Save the document to a new location. This results in the "save" signal to be emitted.

#### Parameters

doc | the PlumaDocument. |
uri | the uri where to save the document. |
encoding | the PlumaEncoding to encode the document. |
flags | optionnal PlumaDocumentSaveFlags. |

### pluma_document_is_untouched ()

    gboolean
    pluma_document_is_untouched (PlumaDocument *doc);

### pluma_document_is_untitled ()

    gboolean
    pluma_document_is_untitled (PlumaDocument *doc);

### pluma_document_get_deleted ()

    gboolean
    pluma_document_get_deleted (PlumaDocument *doc);

### pluma_document_goto_line ()

    gboolean
    pluma_document_goto_line (PlumaDocument *doc,
                              gint line);

### pluma_document_set_search_text ()

    void
    pluma_document_set_search_text (PlumaDocument *doc,
                                    const gchar *text,
                                    guint flags);

#### Parameters

text | . | [allow-none]

### pluma_document_get_search_text ()

    gchar *
    pluma_document_get_search_text (PlumaDocument *doc,
                                    guint *flags);

#### Parameters

flags | . | [allow-none]

### pluma_document_get_can_search_again ()

    gboolean
    pluma_document_get_can_search_again (PlumaDocument *doc);

### pluma_document_search_forward ()

    gboolean
    pluma_document_search_forward (PlumaDocument *doc,
                                   const GtkTextIter *start,
                                   const GtkTextIter *end,
                                   GtkTextIter *match_start,
                                   GtkTextIter *match_end);

#### Parameters

start | . | [allow-none]
end | . | [allow-none]
match_start | . | [allow-none]
match_end | . | [allow-none]

### pluma_document_search_backward ()

    gboolean
    pluma_document_search_backward (PlumaDocument *doc,
                                    const GtkTextIter *start,
                                    const GtkTextIter *end,
                                    GtkTextIter *match_start,
                                    GtkTextIter *match_end);

#### Parameters

start | . | [allow-none]
end | . | [allow-none]
match_start | . | [allow-none]
match_end | . | [allow-none]

### pluma_document_replace_all ()

    gint
    pluma_document_replace_all (PlumaDocument *doc,
                                const gchar *find,
                                const gchar *replace,
                                guint flags);

### pluma_document_set_language ()

    void
    pluma_document_set_language (PlumaDocument *doc,
                                 GtkSourceLanguage *lang);

#### Parameters

lang | . | [allow-none]

### pluma_document_set_enable_search_highlighting ()

    void
    pluma_document_set_enable_search_highlighting
                                   (PlumaDocument *doc,
                                    gboolean enable);

### pluma_document_get_enable_search_highlighting ()

    gboolean
    pluma_document_get_enable_search_highlighting
                                   (PlumaDocument *doc);

### PLUMA_SEARCH_IS_DONT_SET_FLAGS()

    #define PLUMA_SEARCH_IS_DONT_SET_FLAGS(sflags) ((sflags & PLUMA_SEARCH_DONT_SET_FLAGS) != 0)

### PLUMA_SEARCH_SET_DONT_SET_FLAGS()

    #define             PLUMA_SEARCH_SET_DONT_SET_FLAGS(sflags,state)

### PLUMA_SEARCH_IS_ENTIRE_WORD()

    #define PLUMA_SEARCH_IS_ENTIRE_WORD(sflags) ((sflags & PLUMA_SEARCH_ENTIRE_WORD) != 0)

### PLUMA_SEARCH_SET_ENTIRE_WORD()

    #define             PLUMA_SEARCH_SET_ENTIRE_WORD(sflags,state)

### PLUMA_SEARCH_IS_CASE_SENSITIVE()

    #define PLUMA_SEARCH_IS_CASE_SENSITIVE(sflags) ((sflags &  PLUMA_SEARCH_CASE_SENSITIVE) != 0)

### PLUMA_SEARCH_SET_CASE_SENSITIVE()

    #define             PLUMA_SEARCH_SET_CASE_SENSITIVE(sflags,state)

## Types and Values

### enum PlumaSearchFlags

#### Members

PLUMA_SEARCH_DONT_SET_FLAGS |  |
PLUMA_SEARCH_ENTIRE_WORD |  |
PLUMA_SEARCH_CASE_SENSITIVE |  |
PLUMA_SEARCH_PARSE_ESCAPES |  |
PLUMA_SEARCH_MATCH_REGEX |  |

### PlumaDocumentPrivate

    typedef struct _PlumaDocumentPrivate PlumaDocumentPrivate;

### struct PlumaDocument

    struct PlumaDocument;

### enum PlumaDocumentSaveFlags

#### Members

PLUMA_DOCUMENT_SAVE_IGNORE_MTIME | save file despite external modifications. |
PLUMA_DOCUMENT_SAVE_IGNORE_BACKUP | write the file directly without attempting to backup. |
PLUMA_DOCUMENT_SAVE_PRESERVE_BACKUP | preserve previous backup file, needed to support autosaving. |

### PLUMA_DOCUMENT_ERROR

    #define PLUMA_DOCUMENT_ERROR pluma_document_error_quark ()

## Property Details

### The `“can-search-again”` property

      “can-search-again”         gboolean

Whether it's possible to search again in the document.

Owner: PlumaDocument

Flags: Read

Default value: FALSE

### The `“content-type”` property

      “content-type”             char *

The document's Content Type.

Owner: PlumaDocument

Flags: Read / Write

Default value: NULL

### The `“enable-search-highlighting”` property

      “enable-search-highlighting” gboolean

Whether all the occurrences of the searched string must be highlighted.

Owner: PlumaDocument

Flags: Read / Write

Default value: FALSE

### The `“encoding”` property

      “encoding”                 PlumaEncoding *

The PlumaEncoding used for the document.

Owner: PlumaDocument

Flags: Read

### The `“mime-type”` property

      “mime-type”                char *

The document's MIME Type.

Owner: PlumaDocument

Flags: Read

Default value: "text/plain"

### The `“newline-type”` property

      “newline-type”             PlumaDocumentNewlineType

The :newline-type property determines what is considered as a line ending when saving the document

Owner: PlumaDocument

Flags: Read / Write

Default value: PLUMA_DOCUMENT_NEWLINE_TYPE_LF

### The `“read-only”` property

      “read-only”                gboolean

Whether the document is read only or not.

Owner: PlumaDocument

Flags: Read

Default value: FALSE

### The `“shortname”` property

      “shortname”                char *

The document's short name.

Owner: PlumaDocument

Flags: Read / Write

Default value: NULL

### The `“uri”` property

      “uri”                      char *

The document's URI.

Owner: PlumaDocument

Flags: Read

Default value: NULL

## Signal Details

### The `“cursor-moved”` signal

    void
    user_function (PlumaDocument *plumadocument,
                   gpointer       user_data)

Flags: Run Last

### The `“load”` signal

    void
    user_function (PlumaDocument *document,
                   char          *uri,
                   PlumaEncoding *encoding,
                   int            line_pos,
                   gboolean       create,
                   gpointer       user_data)

The "load" signal is emitted when a document is loaded.

#### Parameters

document | the PlumaDocument. |
uri | the uri where to load the document from. |
encoding | the PlumaEncoding to encode the document. |
line_pos | the line to show. |
create | whether the document should be created if it doesn't exist. |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“loaded”` signal

    void
    user_function (PlumaDocument *plumadocument,
                   gpointer       arg1,
                   gpointer       user_data)

Flags: Run Last

### The `“loading”` signal

    void
    user_function (PlumaDocument *plumadocument,
                   guint64        arg1,
                   guint64        arg2,
                   gpointer       user_data)

Flags: Run Last

### The `“save”` signal

    void
    user_function (PlumaDocument         *document,
                   char                  *uri,
                   PlumaEncoding         *encoding,
                   PlumaDocumentSaveFlags flags,
                   gpointer               user_data)

The "save" signal is emitted when the document is saved.

#### Parameters

document | the PlumaDocument. |
uri | the uri where the document is about to be saved. |
encoding | the PlumaEncoding used to save the document. |
flags | the PlumaDocumentSaveFlags for the save operation. |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“saved”` signal

    void
    user_function (PlumaDocument *plumadocument,
                   gpointer       arg1,
                   gpointer       user_data)

Flags: Run Last

### The `“saving”` signal

    void
    user_function (PlumaDocument *plumadocument,
                   guint64        arg1,
                   guint64        arg2,
                   gpointer       user_data)

Flags: Run Last

### The `“search-highlight-updated”` signal

    void
    user_function (PlumaDocument *plumadocument,
                   GtkTextIter   *arg1,
                   GtkTextIter   *arg2,
                   gpointer       user_data)

Flags: Run Last