XedDocument

XedDocument

Functions

Properties

gboolean can-search-again Read
gchar * content-type Read / Write
gboolean enable-search-highlighting Read / Write
XedEncoding * encoding Read
gchar * mime-type Read
XedDocumentNewlineType newline-type Read / Write
gboolean read-only Read
gchar * shortname Read / Write
gchar * 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

Object Hierarchy

    GObject
    ╰── GtkTextBuffer
        ╰── GtkSourceBuffer
            ╰── XedDocument

Description

Functions

xed_document_error_quark ()

GQuark
xed_document_error_quark (void);

xed_document_new ()

XedDocument *
xed_document_new (void);

xed_document_get_uri ()

gchar *
xed_document_get_uri (XedDocument *doc);

xed_document_get_uri_for_display ()

gchar *
xed_document_get_uri_for_display (XedDocument *doc);

Note: this never returns NULL.


xed_document_get_short_name_for_display ()

gchar *
xed_document_get_short_name_for_display
                               (XedDocument *doc);

Note: this never returns NULL.


xed_document_get_mime_type ()

gchar *
xed_document_get_mime_type (XedDocument *doc);

Note: this never returns NULL.


xed_document_get_readonly ()

gboolean
xed_document_get_readonly (XedDocument *doc);

xed_document_load ()

void
xed_document_load (XedDocument *doc,
                   const gchar *uri,
                   const XedEncoding *encoding,
                   gint line_pos,
                   gboolean create);

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

Parameters

doc

the XedDocument.

 

uri

the uri where to load the document from.

 

encoding

the XedEncoding to encode the document.

 

line_pos

the line to show.

 

create

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

 

xed_document_insert_file ()

gboolean
xed_document_insert_file (XedDocument *doc,
                          GtkTextIter *iter,
                          const gchar *uri,
                          const XedEncoding *encoding);

xed_document_load_cancel ()

gboolean
xed_document_load_cancel (XedDocument *doc);

Cancel load of a document.

Parameters

doc

the XedDocument.

 

xed_document_save ()

void
xed_document_save (XedDocument *doc,
                   XedDocumentSaveFlags flags);

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

Parameters

doc

the XedDocument.

 

flags

optionnal XedDocumentSaveFlags.

 

xed_document_save_as ()

void
xed_document_save_as (XedDocument *doc,
                      const gchar *uri,
                      const XedEncoding *encoding,
                      XedDocumentSaveFlags flags);

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

Parameters

doc

the XedDocument.

 

uri

the uri where to save the document.

 

encoding

the XedEncoding to encode the document.

 

flags

optionnal XedDocumentSaveFlags.

 

xed_document_is_untouched ()

gboolean
xed_document_is_untouched (XedDocument *doc);

xed_document_is_untitled ()

gboolean
xed_document_is_untitled (XedDocument *doc);

xed_document_get_deleted ()

gboolean
xed_document_get_deleted (XedDocument *doc);

xed_document_goto_line ()

gboolean
xed_document_goto_line (XedDocument *doc,
                        gint line);

xed_document_set_search_text ()

void
xed_document_set_search_text (XedDocument *doc,
                              const gchar *text,
                              guint flags);

xed_document_get_search_text ()

gchar *
xed_document_get_search_text (XedDocument *doc,
                              guint *flags);

Parameters

flags

.

[allow-none]

xed_document_get_can_search_again ()

gboolean
xed_document_get_can_search_again (XedDocument *doc);

xed_document_search_forward ()

gboolean
xed_document_search_forward (XedDocument *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]

xed_document_search_backward ()

gboolean
xed_document_search_backward (XedDocument *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]

xed_document_replace_all ()

gint
xed_document_replace_all (XedDocument *doc,
                          const gchar *find,
                          const gchar *replace,
                          guint flags);

xed_document_set_language ()

void
xed_document_set_language (XedDocument *doc,
                           GtkSourceLanguage *lang);

Parameters

lang

.

[allow-none]

xed_document_set_enable_search_highlighting ()

void
xed_document_set_enable_search_highlighting
                               (XedDocument *doc,
                                gboolean enable);

xed_document_get_enable_search_highlighting ()

gboolean
xed_document_get_enable_search_highlighting
                               (XedDocument *doc);

XED_SEARCH_IS_DONT_SET_FLAGS()

#define XED_SEARCH_IS_DONT_SET_FLAGS(sflags) ((sflags & XED_SEARCH_DONT_SET_FLAGS) != 0)

XED_SEARCH_SET_DONT_SET_FLAGS()

#define             XED_SEARCH_SET_DONT_SET_FLAGS(sflags,state)

XED_SEARCH_IS_ENTIRE_WORD()

#define XED_SEARCH_IS_ENTIRE_WORD(sflags) ((sflags & XED_SEARCH_ENTIRE_WORD) != 0)

XED_SEARCH_SET_ENTIRE_WORD()

#define             XED_SEARCH_SET_ENTIRE_WORD(sflags,state)

XED_SEARCH_IS_CASE_SENSITIVE()

#define XED_SEARCH_IS_CASE_SENSITIVE(sflags) ((sflags &  XED_SEARCH_CASE_SENSITIVE) != 0)

XED_SEARCH_SET_CASE_SENSITIVE()

#define             XED_SEARCH_SET_CASE_SENSITIVE(sflags,state)

Types and Values

enum XedSearchFlags

Members

XED_SEARCH_DONT_SET_FLAGS

   

XED_SEARCH_ENTIRE_WORD

   

XED_SEARCH_CASE_SENSITIVE

   

XED_SEARCH_PARSE_ESCAPES

   

XedDocumentPrivate

typedef struct _XedDocumentPrivate XedDocumentPrivate;

struct XedDocument

struct XedDocument;

enum XedDocumentSaveFlags

Members

XED_DOCUMENT_SAVE_IGNORE_MTIME

save file despite external modifications.

 

XED_DOCUMENT_SAVE_IGNORE_BACKUP

write the file directly without attempting to backup.

 

XED_DOCUMENT_SAVE_PRESERVE_BACKUP

preserve previous backup file, needed to support autosaving.

 

XED_DOCUMENT_ERROR

#define XED_DOCUMENT_ERROR xed_document_error_quark ()

Property Details

The “can-search-again” property

  “can-search-again”         gboolean

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

Flags: Read

Default value: FALSE


The “content-type” property

  “content-type”             gchar *

The document's Content Type.

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.

Flags: Read / Write

Default value: FALSE


The “encoding” property

  “encoding”                 XedEncoding *

The XedEncoding used for the document.

Flags: Read


The “mime-type” property

  “mime-type”                gchar *

The document's MIME Type.

Flags: Read

Default value: "text/plain"


The “newline-type” property

  “newline-type”             XedDocumentNewlineType

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

Flags: Read / Write

Default value: XED_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


The “uri” property

  “uri”                      gchar *

The document's URI.

Flags: Read

Default value: NULL

Signal Details

The “cursor-moved” signal

void
user_function (XedDocument *xeddocument,
               gpointer     user_data)

Flags: Run Last


The “load” signal

void
user_function (XedDocument *document,
               gchar       *uri,
               XedEncoding *encoding,
               gint         line_pos,
               gboolean     create,
               gpointer     user_data)

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

Parameters

document

the XedDocument.

 

uri

the uri where to load the document from.

 

encoding

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

Since: 2.22


The “loaded” signal

void
user_function (XedDocument *xeddocument,
               gpointer     arg1,
               gpointer     user_data)

Flags: Run Last


The “loading” signal

void
user_function (XedDocument *xeddocument,
               guint64      arg1,
               guint64      arg2,
               gpointer     user_data)

Flags: Run Last


The “save” signal

void
user_function (XedDocument         *document,
               gchar               *uri,
               XedEncoding         *encoding,
               XedDocumentSaveFlags flags,
               gpointer             user_data)

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

Parameters

document

the XedDocument.

 

uri

the uri where the document is about to be saved.

 

encoding

the XedEncoding used to save the document.

 

flags

the XedDocumentSaveFlags 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 (XedDocument *xeddocument,
               gpointer     arg1,
               gpointer     user_data)

Flags: Run Last


The “saving” signal

void
user_function (XedDocument *xeddocument,
               guint64      arg1,
               guint64      arg2,
               gpointer     user_data)

Flags: Run Last


The “search-highlight-updated” signal

void
user_function (XedDocument *xeddocument,
               GtkTextIter *arg1,
               GtkTextIter *arg2,
               gpointer     user_data)

Flags: Run Last