PlumaDocument

## PlumaDocument PlumaDocument |

## Synopsis

    enum                PlumaSearchFlags;
                        PlumaDocumentPrivate;
    struct              PlumaDocument;
    enum                PlumaDocumentSaveFlags;
    #define             PLUMA_DOCUMENT_ERROR
    GQuark              pluma_document_error_quark          (void);
    PlumaDocument *     pluma_document_new                  (void);
    gchar *             pluma_document_get_uri              (PlumaDocument *doc);
    gchar *             pluma_document_get_uri_for_display  (PlumaDocument *doc);
    gchar *             pluma_document_get_short_name_for_display
                                                            (PlumaDocument *doc);
    gchar *             pluma_document_get_mime_type        (PlumaDocument *doc);
    gboolean            pluma_document_get_readonly         (PlumaDocument *doc);
    void                pluma_document_load                 (PlumaDocument *doc,
                                                             const gchar *uri,
                                                             const PlumaEncoding *encoding,
                                                             gint line_pos,
                                                             gboolean create);
    gboolean            pluma_document_insert_file          (PlumaDocument *doc,
                                                             GtkTextIter *iter,
                                                             const gchar *uri,
                                                             const PlumaEncoding *encoding);
    gboolean            pluma_document_load_cancel          (PlumaDocument *doc);
    void                pluma_document_save                 (PlumaDocument *doc,
                                                             PlumaDocumentSaveFlags flags);
    void                pluma_document_save_as              (PlumaDocument *doc,
                                                             const gchar *uri,
                                                             const PlumaEncoding *encoding,
                                                             PlumaDocumentSaveFlags flags);
    gboolean            pluma_document_is_untouched         (PlumaDocument *doc);
    gboolean            pluma_document_is_untitled          (PlumaDocument *doc);
    gboolean            pluma_document_get_deleted          (PlumaDocument *doc);
    gboolean            pluma_document_goto_line            (PlumaDocument *doc,
                                                             gint line);
    void                pluma_document_set_search_text      (PlumaDocument *doc,
                                                             const gchar *text,
                                                             guint flags);
    gchar *             pluma_document_get_search_text      (PlumaDocument *doc,
                                                             guint *flags);
    gboolean            pluma_document_get_can_search_again (PlumaDocument *doc);
    gboolean            pluma_document_search_forward       (PlumaDocument *doc,
                                                             const GtkTextIter *start,
                                                             const GtkTextIter *end,
                                                             GtkTextIter *match_start,
                                                             GtkTextIter *match_end);
    gboolean            pluma_document_search_backward      (PlumaDocument *doc,
                                                             const GtkTextIter *start,
                                                             const GtkTextIter *end,
                                                             GtkTextIter *match_start,
                                                             GtkTextIter *match_end);
    gint                pluma_document_replace_all          (PlumaDocument *doc,
                                                             const gchar *find,
                                                             const gchar *replace,
                                                             guint flags);
    void                pluma_document_set_language         (PlumaDocument *doc,
                                                             GtkSourceLanguage *lang);
    void                pluma_document_set_enable_search_highlighting
                                                            (PlumaDocument *doc,
                                                             gboolean enable);
    gboolean            pluma_document_get_enable_search_highlighting
                                                            (PlumaDocument *doc);
    #define             PLUMA_SEARCH_IS_DONT_SET_FLAGS      (sflags)
    #define             PLUMA_SEARCH_SET_DONT_SET_FLAGS     (sflags,
                                                             state)
    #define             PLUMA_SEARCH_IS_ENTIRE_WORD         (sflags)
    #define             PLUMA_SEARCH_SET_ENTIRE_WORD        (sflags,
                                                             state)
    #define             PLUMA_SEARCH_IS_CASE_SENSITIVE      (sflags)
    #define             PLUMA_SEARCH_SET_CASE_SENSITIVE     (sflags,
                                                             state)

## Object Hierarchy

      GObject
       +----GtkTextBuffer
             +----GtkSourceBuffer
                   +----PlumaDocument

## Properties

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

## Signals

      "cursor-moved"                                   : Run Last
      "load"                                           : Run Last
      "loaded"                                         : Run Last
      "loading"                                        : Run Last
      "save"                                           : Run Last
      "saved"                                          : Run Last
      "saving"                                         : Run Last
      "search-highlight-updated"                       : Run Last

## Description

## Details

### enum PlumaSearchFlags

    typedef enum {
    	PLUMA_SEARCH_DONT_SET_FLAGS = 1 << 0,
    	PLUMA_SEARCH_ENTIRE_WORD = 1 << 1,
    	PLUMA_SEARCH_CASE_SENSITIVE = 1 << 2,
    	PLUMA_SEARCH_PARSE_ESCAPES = 1 << 3
    } PlumaSearchFlags;

`PLUMA_SEARCH_DONT_SET_FLAGS` |
`PLUMA_SEARCH_ENTIRE_WORD` |
`PLUMA_SEARCH_CASE_SENSITIVE` |
`PLUMA_SEARCH_PARSE_ESCAPES` |

### PlumaDocumentPrivate

    typedef struct _PlumaDocumentPrivate PlumaDocumentPrivate;

### struct PlumaDocument

    struct PlumaDocument;

### enum PlumaDocumentSaveFlags

    typedef enum {
    	PLUMA_DOCUMENT_SAVE_IGNORE_MTIME 	= 1 << 0,
    	PLUMA_DOCUMENT_SAVE_IGNORE_BACKUP = 1 << 1,
    	PLUMA_DOCUMENT_SAVE_PRESERVE_BACKUP = 1 << 2
    } PlumaDocumentSaveFlags;

`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 ()

### 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);

### pluma_document_get_short_name_for_display ()

    gchar *             pluma_document_get_short_name_for_display
                                                            (PlumaDocument *doc);

### pluma_document_get_mime_type ()

    gchar *             pluma_document_get_mime_type        (PlumaDocument *doc);

### 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.

`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.

`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.

`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.

`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);

### pluma_document_get_search_text ()

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

### 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);

### pluma_document_search_backward ()

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

### 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);

### 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)

## Property Details

### The `"can-search-again"` property

      "can-search-again"         gboolean              : Read

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

Default value: FALSE

### The `"content-type"` property

      "content-type"             gchar*                : Read / Write

The document's Content Type.

Default value: NULL

### The `"enable-search-highlighting"` property

      "enable-search-highlighting" gboolean              : Read / Write

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

Default value: FALSE

### The `"encoding"` property

      "encoding"                 PlumaEncoding*        : Read

The PlumaEncoding used for the document.

### The `"mime-type"` property

      "mime-type"                gchar*                : Read

The document's MIME Type.

Default value: "text/plain"

### The `"newline-type"` property

      "newline-type"             PlumaDocumentNewlineType  : Read / Write

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

Default value: PLUMA_DOCUMENT_NEWLINE_TYPE_LF

### The `"read-only"` property

      "read-only"                gboolean              : Read

Whether the document is read only or not.

Default value: FALSE

### The `"shortname"` property

      "shortname"                gchar*                : Read / Write

The document's short name.

Default value: NULL

### The `"uri"` property

      "uri"                      gchar*                : Read

The document's URI.

Default value: NULL

## Signal Details

### The `"cursor-moved"` signal

    void                user_function                      (PlumaDocument *plumadocument,
                                                            gpointer       user_data)          : Run Last

### The `"load"` signal

    void                user_function                      (PlumaDocument *document,
                                                            gchar         *uri,
                                                            PlumaEncoding *encoding,
                                                            gint           line_pos,
                                                            gboolean       create,
                                                            gpointer       user_data)      : Run Last

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

`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.

Since 2.22

### The `"loaded"` signal

    void                user_function                      (PlumaDocument *plumadocument,
                                                            gpointer       arg1,
                                                            gpointer       user_data)          : Run Last

### The `"loading"` signal

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

### The `"save"` signal

    void                user_function                      (PlumaDocument         *document,
                                                            gchar                 *uri,
                                                            PlumaEncoding         *encoding,
                                                            PlumaDocumentSaveFlags flags,
                                                            gpointer               user_data)      : Run Last

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

`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.

Since 2.20

### The `"saved"` signal

    void                user_function                      (PlumaDocument *plumadocument,
                                                            gpointer       arg1,
                                                            gpointer       user_data)          : Run Last

### The `"saving"` signal

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

### The `"search-highlight-updated"` signal

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