本文整理汇总了C++中G_DRIVE_GET_IFACE函数的典型用法代码示例。如果您正苦于以下问题:C++ G_DRIVE_GET_IFACE函数的具体用法?C++ G_DRIVE_GET_IFACE怎么用?C++ G_DRIVE_GET_IFACE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_DRIVE_GET_IFACE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: g_drive_stop
/**
* g_drive_stop:
* @drive: a #GDrive.
* @flags: flags affecting the unmount if required for stopping.
* @mount_operation: (allow-none): a #GMountOperation or %NULL to avoid
* user interaction.
* @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: (allow-none): a #GAsyncReadyCallback, or %NULL.
* @user_data: user data to pass to @callback
*
* Asynchronously stops a drive.
*
* When the operation is finished, @callback will be called.
* You can then call g_drive_stop_finish() to obtain the
* result of the operation.
*
* Since: 2.22
*/
void
g_drive_stop (GDrive *drive,
GMountUnmountFlags flags,
GMountOperation *mount_operation,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GDriveIface *iface;
g_return_if_fail (G_IS_DRIVE (drive));
iface = G_DRIVE_GET_IFACE (drive);
if (iface->stop == NULL)
{
g_task_report_new_error (drive, callback, user_data,
g_drive_start,
G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("drive doesn't implement stop"));
return;
}
(* iface->stop) (drive, flags, mount_operation, cancellable, callback, user_data);
}
示例2: g_drive_eject_with_operation
/**
* g_drive_eject_with_operation:
* @drive: a #GDrive.
* @flags: flags affecting the unmount if required for eject
* @mount_operation: (allow-none): a #GMountOperation or %NULL to avoid
* user interaction.
* @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: (allow-none): a #GAsyncReadyCallback, or %NULL.
* @user_data: user data passed to @callback.
*
* Ejects a drive. This is an asynchronous operation, and is
* finished by calling g_drive_eject_with_operation_finish() with the @drive
* and #GAsyncResult data returned in the @callback.
*
* Since: 2.22
**/
void
g_drive_eject_with_operation (GDrive *drive,
GMountUnmountFlags flags,
GMountOperation *mount_operation,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GDriveIface *iface;
g_return_if_fail (G_IS_DRIVE (drive));
iface = G_DRIVE_GET_IFACE (drive);
if (iface->eject == NULL && iface->eject_with_operation == NULL)
{
g_task_report_new_error (drive, callback, user_data,
g_drive_eject_with_operation,
G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
/* Translators: This is an error
* message for drive objects that
* don't implement any of eject or eject_with_operation. */
_("drive doesn't implement eject or eject_with_operation"));
return;
}
if (iface->eject_with_operation != NULL)
(* iface->eject_with_operation) (drive, flags, mount_operation, cancellable, callback, user_data);
else
(* iface->eject) (drive, flags, cancellable, callback, user_data);
}
示例3: g_drive_has_media
/**
* g_drive_has_media:
* @drive: a #GDrive.
*
* Checks if the @drive has media. Note that the OS may not be polling
* the drive for media changes; see g_drive_is_media_check_automatic()
* for more details.
*
* Returns: %TRUE if @drive has media, %FALSE otherwise.
**/
gboolean
g_drive_has_media (GDrive *drive)
{
GDriveIface *iface;
g_return_val_if_fail (G_IS_DRIVE (drive), FALSE);
iface = G_DRIVE_GET_IFACE (drive);
return (* iface->has_media) (drive);
}
示例4: g_drive_is_media_removable
/**
* g_drive_is_media_removable:
* @drive: a #GDrive.
*
* Checks if the @drive supports removable media.
*
* Returns: %TRUE if @drive supports removable media, %FALSE otherwise.
**/
gboolean
g_drive_is_media_removable (GDrive *drive)
{
GDriveIface *iface;
g_return_val_if_fail (G_IS_DRIVE (drive), FALSE);
iface = G_DRIVE_GET_IFACE (drive);
return (* iface->is_media_removable) (drive);
}
示例5: g_drive_is_media_check_automatic
/**
* g_drive_is_media_check_automatic:
* @drive: a #GDrive.
*
* Checks if @drive is capabable of automatically detecting media changes.
*
* Returns: %TRUE if the @drive is capabable of automatically detecting
* media changes, %FALSE otherwise.
**/
gboolean
g_drive_is_media_check_automatic (GDrive *drive)
{
GDriveIface *iface;
g_return_val_if_fail (G_IS_DRIVE (drive), FALSE);
iface = G_DRIVE_GET_IFACE (drive);
return (* iface->is_media_check_automatic) (drive);
}
示例6: g_drive_get_volumes
/**
* g_drive_get_volumes:
* @drive: a #GDrive.
*
* Get a list of mountable volumes for @drive.
*
* The returned list should be freed with g_list_free(), after
* its elements have been unreffed with g_object_unref().
*
* Returns: (element-type GVolume) (transfer full): #GList containing any #GVolume objects on the given @drive.
**/
GList *
g_drive_get_volumes (GDrive *drive)
{
GDriveIface *iface;
g_return_val_if_fail (G_IS_DRIVE (drive), NULL);
iface = G_DRIVE_GET_IFACE (drive);
return (* iface->get_volumes) (drive);
}
示例7: g_drive_get_icon
/**
* g_drive_get_icon:
* @drive: a #GDrive.
*
* Gets the icon for @drive.
*
* Returns: (transfer full): #GIcon for the @drive.
* Free the returned object with g_object_unref().
**/
GIcon *
g_drive_get_icon (GDrive *drive)
{
GDriveIface *iface;
g_return_val_if_fail (G_IS_DRIVE (drive), NULL);
iface = G_DRIVE_GET_IFACE (drive);
return (* iface->get_icon) (drive);
}
示例8: g_drive_is_removable
/**
* g_drive_is_removable:
* @drive: a #GDrive.
*
* Checks if the #GDrive and/or its media is considered removable by the user.
* See g_drive_is_media_removable().
*
* Returns: %TRUE if @drive and/or its media is considered removable, %FALSE otherwise.
*
* Since: 2.50
**/
gboolean
g_drive_is_removable (GDrive *drive)
{
GDriveIface *iface;
g_return_val_if_fail (G_IS_DRIVE (drive), FALSE);
iface = G_DRIVE_GET_IFACE (drive);
if (iface->is_removable != NULL)
return iface->is_removable (drive);
return FALSE;
}
示例9: g_drive_can_poll_for_media
/**
* g_drive_can_poll_for_media:
* @drive: a #GDrive.
*
* Checks if a drive can be polled for media changes.
*
* Returns: %TRUE if the @drive can be polled for media changes,
* %FALSE otherwise.
**/
gboolean
g_drive_can_poll_for_media (GDrive *drive)
{
GDriveIface *iface;
g_return_val_if_fail (G_IS_DRIVE (drive), FALSE);
iface = G_DRIVE_GET_IFACE (drive);
if (iface->poll_for_media == NULL)
return FALSE;
return (* iface->can_poll_for_media) (drive);
}
示例10: g_drive_get_sort_key
/**
* g_drive_get_sort_key:
* @drive: A #GDrive.
*
* Gets the sort key for @drive, if any.
*
* Returns: Sorting key for @drive or %NULL if no such key is available.
*
* Since: 2.32
*/
const gchar *
g_drive_get_sort_key (GDrive *drive)
{
const gchar *ret = NULL;
GDriveIface *iface;
g_return_val_if_fail (G_IS_DRIVE (drive), NULL);
iface = G_DRIVE_GET_IFACE (drive);
if (iface->get_sort_key != NULL)
ret = iface->get_sort_key (drive);
return ret;
}
示例11: g_drive_can_stop
/**
* g_drive_can_stop:
* @drive: a #GDrive.
*
* Checks if a drive can be stopped.
*
* Returns: %TRUE if the @drive can be stopped, %FALSE otherwise.
*
* Since: 2.22
*/
gboolean
g_drive_can_stop (GDrive *drive)
{
GDriveIface *iface;
g_return_val_if_fail (G_IS_DRIVE (drive), FALSE);
iface = G_DRIVE_GET_IFACE (drive);
if (iface->can_stop == NULL)
return FALSE;
return (* iface->can_stop) (drive);
}
示例12: g_drive_get_start_stop_type
/**
* g_drive_get_start_stop_type:
* @drive: a #GDrive.
*
* Gets a hint about how a drive can be started/stopped.
*
* Returns: A value from the #GDriveStartStopType enumeration.
*
* Since: 2.22
*/
GDriveStartStopType
g_drive_get_start_stop_type (GDrive *drive)
{
GDriveIface *iface;
g_return_val_if_fail (G_IS_DRIVE (drive), FALSE);
iface = G_DRIVE_GET_IFACE (drive);
if (iface->get_start_stop_type == NULL)
return G_DRIVE_START_STOP_TYPE_UNKNOWN;
return (* iface->get_start_stop_type) (drive);
}
示例13: g_drive_get_identifier
/**
* g_drive_get_identifier:
* @drive: a #GDrive
* @kind: the kind of identifier to return
*
* Gets the identifier of the given kind for @drive.
*
* Returns: a newly allocated string containing the
* requested identfier, or %NULL if the #GDrive
* doesn't have this kind of identifier.
*/
char *
g_drive_get_identifier (GDrive *drive,
const char *kind)
{
GDriveIface *iface;
g_return_val_if_fail (G_IS_DRIVE (drive), NULL);
g_return_val_if_fail (kind != NULL, NULL);
iface = G_DRIVE_GET_IFACE (drive);
if (iface->get_identifier == NULL)
return NULL;
return (* iface->get_identifier) (drive, kind);
}
示例14: g_drive_get_symbolic_icon
/**
* g_drive_get_symbolic_icon:
* @drive: a #GDrive.
*
* Gets the icon for @drive.
*
* Returns: (transfer full): symbolic #GIcon for the @drive.
* Free the returned object with g_object_unref().
*
* Since: 2.34
**/
GIcon *
g_drive_get_symbolic_icon (GDrive *drive)
{
GDriveIface *iface;
GIcon *ret;
g_return_val_if_fail (G_IS_DRIVE (drive), NULL);
iface = G_DRIVE_GET_IFACE (drive);
if (iface->get_symbolic_icon != NULL)
ret = iface->get_symbolic_icon (drive);
else
ret = g_themed_icon_new_with_default_fallbacks ("drive-removable-media-symbolic");
return ret;
}
示例15: g_drive_stop_finish
/**
* g_drive_stop_finish:
* @drive: a #GDrive.
* @result: a #GAsyncResult.
* @error: a #GError, or %NULL
*
* Finishes stopping a drive.
*
* Returns: %TRUE if the drive has been stopped successfully,
* %FALSE otherwise.
*
* Since: 2.22
*/
gboolean
g_drive_stop_finish (GDrive *drive,
GAsyncResult *result,
GError **error)
{
GDriveIface *iface;
g_return_val_if_fail (G_IS_DRIVE (drive), FALSE);
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
if (g_async_result_legacy_propagate_error (result, error))
return FALSE;
else if (g_async_result_is_tagged (result, g_drive_start))
return g_task_propagate_boolean (G_TASK (result), error);
iface = G_DRIVE_GET_IFACE (drive);
return (* iface->stop_finish) (drive, result, error);
}