Skip to content

Commit

Permalink
docs: Update links
Browse files Browse the repository at this point in the history
  • Loading branch information
bilelmoussaoui committed Jan 6, 2024
1 parent 430eea2 commit dfb8237
Show file tree
Hide file tree
Showing 36 changed files with 269 additions and 188 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@

ASHPD, acronym of Aperture Science Handheld Portal Device is a Rust & [zbus](https://gitlab.freedesktop.org/dbus/zbus) wrapper of
the XDG portals DBus interfaces. The library aims to provide an easy way to
interact with the various portals defined per the [specifications](https://flatpak.github.io/xdg-desktop-portal/index.html).
interact with the various portals defined per the [specifications](https://flatpak.github.io/xdg-desktop-portal/docs/).
It provides an alternative to the C library [https://github.com/flatpak/libportal](https://github.com/flatpak/libportal)

## Examples

Ask the compositor to pick a color

```rust,no_run
use ashpd::desktop::screenshot::Color;
use ashpd::desktop::Color;
async fn run() -> ashpd::Result<()> {
let color = Color::request().send().await?.response()?;
let color = Color::pick().send().await?.response()?;
println!("({}, {}, {})", color.red(), color.green(), color.blue());
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion src/desktop/account.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Access to the current logged user information such as the id, name
//! or their avatar uri.
//!
//! Wrapper of the DBus interface: [`org.freedesktop.portal.Account`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-org.freedesktop.portal.Account).
//! Wrapper of the DBus interface: [`org.freedesktop.portal.Account`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Account.html).
//!
//! ### Examples
//!
Expand Down
6 changes: 3 additions & 3 deletions src/desktop/background.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//!
//! **Note** This portal only works for sandboxed applications.
//!
//! Wrapper of the DBus interface: [`org.freedesktop.portal.Background`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-org.freedesktop.portal.Background).
//! Wrapper of the DBus interface: [`org.freedesktop.portal.Background`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Background.html).
//!
//! ### Examples
//!
Expand Down Expand Up @@ -86,7 +86,7 @@ struct SetStatusOptions {
/// is allowed to run in the background or started automatically when the user
/// logs in.
///
/// Wrapper of the DBus interface: [`org.freedesktop.portal.Background`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-org.freedesktop.portal.Background).
/// Wrapper of the DBus interface: [`org.freedesktop.portal.Background`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Background.html).
#[doc(alias = "org.freedesktop.portal.Background")]
pub struct BackgroundProxy<'a>(Proxy<'a>);

Expand All @@ -111,7 +111,7 @@ impl<'a> BackgroundProxy<'a> {
///
/// # Specifications
///
/// See also [`SetStatus`](https://flatpak.github.io/xdg-desktop-portal/#gdbus-method-org-freedesktop-portal-Background.SetStatus).
/// See also [`SetStatus`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Background.html#org-freedesktop-portal-background-setstatus).

pub async fn set_status(&self, message: &str) -> Result<(), Error> {
self.0
Expand Down
8 changes: 4 additions & 4 deletions src/desktop/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct CameraAccessOptions {
/// The interface lets sandboxed applications access camera devices, such as web
/// cams.
///
/// Wrapper of the DBus interface: [`org.freedesktop.portal.Camera`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-org.freedesktop.portal.Camera).
/// Wrapper of the DBus interface: [`org.freedesktop.portal.Camera`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Camera.html).
#[derive(Debug)]
#[doc(alias = "org.freedesktop.portal.Camera")]
pub struct Camera<'a>(Proxy<'a>);
Expand All @@ -54,7 +54,7 @@ impl<'a> Camera<'a> {
///
/// # Specifications
///
/// See also [`AccessCamera`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-method-org-freedesktop-portal-Camera.AccessCamera).
/// See also [`AccessCamera`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Camera.html#org-freedesktop-portal-camera-accesscamera).
#[doc(alias = "AccessCamera")]
#[doc(alias = "xdp_portal_access_camera")]
pub async fn request_access(&self) -> Result<Request<()>, Error> {
Expand All @@ -73,7 +73,7 @@ impl<'a> Camera<'a> {
///
/// # Specifications
///
/// See also [`OpenPipeWireRemote`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-method-org-freedesktop-portal-Camera.OpenPipeWireRemote).
/// See also [`OpenPipeWireRemote`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Camera.html#org-freedesktop-portal-camera-openpipewireremote).
#[doc(alias = "OpenPipeWireRemote")]
#[doc(alias = "xdp_portal_open_pipewire_remote_for_camera")]
pub async fn open_pipe_wire_remote(&self) -> Result<RawFd, Error> {
Expand All @@ -91,7 +91,7 @@ impl<'a> Camera<'a> {
///
/// # Specifications
///
/// See also [`IsCameraPresent`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-property-org-freedesktop-portal-Camera.IsCameraPresent).
/// See also [`IsCameraPresent`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Camera.html#org-freedesktop-portal-camera-iscamerapresent).
#[doc(alias = "IsCameraPresent")]
#[doc(alias = "xdp_portal_is_camera_present")]
pub async fn is_present(&self) -> Result<bool, Error> {
Expand Down
16 changes: 8 additions & 8 deletions src/desktop/clipboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl SelectionOwnerChanged {
}

#[doc(alias = "org.freedesktop.portal.Clipboard")]
/// Wrapper of the DBus interface: [`org.freedesktop.portal.Clipboard`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-org.freedesktop.portal.Clipboard).
/// Wrapper of the DBus interface: [`org.freedesktop.portal.Clipboard`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Clipboard.html).
pub struct Clipboard<'a>(Proxy<'a>);

impl<'a> Clipboard<'a> {
Expand All @@ -51,7 +51,7 @@ impl<'a> Clipboard<'a> {

/// # Specifications
///
/// See also [`RequestClipboard`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-method-org-freedesktop-portal-Clipboard.RequestClipboard).
/// See also [`RequestClipboard`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Clipboard.html#org-freedesktop-portal-clipboard-requestclipboard).
#[doc(alias = "RequestClipboard")]
pub async fn request(&self, session: &Session<'_>) -> Result<()> {
let options: HashMap<&str, Value<'_>> = HashMap::default();
Expand All @@ -63,7 +63,7 @@ impl<'a> Clipboard<'a> {

/// # Specifications
///
/// See also [`RequestClipboard`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-method-org-freedesktop-portal-Clipboard.RequestClipboard).
/// See also [`SetSelection`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Clipboard.html#org-freedesktop-portal-clipboard-setselection).
#[doc(alias = "SetSelection")]
pub async fn set_selection(&self, session: &Session<'_>, mime_types: &[&str]) -> Result<()> {
let options = SetSelectionOptions { mime_types };
Expand All @@ -74,7 +74,7 @@ impl<'a> Clipboard<'a> {

/// # Specifications
///
/// See also [`SelectionWrite`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-method-org-freedesktop-portal-Clipboard.SelectionWrite).
/// See also [`SelectionWrite`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Clipboard.html#org-freedesktop-portal-clipboard-selectionwrite).
#[doc(alias = "SelectionWrite")]
pub async fn selection_write(&self, session: &Session<'_>, serial: u32) -> Result<OwnedFd> {
let fd = self
Expand All @@ -86,7 +86,7 @@ impl<'a> Clipboard<'a> {

/// # Specifications
///
/// See also [`SelectionWriteDone`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-method-org-freedesktop-portal-Clipboard.SelectionWriteDone).
/// See also [`SelectionWriteDone`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Clipboard.html#org-freedesktop-portal-clipboard-selectionwritedone).
#[doc(alias = "SelectionWriteDone")]
pub async fn selection_write_done(
&self,
Expand All @@ -101,7 +101,7 @@ impl<'a> Clipboard<'a> {

/// # Specifications
///
/// See also [`SelectionRead`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-method-org-freedesktop-portal-Clipboard.SelectionRead).
/// See also [`SelectionRead`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Clipboard.html#org-freedesktop-portal-clipboard-selectionread).
#[doc(alias = "SelectionRead")]
pub async fn selection_read(&self, session: &Session<'_>, mime_type: &str) -> Result<OwnedFd> {
let fd = self
Expand All @@ -114,7 +114,7 @@ impl<'a> Clipboard<'a> {
/// Notifies the session that the clipboard selection has changed.
/// # Specifications
///
/// See also [`SelectionOwnerChanged`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-signal-org-freedesktop-portal-Clipboard.SelectionOwnerChanged).
/// See also [`SelectionOwnerChanged`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Clipboard.html#org-freedesktop-portal-clipboard-selectionownerchanged).
#[doc(alias = "SelectionOwnerChanged")]
pub async fn receive_selection_owner_changed(
&self,
Expand All @@ -128,7 +128,7 @@ impl<'a> Clipboard<'a> {

/// # Specifications
///
/// See also [`SelectionTransfer`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-signal-org-freedesktop-portal-Clipboard.SelectionTransfer).
/// See also [`SelectionTransfer`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Clipboard.html#org-freedesktop-portal-clipboard-selectiontransfer).
#[doc(alias = "SelectionTransfer")]
pub async fn receive_selection_transfer(
&self,
Expand Down
4 changes: 2 additions & 2 deletions src/desktop/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl FromStr for Device {
/// sense, since the API is not directly accessible to applications inside the
/// sandbox.
///
/// Wrapper of the DBus interface: [`org.freedesktop.portal.Device`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-org.freedesktop.portal.Device).
/// Wrapper of the DBus interface: [`org.freedesktop.portal.Device`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Device.html).
#[derive(Debug)]
#[doc(alias = "org.freedesktop.portal.Device")]
pub struct DeviceProxy<'a>(Proxy<'a>);
Expand All @@ -118,7 +118,7 @@ impl<'a> DeviceProxy<'a> {
///
/// # Specifications
///
/// See also [`AccessDevice`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-method-org-freedesktop-portal-Device.AccessDevice).
/// See also [`AccessDevice`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Device.html#org-freedesktop-portal-device-accessdevice).
#[doc(alias = "AccessDevice")]
pub async fn access_device(&self, pid: u32, devices: &[Device]) -> Result<Request<()>, Error> {
let options = AccessDeviceOptions::default();
Expand Down
18 changes: 9 additions & 9 deletions src/desktop/dynamic_launcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl std::fmt::Display for UnexpectedIconError {
/// The interface lets sandboxed applications install launchers like Web
/// Application from your browser or Steam.
///
/// Wrapper of the DBus interface: [`org.freedesktop.portal.DynamicLauncher`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-org.freedesktop.portal.DynamicLauncher).
/// Wrapper of the DBus interface: [`org.freedesktop.portal.DynamicLauncher`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.DynamicLauncher.html).
#[derive(Debug)]
#[doc(alias = "org.freedesktop.portal.DynamicLauncher")]
pub struct DynamicLauncherProxy<'a>(Proxy<'a>);
Expand All @@ -220,7 +220,7 @@ impl<'a> DynamicLauncherProxy<'a> {
///
/// # Specifications
///
/// See also [`PrepareInstall`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-method-org-freedesktop-portal-DynamicLauncher.PrepareInstall).
/// See also [`PrepareInstall`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.DynamicLauncher.html#org-freedesktop-portal-dynamiclauncher-prepareinstall).
#[doc(alias = "PrepareInstall")]
#[doc(alias = "xdp_portal_dynamic_launcher_prepare_install")]
#[doc(alias = "xdp_portal_dynamic_launcher_prepare_install_finish")]
Expand Down Expand Up @@ -248,7 +248,7 @@ impl<'a> DynamicLauncherProxy<'a> {
///
/// # Specifications
///
/// See also [`RequestInstallToken`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-method-org-freedesktop-portal-DynamicLauncher.RequestInstallToken).
/// See also [`RequestInstallToken`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.DynamicLauncher.html#org-freedesktop-portal-dynamiclauncher-requestinstalltoken).
#[doc(alias = "RequestInstallToken")]
#[doc(alias = "xdp_portal_dynamic_launcher_request_install_token")]
pub async fn request_install_token(&self, name: &str, icon: Icon) -> Result<String, Error> {
Expand All @@ -265,7 +265,7 @@ impl<'a> DynamicLauncherProxy<'a> {

/// # Specifications
///
/// See also [`Install`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-method-org-freedesktop-portal-DynamicLauncher.Install).
/// See also [`Install`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.DynamicLauncher.html#org-freedesktop-portal-dynamiclauncher-install).
#[doc(alias = "Install")]
#[doc(alias = "xdp_portal_dynamic_launcher_install")]
pub async fn install(
Expand All @@ -283,7 +283,7 @@ impl<'a> DynamicLauncherProxy<'a> {

/// # Specifications
///
/// See also [`Uninstall`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-method-org-freedesktop-portal-DynamicLauncher.Uninstall).
/// See also [`Uninstall`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.DynamicLauncher.html#org-freedesktop-portal-dynamiclauncher-uninstall).
#[doc(alias = "Uninstall")]
#[doc(alias = "xdp_portal_dynamic_launcher_uninstall")]
pub async fn uninstall(&self, desktop_file_id: &str) -> Result<(), Error> {
Expand All @@ -296,7 +296,7 @@ impl<'a> DynamicLauncherProxy<'a> {

/// # Specifications
///
/// See also [`GetDesktopEntry`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-method-org-freedesktop-portal-DynamicLauncher.GetDesktopEntry).
/// See also [`GetDesktopEntry`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.DynamicLauncher.html#org-freedesktop-portal-dynamiclauncher-getdesktopentry).
#[doc(alias = "GetDesktopEntry")]
#[doc(alias = "xdp_portal_dynamic_launcher_get_desktop_entry")]
pub async fn desktop_entry(&self, desktop_file_id: &str) -> Result<String, Error> {
Expand All @@ -305,7 +305,7 @@ impl<'a> DynamicLauncherProxy<'a> {

/// # Specifications
///
/// See also [`GetIcon`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-method-org-freedesktop-portal-DynamicLauncher.GetIcon).
/// See also [`GetIcon`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.DynamicLauncher.html#org-freedesktop-portal-dynamiclauncher-geticon).
#[doc(alias = "GetIcon")]
#[doc(alias = "xdp_portal_dynamic_launcher_get_icon")]
pub async fn icon(&self, desktop_file_id: &str) -> Result<LauncherIcon, Error> {
Expand All @@ -314,7 +314,7 @@ impl<'a> DynamicLauncherProxy<'a> {

/// # Specifications
///
/// See also [`Launch`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-method-org-freedesktop-portal-DynamicLauncher.Launch).
/// See also [`Launch`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.DynamicLauncher.html#org-freedesktop-portal-dynamiclauncher-launch).
#[doc(alias = "Launch")]
#[doc(alias = "xdp_portal_dynamic_launcher_launch")]
pub async fn launch(&self, desktop_file_id: &str) -> Result<(), Error> {
Expand All @@ -325,7 +325,7 @@ impl<'a> DynamicLauncherProxy<'a> {

/// # Specifications
///
/// See also [`SupportedLauncherTypes`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-property-org-freedesktop-portal-DynamicLauncher.SupportedLauncherTypes).
/// See also [`SupportedLauncherTypes`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.DynamicLauncher.html#org-freedesktop-portal-dynamiclauncher-supportedlaunchertypes).
#[doc(alias = "SupportedLauncherTypes")]
pub async fn supported_launcher_types(&self) -> Result<BitFlags<LauncherType>, Error> {
self.0
Expand Down
15 changes: 13 additions & 2 deletions src/desktop/email.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Compose an email.
//!
//! Wrapper of the DBus interface: [`org.freedesktop.portal.Email`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-org.freedesktop.portal.Email).
//! Wrapper of the DBus interface: [`org.freedesktop.portal.Email`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Email.html).
//!
//! # Examples
//!
Expand Down Expand Up @@ -43,6 +43,8 @@ struct EmailOptions {
subject: Option<String>,
body: Option<String>,
attachment_fds: Option<Vec<Fd>>,
// TODO Expose activation_token in the api
activation_token: Option<String>,
}

#[derive(Debug)]
Expand All @@ -68,7 +70,7 @@ impl<'a> EmailProxy<'a> {
///
/// # Specifications
///
/// See also [`ComposeEmail`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-method-org-freedesktop-portal-Email.ComposeEmail).
/// See also [`ComposeEmail`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Email.html#org-freedesktop-portal-email-composeemail).
#[doc(alias = "ComposeEmail")]
pub async fn compose(
&self,
Expand Down Expand Up @@ -175,6 +177,15 @@ impl EmailRequest {
self
}

// TODO Added in version 4 of the interface.
/// Sets the activation token.
#[allow(dead_code)]
#[must_use]
fn activation_token<'a>(mut self, activation_token: impl Into<Option<&'a str>>) -> Self {
self.options.activation_token = activation_token.into().map(ToOwned::to_owned);
self
}

/// A different variant of [`Self::attach`].
pub fn add_attachment(&mut self, attachment: &impl AsRawFd) {
let attachment = Fd::from(attachment.as_raw_fd());
Expand Down
2 changes: 1 addition & 1 deletion src/desktop/file_chooser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! outside the sandbox. The portal backend will present the user with a file
//! chooser dialog.
//!
//! Wrapper of the DBus interface: [`org.freedesktop.portal.FileChooser`](https://flatpak.github.io/xdg-desktop-portal/index.html#gdbus-org.freedesktop.portal.FileChooser).
//! Wrapper of the DBus interface: [`org.freedesktop.portal.FileChooser`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.FileChooser.html).
//!
//! ### Examples
//!
Expand Down
Loading

0 comments on commit dfb8237

Please sign in to comment.