Endless.Application

g Endless.Application Endless.Application GObject.GInterface GObject.GInterface Gio.ActionGroup Gio.ActionGroup GObject.GInterface->Gio.ActionGroup Gio.ActionMap Gio.ActionMap GObject.GInterface->Gio.ActionMap GObject.Object GObject.Object Gio.Application Gio.Application GObject.Object->Gio.Application Gio.ActionGroup->Gio.Application Gio.ActionMap->Gio.Application Gtk.Application Gtk.Application Gio.Application->Gtk.Application Gtk.Application->Endless.Application

Subclasses:

None

Methods

Inherited:

Gtk.Application (21), Gio.Application (37), GObject.Object (37), Gio.ActionGroup (14), Gio.ActionMap (5)

Structs:

GObject.ObjectClass (5)

class

new (application_id, flags)

get_config_dir ()

get_image_attribution_file ()

set_image_attribution_file (file)

Virtual Methods

Inherited:

Gtk.Application (2), Gio.Application (15), GObject.Object (7), Gio.ActionGroup (14), Gio.ActionMap (3)

Properties

Inherited:

Gtk.Application (5), Gio.Application (8)

Name

Type

Flags

Short Description

config-dir

Gio.File

r

User configuration directory for this application

image-attribution-file

Gio.File

r/w

File with attribution information for images in this application

Signals

Inherited:

Gtk.Application (3), Gio.Application (7), GObject.Object (1), Gio.ActionGroup (4)

Fields

Inherited:

Gtk.Application (3), Gio.Application (7), GObject.Object (1), Gio.ActionGroup (4)

Name

Type

Access

Description

parent

Gtk.Application

r

Class Details

class Endless.Application(**kwargs)
Bases:

Gtk.Application

Abstract:

No

Structure:

Endless.ApplicationClass

This class structure contains no public members.

classmethod new(application_id, flags)
Parameters:
Returns:

a pointer to the application.

Return type:

Endless.Application

Create a new application. For the application ID, use a reverse domain name, such as com.endlessm.weather. See Gio.Application.id_is_valid() for the full rules for application IDs.

get_config_dir()
Returns:

A Gio.File pointing to the user config directory.

Return type:

Gio.File

Gets a Gio.File pointing to the application-specific user configuration directory. This directory is located in XDG_USER_CONFIG_DIR, which usually expands to ~/.config. The directory name is the same as the application’s unique ID (see Gio.Application :application-id.)

You should use this directory to store configuration data specific to your application and specific to one user, such as cookies.

Calling this function will also ensure that the directory exists and is writable. If it does not exist, it will be created. If it cannot be created, or it exists but is not writable, the program will abort.

get_image_attribution_file()
Returns:

A Gio.File pointing to the image attribution file, or None if one has not been set.

Return type:

Gio.File or None

Gets a Gio.File pointing to a JSON file containing credits for images included in the app’s resources. See Endless.Application :image-attribution-file.

New in version 0.2.

set_image_attribution_file(file)
Parameters:

file (Gio.File or None) – a Gio.File pointing to a file in the proper format, or None to unset.

You can provide attribution and credit for images included in the application by giving this function a JSON file with image credits. See Endless.Application :image-attribution-file for the JSON file’s required format.

New in version 0.2.

Property Details

Endless.Application.props.config_dir
Name:

config-dir

Type:

Gio.File

Default Value:

None

Flags:

READABLE

A directory appropriate for storing per-user configuration information for this application. Accessing this property guarantees that the directory exists and is writable. See also Endless.Application.get_config_dir() for more information.

Endless.Application.props.image_attribution_file
Name:

image-attribution-file

Type:

Gio.File

Default Value:

None

Flags:

READABLE, WRITABLE

A Gio.File handle to a file for storing attribution information for the images included in this application’s resource file.

This attribution file must be a JSON file. Here is an example of the required format:

[
  {
    "resource_path": "/com/example/smokegrinder/image1.jpg",
    "license": "Public domain",
    "uri": "http://www.photos.com/photos/12345",
    "comment": "No known copyright restrictions"
  },
  {
    "resource_path": "/com/example/smokegrinder/image2.jpg",
    "license_uri": "http://example.com/image-license",
    "uri": "http://www.photos.com/photos/54321",
    "credit": "Edward X. Ample",
    "credit_contact": "http://www.photos.com/users/example"
  },
  {
    "resource_path": "/com/example/smokegrinder/image3.jpg",
    "copyright_holder": "Jane Q. Hacker",
    "copyright_year": 2014,
    "permission": true
  }
]

The JSON object is an array of objects that each contain information about one image. The only required property is resource_path, which is the path to the image in the resource file.

The recognized properties are shown in .

Nothing is guaranteed about how the application uses this information. It can display it to the user or make it available to other programs.

Currently, pressing Control + Shift + A brings up a credits dialog. This is liable to change in future versions.

New in version 0.2.