Method

GioVolumeget_activation_root

since: 2.18

Declaration [src]

GFile*
g_volume_get_activation_root (
  GVolume* volume
)

Description [src]

Gets the activation root for a GVolume if it is known ahead of mount time. Returns NULL otherwise. If not NULL and if volume is mounted, then the result of g_mount_get_root() on the GMount object obtained from g_volume_get_mount() will always either be equal or a prefix of what this function returns. In other words, in code

  GMount *mount;
  GFile *mount_root
  GFile *volume_activation_root;

  mount = g_volume_get_mount (volume); // mounted, so never NULL
  mount_root = g_mount_get_root (mount);
  volume_activation_root = g_volume_get_activation_root (volume); // assume not NULL

then the expression

  (g_file_has_prefix (volume_activation_root, mount_root) ||
   g_file_equal (volume_activation_root, mount_root))

will always be TRUE.

Activation roots are typically used in GVolumeMonitor implementations to find the underlying mount to shadow, see g_mount_is_shadowed() for more details.

Available since: 2.18

Return value

Type: GFile

The activation root of volume or NULL. Use g_object_unref() to free.

The caller of the method takes ownership of the returned data, and is responsible for freeing it.
The return value can be NULL.