GeditDocument

GeditDocument

Functions

Properties

gboolean can-search-again Read
GeditDocumentCompressionType compression-type Read / Write / Construct
gchar * content-type Read / Write
gboolean empty-search Read
gboolean enable-search-highlighting Read / Write
GeditEncoding * encoding Read
GFile * location Read / Write
gchar * mime-type Read
GeditDocumentNewlineType newline-type Read / Write / Construct
gboolean read-only Read
gchar * shortname Read / Write

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

Object Hierarchy

    GObject
    ╰── GtkTextBuffer
        ╰── GtkSourceBuffer
            ╰── GeditDocument

Description

Functions

gedit_document_error_quark ()

GQuark
gedit_document_error_quark (void);

gedit_document_new ()

GeditDocument *
gedit_document_new (void);

gedit_document_get_location ()

GFile *
gedit_document_get_location (GeditDocument *doc);

Parameters

doc

a GeditDocument

 

Returns

a copy of the internal GFile.

[allow-none][transfer full]


gedit_document_get_uri_for_display ()

gchar *
gedit_document_get_uri_for_display (GeditDocument *doc);

Note: this never returns NULL.


gedit_document_get_short_name_for_display ()

gchar *
gedit_document_get_short_name_for_display
                               (GeditDocument *doc);

Note: this never returns NULL.


gedit_document_get_mime_type ()

gchar *
gedit_document_get_mime_type (GeditDocument *doc);

Note: this never returns NULL.


gedit_document_get_readonly ()

gboolean
gedit_document_get_readonly (GeditDocument *doc);

gedit_document_load ()

void
gedit_document_load (GeditDocument *doc,
                     GFile *location,
                     const GeditEncoding *encoding,
                     gint line_pos,
                     gint column_pos,
                     gboolean create);

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

Parameters

doc

the GeditDocument.

 

location

the location where to load the document from.

 

encoding

the GeditEncoding to encode the document, or NULL.

[allow-none]

line_pos

the line to show.

 

column_pos

the column to show.

 

create

whether the document should be created if it doesn't exist.

 

gedit_document_load_cancel ()

gboolean
gedit_document_load_cancel (GeditDocument *doc);

Cancel load of a document.

Parameters

doc

the GeditDocument.

 

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.

Parameters

doc

the GeditDocument.

 

flags

optionnal GeditDocumentSaveFlags.

 

gedit_document_save_as ()

void
gedit_document_save_as (GeditDocument *doc,
                        GFile *location,
                        const GeditEncoding *encoding,
                        GeditDocumentNewlineType newline_type,
                        GeditDocumentCompressionType compression_type,
                        GeditDocumentSaveFlags flags);

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

Parameters

doc

the GeditDocument.

 

location

the location where to save the document.

 

encoding

the GeditEncoding to encode the document.

 

newline_type

the GeditDocumentNewlineType for the document.

 

flags

optionnal GeditDocumentSaveFlags.

 

gedit_document_is_untouched ()

gboolean
gedit_document_is_untouched (GeditDocument *doc);

gedit_document_is_untitled ()

gboolean
gedit_document_is_untitled (GeditDocument *doc);

gedit_document_get_deleted ()

gboolean
gedit_document_get_deleted (GeditDocument *doc);

gedit_document_goto_line ()

gboolean
gedit_document_goto_line (GeditDocument *doc,
                          gint line);

gedit_document_set_search_text ()

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

gedit_document_set_search_text has been deprecated since version 3.10 and should not be used in newly-written code.

Use the search and replace API of GtkSourceView instead.

Parameters

text

.

[allow-none]

gedit_document_get_search_text ()

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

gedit_document_get_search_text has been deprecated since version 3.10 and should not be used in newly-written code.

Use the search and replace API of GtkSourceView instead.

Parameters

flags

.

[allow-none]

gedit_document_get_can_search_again ()

gboolean
gedit_document_get_can_search_again (GeditDocument *doc);

gedit_document_get_can_search_again has been deprecated since version 3.10 and should not be used in newly-written code.

Use the search and replace API of GtkSourceView instead.


gedit_document_search_forward ()

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

gedit_document_search_forward has been deprecated since version 3.10 and should not be used in newly-written code.

Use the search and replace API of GtkSourceView instead.

Parameters

start

.

[allow-none]

end

.

[allow-none]

match_start

.

[allow-none]

match_end

.

[allow-none]

gedit_document_search_backward ()

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

gedit_document_search_backward has been deprecated since version 3.10 and should not be used in newly-written code.

Use the search and replace API of GtkSourceView instead.

Parameters

start

.

[allow-none]

end

.

[allow-none]

match_start

.

[allow-none]

match_end

.

[allow-none]

gedit_document_replace_all ()

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

gedit_document_replace_all has been deprecated since version 3.10 and should not be used in newly-written code.

Use the search and replace API of GtkSourceView instead.


gedit_document_set_language ()

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

Parameters

lang

.

[allow-none]

gedit_document_set_enable_search_highlighting ()

void
gedit_document_set_enable_search_highlighting
                               (GeditDocument *doc,
                                gboolean enable);

gedit_document_set_enable_search_highlighting has been deprecated since version 3.10 and should not be used in newly-written code.

Use the search and replace API of GtkSourceView instead.


gedit_document_get_enable_search_highlighting ()

gboolean
gedit_document_get_enable_search_highlighting
                               (GeditDocument *doc);

gedit_document_get_enable_search_highlighting has been deprecated since version 3.10 and should not be used in newly-written code.

Use the search and replace API of GtkSourceView instead.


GEDIT_SEARCH_IS_DONT_SET_FLAGS()

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

GEDIT_SEARCH_SET_DONT_SET_FLAGS()

#define             GEDIT_SEARCH_SET_DONT_SET_FLAGS(sflags,state)

GEDIT_SEARCH_IS_ENTIRE_WORD()

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

GEDIT_SEARCH_SET_ENTIRE_WORD()

#define             GEDIT_SEARCH_SET_ENTIRE_WORD(sflags,state)

GEDIT_SEARCH_IS_CASE_SENSITIVE()

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

GEDIT_SEARCH_SET_CASE_SENSITIVE()

#define             GEDIT_SEARCH_SET_CASE_SENSITIVE(sflags,state)

Types and Values

enum GeditSearchFlags

GeditSearchFlags has been deprecated since version 3.10 and should not be used in newly-written code.

Use the search and replace API in GtkSourceBuffer.

Members

GEDIT_SEARCH_DONT_SET_FLAGS

   

GEDIT_SEARCH_ENTIRE_WORD

   

GEDIT_SEARCH_CASE_SENSITIVE

   

GeditDocumentPrivate

typedef struct _GeditDocumentPrivate GeditDocumentPrivate;

struct GeditDocument

struct GeditDocument;

enum GeditDocumentSaveFlags

Members

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_SAVE_IGNORE_INVALID_CHARS

   

GEDIT_DOCUMENT_ERROR

#define GEDIT_DOCUMENT_ERROR gedit_document_error_quark ()

Property Details

The “can-search-again” property

  “can-search-again”         gboolean

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

GeditDocument:can-search-again has been deprecated since version 3.10 and should not be used in newly-written code.

Use the search and replace API of GtkSourceView instead.

Flags: Read

Default value: FALSE


The “compression-type” property

  “compression-type”         GeditDocumentCompressionType

The :compression-type property determines how to compress the document when saving

Flags: Read / Write / Construct

Default value: GEDIT_DOCUMENT_COMPRESSION_TYPE_NONE


The “content-type” property

  “content-type”             gchar *

The document's Content Type.

Flags: Read / Write

Default value: NULL


The “empty-search” property

  “empty-search”             gboolean
The property is used internally by gedit. It must not be used in a gedit plugin. The property can be modified or removed at any time.

Flags: Read

Default value: TRUE


The “enable-search-highlighting” property

  “enable-search-highlighting” gboolean

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

GeditDocument:enable-search-highlighting has been deprecated since version 3.10 and should not be used in newly-written code.

Use the search and replace API of GtkSourceView instead.

Flags: Read / Write

Default value: FALSE


The “encoding” property

  “encoding”                 GeditEncoding *

The GeditEncoding used for the document.

Flags: Read


The “location” property

  “location”                 GFile *

The document's location.

Flags: Read / Write


The “mime-type” property

  “mime-type”                gchar *

The document's MIME Type.

Flags: Read

Default value: "text/plain"


The “newline-type” property

  “newline-type”             GeditDocumentNewlineType

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

Flags: Read / Write / Construct

Default value: GEDIT_DOCUMENT_NEWLINE_TYPE_LF


The “read-only” property

  “read-only”                gboolean

Whether the document is read only or not.

Flags: Read

Default value: FALSE


The “shortname” property

  “shortname”                gchar *

The document's short name.

Flags: Read / Write

Default value: NULL

Signal Details

The “cursor-moved” signal

void
user_function (GeditDocument *geditdocument,
               gpointer       user_data)

Flags: Run Last


The “load” signal

void
user_function (GeditDocument *document,
               GFile         *location,
               GeditEncoding *encoding,
               gint           line_pos,
               gint           column_pos,
               gpointer       user_data)

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

Parameters

document

the GeditDocument.

 

location

the location where to load the document from.

 

encoding

the GeditEncoding to encode the document.

 

line_pos

the line to show.

 

column_pos

the column 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

Since 2.22


The “loaded” signal

void
user_function (GeditDocument *geditdocument,
               GError        *arg1,
               gpointer       user_data)

Flags: Run Last


The “loading” signal

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

Flags: Run Last


The “save” signal

void
user_function (GeditDocument               *document,
               GFile                       *location,
               GeditEncoding               *encoding,
               GeditDocumentNewlineType     newline_type,
               GeditDocumentCompressionType compression_type,
               GeditDocumentSaveFlags       flags,
               gpointer                     user_data)

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

Parameters

document

the GeditDocument.

 

location

the location where the document is about to be saved.

 

encoding

the GeditEncoding used to save the document.

 

newline_type

the GeditDocumentNewlineType used to save the document.

 

compression_type

the GeditDocumentCompressionType used to save the document.

 

flags

the GeditDocumentSaveFlags for the save operation.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since 2.20


The “saved” signal

void
user_function (GeditDocument *geditdocument,
               GError        *arg1,
               gpointer       user_data)

Flags: Run Last


The “saving” signal

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

Flags: Run Last


The “search-highlight-updated” signal

void
user_function (GeditDocument *document,
               GtkTextIter   *start,
               GtkTextIter   *end,
               gpointer       user_data)

GeditDocument::search-highlight-updated has been deprecated since version 3.10 and should not be used in newly-written code.

Use the “highlight-updated” signal instead.

Parameters

user_data

user data set when the signal handler was connected.

 

Flags: Run Last