TeplFile

TeplFile — On-disk representation of a TeplBuffer

Functions

Properties

GFile * location Read / Write / Construct
TeplNewlineType newline-type Read
char * short-name Read

Types and Values

Object Hierarchy

    GEnum
    ╰── TeplNewlineType
    GObject
    ╰── TeplFile

Includes

#include <tepl/tepl.h>

Description

A TeplFile object is the on-disk representation of a TeplBuffer.

With a TeplFile, you can create and configure a TeplFileLoader and TeplFileSaver which take by default the values of the TeplFile properties (except for the file loader which auto-detect some properties). On a successful load or save operation, the TeplFile properties are updated. If an operation fails, the TeplFile properties have still the previous valid values.

Functions

TeplMountOperationFactory ()

GMountOperation *
(*TeplMountOperationFactory) (TeplFile *file,
                              gpointer user_data);

Type definition for a function that will be called to create a GMountOperation. This is useful for creating a GtkMountOperation.

Parameters

file

a TeplFile.

 

user_data

user data.

 

Since: 1.0

tepl_file_new ()

TeplFile *
tepl_file_new (void);

Returns

a new TeplFile object.

Since: 1.0

tepl_file_get_location ()

GFile *
tepl_file_get_location (TeplFile *file);

Parameters

file

a TeplFile.

 

Returns

the GFile.

[transfer none]

Since: 1.0

tepl_file_set_location ()

void
tepl_file_set_location (TeplFile *file,
                        GFile *location);

Sets the location.

Parameters

file

a TeplFile.

 

location

the new GFile, or NULL.

[nullable]

Since: 1.0

tepl_file_get_short_name ()

gchar *
tepl_file_get_short_name (TeplFile *file);

Gets the file short name. If the “location” isn't NULL, returns its display-name (see G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME). Otherwise returns "Untitled File N", with N the Nth untitled file of the application, starting at 1. When an untitled file is closed or its location is set, its untitled number is released and can be used by a later file.

Parameters

file

a TeplFile.

 

Returns

the file short name. Free with g_free() when no longer needed.

Since: 5.0

tepl_file_get_newline_type ()

TeplNewlineType
tepl_file_get_newline_type (TeplFile *file);

Parameters

file

a TeplFile.

 

Returns

the newline type.

Since: 1.0

tepl_file_set_mount_operation_factory ()

void
tepl_file_set_mount_operation_factory (TeplFile *file,
                                       TeplMountOperationFactory callback,
                                       gpointer user_data,
                                       GDestroyNotify notify);

Sets a TeplMountOperationFactory function that will be called when a GMountOperation must be created. This is useful for creating a GtkMountOperation with the parent GtkWindow.

If a mount operation factory isn't set, g_mount_operation_new() will be called.

Parameters

file

a TeplFile.

 

callback

a TeplMountOperationFactory to call when a GMountOperation is needed.

[scope notified]

user_data

the data to pass to the callback function.

[closure]

notify

function to call on user_data when the callback is no longer needed, or NULL.

[nullable]

Since: 1.0

tepl_file_add_uri_to_recent_manager ()

void
tepl_file_add_uri_to_recent_manager (TeplFile *file);

If the “location” isn't NULL, adds its URI to the default GtkRecentManager with gtk_recent_manager_add_item().

Parameters

file

a TeplFile.

 

Since: 4.0

Types and Values

struct TeplFile

struct TeplFile;

enum TeplNewlineType

Members

TEPL_NEWLINE_TYPE_LF

line feed, used on UNIX.

 

TEPL_NEWLINE_TYPE_CR

carriage return, used on Mac.

 

TEPL_NEWLINE_TYPE_CR_LF

carriage return followed by a line feed, used on Windows.

 

Since: 1.0

TEPL_NEWLINE_TYPE_DEFAULT

#define TEPL_NEWLINE_TYPE_DEFAULT TEPL_NEWLINE_TYPE_CR_LF

The default newline type on the current OS.

Since: 1.0

Property Details

The “location” property

  “location”                 GFile *

The location.

Owner: TeplFile

Flags: Read / Write / Construct

Since: 1.0

The “newline-type” property

  “newline-type”             TeplNewlineType

The line ending type.

Owner: TeplFile

Flags: Read

Default value: TEPL_NEWLINE_TYPE_CR_LF

Since: 1.0

The “short-name” property

  “short-name”               char *

The file short name. See tepl_file_get_short_name().

Owner: TeplFile

Flags: Read

Default value: NULL

Since: 1.0

See Also

TeplFileLoader, TeplFileSaver