GeditDocument

GeditDocument

Synopsis

                    GeditDocumentPrivate;
struct              GeditDocument;
enum                GeditDocumentSaveFlags;
#define             GEDIT_DOCUMENT_ERROR
GQuark              gedit_document_error_quark          (void);
GeditDocument *     gedit_document_new                  (void);
GFile *             gedit_document_get_location         (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,
                                                         GFile *location,
                                                         const GeditEncoding *encoding,
                                                         gint line_pos,
                                                         gint column_pos,
                                                         gboolean create);
gboolean            gedit_document_load_cancel          (GeditDocument *doc);
void                gedit_document_save                 (GeditDocument *doc,
                                                         GeditDocumentSaveFlags flags);
void                gedit_document_save_as              (GeditDocument *doc,
                                                         GFile *location,
                                                         const GeditEncoding *encoding,
                                                         GeditDocumentNewlineType newline_type,
                                                         GeditDocumentCompressionType compression_type,
                                                         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_language         (GeditDocument *doc,
                                                         GtkSourceLanguage *lang);

Object Hierarchy

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

Properties

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

Signals

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

Description

Details

GeditDocumentPrivate

typedef struct _GeditDocumentPrivate GeditDocumentPrivate;

struct GeditDocument

struct 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,
	GEDIT_DOCUMENT_SAVE_IGNORE_INVALID_CHARS= 1 << 3
} 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_SAVE_IGNORE_INVALID_CHARS


GEDIT_DOCUMENT_ERROR

#define GEDIT_DOCUMENT_ERROR gedit_document_error_quark ()

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

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.

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.

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.

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.

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

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

lang :

. [allow-none]

Property Details

The "compression-type" property

  "compression-type"         GeditDocumentCompressionType  : Read / Write / Construct

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

Default value: GEDIT_DOCUMENT_COMPRESSION_TYPE_NONE


The "content-type" property

  "content-type"             gchar*                : Read / Write

The document's Content Type.

Default value: NULL


The "empty-search" property

  "empty-search"             gboolean              : Read

Warning

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.

Default value: TRUE


The "encoding" property

  "encoding"                 GeditEncoding*        : Read

The GeditEncoding used for the document.


The "location" property

  "location"                 GFile*                : Read / Write

The document's location.


The "mime-type" property

  "mime-type"                gchar*                : Read

The document's MIME Type.

Default value: "text/plain"


The "newline-type" property

  "newline-type"             GeditDocumentNewlineType  : Read / Write / Construct

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

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

Signal Details

The "cursor-moved" signal

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

The "load" signal

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

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

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.

Since 2.22


The "loaded" signal

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

The "loading" signal

void                user_function                      (GeditDocument *geditdocument,
                                                        guint64        arg1,
                                                        guint64        arg2,
                                                        gpointer       user_data)          : 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)             : Run Last

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

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.

Since 2.20


The "saved" signal

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

The "saving" signal

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