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

Use AdwToggleGroups #246

Merged
merged 2 commits into from
Nov 17, 2024
Merged
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
2 changes: 1 addition & 1 deletion ashpd-demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name = "ashpd-demo"
version = "0.4.1"

[dependencies]
adw = {version = "0.7", package = "libadwaita", features = ["v1_6"]}
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"]}
chrono = {version = "0.4", default-features = false, features = ["clock"]}
Expand Down
5 changes: 2 additions & 3 deletions ashpd-demo/data/resources/ui/camera.ui
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,15 @@
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkStackSwitcher" id="picture_stack_switcher">
<object class="AdwInlineViewSwitcher" id="picture_stack_switcher">
<property name="stack">picture_stack</property>
<property name="hexpand">True</property>
<property name="halign">center</property>
<property name="margin-top">12</property>
<property name="margin-end">12</property>
</object>
</child>
<child>
<object class="GtkStack" id="picture_stack" />
<object class="AdwViewStack" id="picture_stack" />
</child>
</object>
</child>
Expand Down
2 changes: 1 addition & 1 deletion ashpd-demo/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ base_id = 'com.belmoussaoui.ashpd.demo'
dependency('glib-2.0', version: '>= 2.66')
dependency('gio-2.0', version: '>= 2.66')
dependency('gtk4', version: '>= 4.16.0')
dependency('libadwaita-1', version: '>= 1.6')
dependency('libadwaita-1', version: '>= 1.7.alpha')
dependency('shumate-1.0')

glib_compile_resources = find_program('glib-compile-resources', required: true)
Expand Down
10 changes: 6 additions & 4 deletions ashpd-demo/src/portals/desktop/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ mod imp {
#[template_child]
pub camera_available: TemplateChild<gtk::Label>,
#[template_child]
pub picture_stack: TemplateChild<gtk::Stack>,
pub picture_stack: TemplateChild<adw::ViewStack>,
#[template_child]
pub picture_stack_switcher: TemplateChild<gtk::StackSwitcher>,
pub picture_stack_switcher: TemplateChild<adw::InlineViewSwitcher>,
#[template_child]
pub revealer: TemplateChild<gtk::Revealer>,

Expand Down Expand Up @@ -151,8 +151,10 @@ impl CameraPage {
for paintable in imp.paintables.take() {
paintable.close_pipeline();
}
while let Some(child) = imp.picture_stack.first_child() {
imp.picture_stack.remove(&child);
let pages = imp.picture_stack.pages();
for object in pages.snapshot().iter() {
let page = object.downcast_ref::<adw::ViewStackPage>().unwrap();
imp.picture_stack.remove(&page.child());
}

imp.revealer.set_reveal_child(false);
Expand Down
Loading