Method

GioApplicationset_resource_base_path

since: 2.42

Declaration

void
g_application_set_resource_base_path (
  GApplication* application,
  const gchar* resource_path
)

Description

Sets (or unsets) the base resource path of application.

The path is used to automatically load various [application resources][gresource] such as menu layouts and action descriptions. The various types of resources will be found at fixed names relative to the given base path.

By default, the resource base path is determined from the application ID by prefixing ‘/’ and replacing each ‘.’ with ‘/’. This is done at the time that the GApplication object is constructed. Changes to the application ID after that point will not have an impact on the resource base path.

As an example, if the application has an ID of “org.example.app” then the default resource base path will be “/org/example/app”. If this is a GtkApplication (and you have not manually changed the path) then Gtk will then search for the menus of the application at “/org/example/app/gtk/menus.ui”.

See GResource for more information about adding resources to your application.

You can disable automatic resource loading functionality by setting the path to NULL.

Changing the resource base path once the application is running is not recommended. The point at which the resource path is consulted for forming paths for various purposes is unspecified. When writing a sub-class of GApplication you should either set the GApplication:resource-base-path property at construction time, or call this function during the instance initialization. Alternatively, you can call this function in the GApplicationClass.startup virtual function, before chaining up to the parent implementation.

Available since: 2.42

Parameters

resource_path

Type: const gchar*

The resource path to use.

The argument can be NULL.
The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.