XedDocument

XedDocument

Functions

Properties

char * content-type Read / Write
char * mime-type Read
gboolean read-only Read
char * shortname Read / Write
gboolean use-gvfs-metadata Read / Write / Construct Only

Signals

void cursor-moved Run Last
void load Run Last
void loaded Run First
void save Run Last
void saved Run First

Types and Values

Object Hierarchy

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

Description

Functions

xed_document_new ()

XedDocument *
xed_document_new (void);

xed_document_get_file ()

GtkSourceFile *
xed_document_get_file (XedDocument *doc);

Gets the associated GtkSourceFile. You should use it only for reading purposes, not for creating a GtkSourceFileLoader or GtkSourceFileSaver, because xed does some extra work when loading or saving a file and maintains an internal state. If you use in a plugin a file loader or saver on the returned GtkSourceFile, the internal state of xed won't be updated.

If you want to save the XedDocument to a secondary file, you can create a new GtkSourceFile and use a GtkSourceFileSaver.

Parameters

doc

a XedDocument.

 

Returns

the associated GtkSourceFile.

[transfer none]


xed_document_get_location ()

GFile *
xed_document_get_location (XedDocument *doc);

Parameters

doc

a XedDocument

 

Returns

a new GFile.

[allow-none][transfer full]


xed_document_set_location ()

void
xed_document_set_location (XedDocument *doc,
                           GFile *location);

xed_document_get_uri_for_display ()

gchar *
xed_document_get_uri_for_display (XedDocument *doc);

Note: this never returns NULL.

Parameters

doc

a XedDocument

 

xed_document_get_short_name_for_display ()

gchar *
xed_document_get_short_name_for_display
                               (XedDocument *doc);

Note: this never returns NULL.

Parameters

doc

a XedDocument

 

xed_document_set_short_name_for_display ()

void
xed_document_set_short_name_for_display
                               (XedDocument *doc,
                                const gchar *short_name);

Parameters

doc

a XedDocument

 

short_name

the short name to use.

[allow-none]

xed_document_get_content_type ()

gchar *
xed_document_get_content_type (XedDocument *doc);

xed_document_set_content_type ()

void
xed_document_set_content_type (XedDocument *doc,
                               const gchar *content_type);

Parameters

content_type

.

[allow-none]

xed_document_get_mime_type ()

gchar *
xed_document_get_mime_type (XedDocument *doc);

Note: this never returns NULL.

Parameters

doc

a XedDocument

 

xed_document_get_readonly ()

gboolean
xed_document_get_readonly (XedDocument *doc);

xed_document_is_untouched ()

gboolean
xed_document_is_untouched (XedDocument *doc);

xed_document_is_untitled ()

gboolean
xed_document_is_untitled (XedDocument *doc);

xed_document_is_local ()

gboolean
xed_document_is_local (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_goto_line_offset ()

gboolean
xed_document_goto_line_offset (XedDocument *doc,
                               gint line,
                               gint line_offset);

xed_document_set_language ()

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

Parameters

lang

.

[allow-none]

xed_document_get_language ()

GtkSourceLanguage *
xed_document_get_language (XedDocument *doc);

Returns

.

[transfer none]


xed_document_get_encoding ()

const GtkSourceEncoding *
xed_document_get_encoding (XedDocument *doc);

xed_document_get_newline_type ()

GtkSourceNewlineType
xed_document_get_newline_type (XedDocument *doc);

xed_document_get_metadata ()

gchar *
xed_document_get_metadata (XedDocument *doc,
                           const gchar *key);

Gets the metadata assigned to key .

Parameters

doc

a XedDocument

 

key

name of the key

 

Returns

the value assigned to key . Free with g_free().


xed_document_set_metadata ()

void
xed_document_set_metadata (XedDocument *doc,
                           const gchar *first_key,
                           ...);

Sets metadata on a document.

Parameters

doc

a XedDocument

 

first_key

name of the first key to set

 

...

value for the first key, followed optionally by more key/value pairs, followed by NULL.

 

xed_document_set_search_context ()

void
xed_document_set_search_context (XedDocument *doc,
                                 GtkSourceSearchContext *search_context);

Sets the new search context for the document.

Parameters

doc

a XedDocument

 

search_context

the new GtkSourceSearchContext.

[allow-none]

xed_document_get_search_context ()

GtkSourceSearchContext *
xed_document_get_search_context (XedDocument *doc);

Parameters

doc

a XedDocument

 

Returns

the current search context of the document, or NULL if there is no search context.

[transfer full]

Types and Values

XED_TYPE_DOCUMENT

#define XED_TYPE_DOCUMENT (xed_document_get_type())

XED_METADATA_ATTRIBUTE_POSITION

#define XED_METADATA_ATTRIBUTE_POSITION "metadata::xed-position"

XED_METADATA_ATTRIBUTE_ENCODING

#define XED_METADATA_ATTRIBUTE_ENCODING "metadata::xed-encoding"

XED_METADATA_ATTRIBUTE_LANGUAGE

#define XED_METADATA_ATTRIBUTE_LANGUAGE "metadata::xed-language"

struct XedDocumentClass

struct XedDocumentClass {
    GtkSourceBufferClass parent_class;

    /* Signals */

    void (* cursor_moved)   (XedDocument *document);

    void (* load)           (XedDocument *document);

    void (* loaded)         (XedDocument *document);

    void (* save)           (XedDocument *document);

    void (* saved)          (XedDocument *document);
};

XedDocument

typedef struct _XedDocument XedDocument;

Property Details

The “content-type” property

  “content-type”             char *

The documents content type.

Owner: XedDocument

Flags: Read / Write

Default value: NULL


The “mime-type” property

  “mime-type”                char *

The documents MIME type.

Owner: XedDocument

Flags: Read

Default value: "text/plain"


The “read-only” property

  “read-only”                gboolean

Whether the document is read-only or not.

Owner: XedDocument

Flags: Read

Default value: FALSE


The “shortname” property

  “shortname”                char *

The documents short name.

Owner: XedDocument

Flags: Read / Write

Default value: NULL


The “use-gvfs-metadata” property

  “use-gvfs-metadata”        gboolean

Whether to use GVFS metadata. If FALSE, use the xed metadata manager that stores the metadata in an XML file in the user cache directory.

The property is used internally by xed. It must not be used in a xed plugin. The property can be modified or removed at any time.

Owner: XedDocument

Flags: Read / Write / Construct Only

Default value: TRUE

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,
               gpointer     user_data)

The "load" signal is emitted at the beginning of file loading.

Parameters

document

the XedDocument.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “loaded” signal

void
user_function (XedDocument *document,
               gpointer     user_data)

The "loaded" signal is emitted at the end of a successful loading.

Parameters

document

the XedDocument.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First


The “save” signal

void
user_function (XedDocument *document,
               gpointer     user_data)

The "save" signal is emitted at the beginning of file saving.

Parameters

document

the XedDocument.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “saved” signal

void
user_function (XedDocument *document,
               gpointer     user_data)

The "saved" signal is emitted at the end of a successful file saving.

Parameters

document

the XedDocument.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First