## GeditDocument GeditDocument |

## Synopsis

    enum                GeditSearchFlags;
                        GeditDocumentPrivate;
                        GeditDocument;
    enum                GeditDocumentSaveFlags;
    #define             GEDIT_DOCUMENT_ERROR
    GQuark              gedit_document_error_quark          (void);
    GeditDocument*      gedit_document_new                  (void);
    gchar*              gedit_document_get_uri              (GeditDocument *doc);
    gchar*              gedit_document_get_uri_for_display  (GeditDocument *doc);
    gchar*              gedit_document_get_short_name_for_display
                                                            (GeditDocument *doc);
    gchar*              gedit_document_get_mime_type        (GeditDocument *doc);
    gboolean            gedit_document_get_readonly         (GeditDocument *doc);
    void                gedit_document_load                 (GeditDocument *doc,
                                                             const gchar *uri,
                                                             const GeditEncoding *encoding,
                                                             gint line_pos,
                                                             gboolean create);
    gboolean            gedit_document_insert_file          (GeditDocument *doc,
                                                             GtkTextIter *iter,
                                                             const gchar *uri,
                                                             const GeditEncoding *encoding);
    gboolean            gedit_document_load_cancel          (GeditDocument *doc);
    void                gedit_document_save                 (GeditDocument *doc,
                                                             GeditDocumentSaveFlags flags);
    void                gedit_document_save_as              (GeditDocument *doc,
                                                             const gchar *uri,
                                                             const GeditEncoding *encoding,
                                                             GeditDocumentSaveFlags flags);
    gboolean            gedit_document_is_untouched         (GeditDocument *doc);
    gboolean            gedit_document_is_untitled          (GeditDocument *doc);
    gboolean            gedit_document_get_deleted          (GeditDocument *doc);
    gboolean            gedit_document_goto_line            (GeditDocument *doc,
                                                             gint line);
    void                gedit_document_set_search_text      (GeditDocument *doc,
                                                             const gchar *text,
                                                             guint flags);
    gchar*              gedit_document_get_search_text      (GeditDocument *doc,
                                                             guint *flags);
    gboolean            gedit_document_get_can_search_again (GeditDocument *doc);
    gboolean            gedit_document_search_forward       (GeditDocument *doc,
                                                             const GtkTextIter *start,
                                                             const GtkTextIter *end,
                                                             GtkTextIter *match_start,
                                                             GtkTextIter *match_end);
    gboolean            gedit_document_search_backward      (GeditDocument *doc,
                                                             const GtkTextIter *start,
                                                             const GtkTextIter *end,
                                                             GtkTextIter *match_start,
                                                             GtkTextIter *match_end);
    gint                gedit_document_replace_all          (GeditDocument *doc,
                                                             const gchar *find,
                                                             const gchar *replace,
                                                             guint flags);
    void                gedit_document_set_language         (GeditDocument *doc,
                                                             GtkSourceLanguage *lang);
    void                gedit_document_set_enable_search_highlighting
                                                            (GeditDocument *doc,
                                                             gboolean enable);
    gboolean            gedit_document_get_enable_search_highlighting
                                                            (GeditDocument *doc);
    #define             GEDIT_SEARCH_IS_DONT_SET_FLAGS      (sflags)
    #define             GEDIT_SEARCH_SET_DONT_SET_FLAGS     (sflags,state)
    #define             GEDIT_SEARCH_IS_ENTIRE_WORD         (sflags)
    #define             GEDIT_SEARCH_SET_ENTIRE_WORD        (sflags,state)
    #define             GEDIT_SEARCH_IS_CASE_SENSITIVE      (sflags)
    #define             GEDIT_SEARCH_SET_CASE_SENSITIVE     (sflags,state)

## Object Hierarchy

      GObject
       +----GtkTextBuffer
             +----GtkSourceBuffer
                   +----GeditDocument

## Properties

      "can-search-again"         gboolean              : Read
      "enable-search-highlighting" gboolean              : Read / Write
      "encoding"                 GeditEncoding         : Read
      "mime-type"                gchararray            : Read
      "read-only"                gboolean              : Read
      "shortname"                gchararray            : Read
      "uri"                      gchararray            : Read

## Signals

      "cursor-moved"                                   : 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 GeditSearchFlags

    typedef enum
    {
    	GEDIT_SEARCH_DONT_SET_FLAGS	= 1 << 0,
    	GEDIT_SEARCH_ENTIRE_WORD	= 1 << 1,
    	GEDIT_SEARCH_CASE_SENSITIVE	= 1 << 2

    } GeditSearchFlags;

### GeditDocumentPrivate

    typedef struct _GeditDocumentPrivate GeditDocumentPrivate;

### GeditDocument

    typedef struct _GeditDocument GeditDocument;

### enum GeditDocumentSaveFlags

    typedef enum
    {
    	GEDIT_DOCUMENT_SAVE_IGNORE_MTIME 	= 1 << 0,
    	GEDIT_DOCUMENT_SAVE_IGNORE_BACKUP	= 1 << 1,
    	GEDIT_DOCUMENT_SAVE_PRESERVE_BACKUP	= 1 << 2
    } GeditDocumentSaveFlags;

`GEDIT_DOCUMENT_SAVE_IGNORE_MTIME` | save file despite external modifications.
`GEDIT_DOCUMENT_SAVE_IGNORE_BACKUP` | write the file directly without attempting to backup.
`GEDIT_DOCUMENT_SAVE_PRESERVE_BACKUP` | preserve previous backup file, needed to support autosaving.

### GEDIT_DOCUMENT_ERROR

    #define GEDIT_DOCUMENT_ERROR gedit_document_error_quark ()

### gedit_document_error_quark ()

    GQuark              gedit_document_error_quark          (void);

Returns : |

### gedit_document_new ()

    GeditDocument*      gedit_document_new                  (void);

Returns : |

### gedit_document_get_uri ()

    gchar*              gedit_document_get_uri              (GeditDocument *doc);

`doc` : |
Returns : |

### gedit_document_get_uri_for_display ()

    gchar*              gedit_document_get_uri_for_display  (GeditDocument *doc);

`doc` : |
Returns : |

### gedit_document_get_short_name_for_display ()

    gchar*              gedit_document_get_short_name_for_display
                                                            (GeditDocument *doc);

`doc` : |
Returns : |

### gedit_document_get_mime_type ()

    gchar*              gedit_document_get_mime_type        (GeditDocument *doc);

`doc` : |
Returns : |

### gedit_document_get_readonly ()

    gboolean            gedit_document_get_readonly         (GeditDocument *doc);

`doc` : |
Returns : |

### gedit_document_load ()

    void                gedit_document_load                 (GeditDocument *doc,
                                                             const gchar *uri,
                                                             const GeditEncoding *encoding,
                                                             gint line_pos,
                                                             gboolean create);

`doc` : |
`uri` : |
`encoding` : |
`line_pos` : |
`create` : |

### gedit_document_insert_file ()

    gboolean            gedit_document_insert_file          (GeditDocument *doc,
                                                             GtkTextIter *iter,
                                                             const gchar *uri,
                                                             const GeditEncoding *encoding);

`doc` : |
`iter` : |
`uri` : |
`encoding` : |
Returns : |

### gedit_document_load_cancel ()

    gboolean            gedit_document_load_cancel          (GeditDocument *doc);

`doc` : |
Returns : |

### gedit_document_save ()

    void                gedit_document_save                 (GeditDocument *doc,
                                                             GeditDocumentSaveFlags flags);

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

`doc` : |
`flags` : | optionnal GeditDocumentSaveFlags.

### gedit_document_save_as ()

    void                gedit_document_save_as              (GeditDocument *doc,
                                                             const gchar *uri,
                                                             const GeditEncoding *encoding,
                                                             GeditDocumentSaveFlags flags);

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

`doc` : |
`uri` : | the uri where to save the document.
`encoding` : | the GeditEncoding to encode the document.
`flags` : | optionnal GeditDocumentSaveFlags.

### gedit_document_is_untouched ()

    gboolean            gedit_document_is_untouched         (GeditDocument *doc);

`doc` : |
Returns : |

### gedit_document_is_untitled ()

    gboolean            gedit_document_is_untitled          (GeditDocument *doc);

`doc` : |
Returns : |

### gedit_document_get_deleted ()

    gboolean            gedit_document_get_deleted          (GeditDocument *doc);

`doc` : |
Returns : |

### gedit_document_goto_line ()

    gboolean            gedit_document_goto_line            (GeditDocument *doc,
                                                             gint line);

`doc` : |
`line` : |
Returns : |

### gedit_document_set_search_text ()

    void                gedit_document_set_search_text      (GeditDocument *doc,
                                                             const gchar *text,
                                                             guint flags);

`doc` : |
`text` : |
`flags` : |

### gedit_document_get_search_text ()

    gchar*              gedit_document_get_search_text      (GeditDocument *doc,
                                                             guint *flags);

`doc` : |
`flags` : |
Returns : |

### gedit_document_get_can_search_again ()

    gboolean            gedit_document_get_can_search_again (GeditDocument *doc);

`doc` : |
Returns : |

### gedit_document_search_forward ()

    gboolean            gedit_document_search_forward       (GeditDocument *doc,
                                                             const GtkTextIter *start,
                                                             const GtkTextIter *end,
                                                             GtkTextIter *match_start,
                                                             GtkTextIter *match_end);

`doc` : |
`start` : |
`end` : |
`match_start` : |
`match_end` : |
Returns : |

### gedit_document_search_backward ()

    gboolean            gedit_document_search_backward      (GeditDocument *doc,
                                                             const GtkTextIter *start,
                                                             const GtkTextIter *end,
                                                             GtkTextIter *match_start,
                                                             GtkTextIter *match_end);

`doc` : |
`start` : |
`end` : |
`match_start` : |
`match_end` : |
Returns : |

### gedit_document_replace_all ()

    gint                gedit_document_replace_all          (GeditDocument *doc,
                                                             const gchar *find,
                                                             const gchar *replace,
                                                             guint flags);

`doc` : |
`find` : |
`replace` : |
`flags` : |
Returns : |

### gedit_document_set_language ()

    void                gedit_document_set_language         (GeditDocument *doc,
                                                             GtkSourceLanguage *lang);

`doc` : |
`lang` : |

### gedit_document_set_enable_search_highlighting ()

    void                gedit_document_set_enable_search_highlighting
                                                            (GeditDocument *doc,
                                                             gboolean enable);

`doc` : |
`enable` : |

### gedit_document_get_enable_search_highlighting ()

    gboolean            gedit_document_get_enable_search_highlighting
                                                            (GeditDocument *doc);

`doc` : |
Returns : |

### GEDIT_SEARCH_IS_DONT_SET_FLAGS()

    #define GEDIT_SEARCH_IS_DONT_SET_FLAGS(sflags) ((sflags & GEDIT_SEARCH_DONT_SET_FLAGS) != 0)

`sflags` : |

### GEDIT_SEARCH_SET_DONT_SET_FLAGS()

    #define             GEDIT_SEARCH_SET_DONT_SET_FLAGS(sflags,state)

`sflags` : |
`state` : |

### GEDIT_SEARCH_IS_ENTIRE_WORD()

    #define GEDIT_SEARCH_IS_ENTIRE_WORD(sflags) ((sflags & GEDIT_SEARCH_ENTIRE_WORD) != 0)

`sflags` : |

### GEDIT_SEARCH_SET_ENTIRE_WORD()

    #define             GEDIT_SEARCH_SET_ENTIRE_WORD(sflags,state)

`sflags` : |
`state` : |

### GEDIT_SEARCH_IS_CASE_SENSITIVE()

    #define GEDIT_SEARCH_IS_CASE_SENSITIVE(sflags) ((sflags &  GEDIT_SEARCH_CASE_SENSITIVE) != 0)

`sflags` : |

### GEDIT_SEARCH_SET_CASE_SENSITIVE()

    #define             GEDIT_SEARCH_SET_CASE_SENSITIVE(sflags,state)

`sflags` : |
`state` : |

## Property Details

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

      "can-search-again"         gboolean              : Read

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

Default value: FALSE

### 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"                 GeditEncoding         : Read

The GeditEncoding used for the document.

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

      "mime-type"                gchararray            : Read

The document's MIME Type.

Default value: "text/plain"

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

      "read-only"                gboolean              : Read

Whether the document is read only or not.

Default value: FALSE

### The "`shortname`" property

      "shortname"                gchararray            : Read

The document's short name.

Default value: NULL

### The "`uri`" property

      "uri"                      gchararray            : Read

The document's URI.

Default value: NULL

## Signal Details

### The "cursor-moved" signal

    void                user_function                      (GeditDocument *geditdocument,
                                                            gpointer       user_data)          : Run Last

`geditdocument` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

### The "loaded" signal

    void                user_function                      (GeditDocument *geditdocument,
                                                            gpointer       arg1,
                                                            gpointer       user_data)          : Run Last

`geditdocument` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.

### The "loading" signal

    void                user_function                      (GeditDocument *geditdocument,
                                                            guint64        arg1,
                                                            guint64        arg2,
                                                            gpointer       user_data)          : Run Last

`geditdocument` : | the object which received the signal.
`arg1` : |
`arg2` : |
`user_data` : | user data set when the signal handler was connected.

### The "save" signal

    void                user_function                      (GeditDocument         *document,
                                                            gchar                 *uri,
                                                            GeditEncoding         *encoding,
                                                            GeditDocumentSaveFlags flags,
                                                            gpointer               user_data)      : Run Last

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

`document` : | the GeditDocument.
`uri` : | the uri where the document is about to be saved.
`encoding` : | the GeditEncoding used to save the document.
`flags` : | the GeditDocumentSaveFlags for the save operation.
`user_data` : | user data set when the signal handler was connected.

Since 2.20

### The "saved" signal

    void                user_function                      (GeditDocument *geditdocument,
                                                            gpointer       arg1,
                                                            gpointer       user_data)          : Run Last

`geditdocument` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.

### The "saving" signal

    void                user_function                      (GeditDocument *geditdocument,
                                                            guint64        arg1,
                                                            guint64        arg2,
                                                            gpointer       user_data)          : Run Last

`geditdocument` : | the object which received the signal.
`arg1` : |
`arg2` : |
`user_data` : | user data set when the signal handler was connected.

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

    void                user_function                      (GeditDocument *geditdocument,
                                                            GtkTextIter   *arg1,
                                                            GtkTextIter   *arg2,
                                                            gpointer       user_data)          : Run Last

`geditdocument` : | the object which received the signal.
`arg1` : |
`arg2` : |
`user_data` : | user data set when the signal handler was connected.