Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USB Portal #210

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
523 changes: 395 additions & 128 deletions ashpd-demo/Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion ashpd-demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ version = "0.4.1"
[dependencies]
adw = {version = "0.7.1", package = "libadwaita", features = ["v1_7"]}
anyhow = "1.0"
ashpd = {version = "^0.9", git = "https://github.com/bilelmoussaoui/ashpd", default-features = false, features = ["async-std", "gtk4", "tracing", "pipewire"]}
ashpd = {version = "^0.11", path = "..", default-features = false, features = ["async-std", "gtk4", "tracing", "pipewire"]}
chrono = {version = "0.4", default-features = false, features = ["clock"]}
futures-util = "0.3"
gettext-rs = {version = "0.7", features = ["gettext-system"]}
gst = {package = "gstreamer", version = "0.23"}
gst4gtk = {package = "gst-plugin-gtk4", version = "0.13", features = ["wayland", "x11egl", "x11glx", "gtk_v4_14"]}
gtk = {package = "gtk4", version = "0.9", features = ["v4_14"]}
rusb = "0.9.4"
serde = {version = "1.0", features = ["derive"]}
shumate = {version = "0.6", package = "libshumate"}
tracing = "0.1"
Expand Down
15 changes: 14 additions & 1 deletion ashpd-demo/build-aux/com.belmoussaoui.ashpd.demo.Devel.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"--share=ipc",
"--socket=wayland",
"--device=dri",
"--own-name=com.belmoussaoui.ashpd.demo",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this needed? Isn't this only to own names for app ids which don't match the app id?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use this build using fenv, and that allow to build and run the non "Devel" version. It's not required for this PR per see (hint it's still in draft).

"--usb=all",
"--env=RUST_LOG=ashpd_demo=debug,ashpd=debug",
"--env=G_MESSAGES_DEBUG=none",
"--env=RUST_BACKTRACE=1"
Expand All @@ -30,6 +32,16 @@
]
},
"modules": [
{
"name": "libusb",
bilelmoussaoui marked this conversation as resolved.
Show resolved Hide resolved
"sources": [
{
"type": "archive",
"url": "https://github.com/libusb/libusb/releases/download/v1.0.27/libusb-1.0.27.tar.bz2",
"sha256": "ffaa41d741a8a3bee244ac8e54a72ea05bf2879663c098c82fc5757853441575"
}
]
},
{
"name": "libshumate",
"buildsystem": "meson",
Expand All @@ -50,14 +62,15 @@
{
"name": "ashpd-demo",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rather have a change that puts the manifest in ./ and see if that helps? :)

"buildsystem": "meson",
"subdir": "ashpd-demo",
"run-tests": true,
"config-opts": [
"-Dprofile=development"
],
"sources": [
{
"type": "dir",
"path": "../"
"path": "../.."
}
]
}
Expand Down
2 changes: 2 additions & 0 deletions ashpd-demo/data/resources.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
<file compressed="true" preprocess="xml-stripblanks" alias="screenshot.ui">resources/ui/screenshot.ui</file>
<file compressed="true" preprocess="xml-stripblanks" alias="screencast.ui">resources/ui/screencast.ui</file>
<file compressed="true" preprocess="xml-stripblanks" alias="secret.ui">resources/ui/secret.ui</file>
<file compressed="true" preprocess="xml-stripblanks" alias="usb.ui">resources/ui/usb.ui</file>
<file compressed="true" preprocess="xml-stripblanks" alias="usb_device_row.ui">resources/ui/usb_device_row.ui</file>
<file compressed="true" preprocess="xml-stripblanks" alias="wallpaper.ui">resources/ui/wallpaper.ui</file>

<file compressed="true" alias="style.css">resources/style.css</file>
Expand Down
63 changes: 63 additions & 0 deletions ashpd-demo/data/resources/ui/usb.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="UsbPage" parent="PortalPage">
<child>
<object class="AdwClamp">
<child>
<object class="GtkBox">
<property name="hexpand">True</property>
<property name="spacing">12</property>
<property name="orientation">vertical</property>
<child>
<object class="AdwPreferencesGroup" id="usb_devices">
<property name="title" translatable="yes">Device Access</property>
<property name="description" translatable="yes">Calls AcquireDevices or ReleaseDevices on org.freedesktop.portal.Usb.</property>
<property name="header-suffix">
<object class="GtkButton">
<property name="label" translatable="yes">Refresh</property>
<property name="icon-name">view-refresh-symbolic</property>
<property name="action-name">usb.refresh</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<child>
<object class="GtkButton">
<property name="label">_Start Session</property>
<property name="use-underline">True</property>
<property name="halign">start</property>
<property name="action-name">usb.start_session</property>
<style>
<class name="pill" />
<class name="suggested-action" />
</style>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label">_Stop Session</property>
<property name="use-underline">True</property>
<property name="sensitive">false</property>
<property name="halign">end</property>
<property name="hexpand">true</property>
<property name="action-name">usb.stop_session</property>
<style>
<class name="pill" />
<class name="destructive-action" />
</style>
</object>
</child>
</object>
</child>
</object>
</child>
<style>
<class name="page-content" />
</style>
</object>
</child>
</template>
</interface>
31 changes: 31 additions & 0 deletions ashpd-demo/data/resources/ui/usb_device_row.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="UsbDeviceRow" parent="AdwActionRow">
<child type="prefix">
<object class="GtkCheckButton" id="checkbox">
<property name="sensitive">false</property>
</object>
</child>
<child type="suffix">
<object class="GtkBox" id="box1">
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<style>
<class name="linked" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In think the consensus is that we want to avoid linked buttons whenever possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

link (to the documentation) ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is none, ask in the #design:gnome.org room if you would like more context.

</style>
<child>
<object class="GtkButton" id="acquire">
<signal name="clicked" handler="handle_acquire_clicked" swapped="true" />
<property name="icon-name">preferences-system-sharing-symbolic</property>
</object>
</child>
<child type="suffix">
<object class="GtkButton" id="release">
<signal name="clicked" handler="handle_release_clicked" swapped="true"/>
<property name="icon-name">process-stop-symbolic</property>
</object>
</child>
</object>
</child>
</template>
</interface>
14 changes: 14 additions & 0 deletions ashpd-demo/data/resources/ui/window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@
<property name="page-name">secret</property>
</object>
</child>
<child>
<object class="SidebarRow">
<property name="title" translatable="yes">USB</property>
<property name="page-name">usb</property>
</object>
</child>
<child>
<object class="SidebarRow">
<property name="title" translatable="yes">Wallpaper</property>
Expand Down Expand Up @@ -325,6 +331,14 @@
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">usb</property>
<property name="child">
<object class="UsbPage" id="usb" />
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">wallpaper</property>
Expand Down
2 changes: 2 additions & 0 deletions ashpd-demo/src/portals/desktop/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ mod remote_desktop;
mod screencast;
mod screenshot;
mod secret;
mod usb;
mod wallpaper;

pub use account::AccountPage;
Expand All @@ -36,4 +37,5 @@ pub use remote_desktop::RemoteDesktopPage;
pub use screencast::ScreenCastPage;
pub use screenshot::ScreenshotPage;
pub use secret::SecretPage;
pub use usb::UsbPage;
pub use wallpaper::WallpaperPage;
Loading
Loading