camera: Make headerbar transparent

We add a bit of black so that the buttons are visible. We also increase
the size of the floating button.
This commit is contained in:
Maximiliano Sandoval R 2023-06-20 23:24:26 +02:00
parent b3517fa1b1
commit 960f54dafc
Failed to generate hash of commit
3 changed files with 22 additions and 1 deletions

View file

@ -16,3 +16,15 @@
box-shadow: none;
}
camera toolbarview.extended headerbar button.back {
border-radius: 500px;
}
camera toolbarview.extended headerbar {
background: rgba(0, 0, 0, 0.45);
}
camera .selectionbutton {
min-height: 44px;
min-width: 44px;
}

View file

@ -2,7 +2,7 @@
<interface>
<template parent="AdwBin" class="Camera">
<child>
<object class="AdwToolbarView">
<object class="AdwToolbarView" id="toolbar_view">
<child type="top">
<object class="AdwHeaderBar">
<property name="show-title">False</property>
@ -71,6 +71,7 @@
<style>
<class name="osd" />
<class name="circular" />
<class name="selectionbutton" />
</style>
</object>
</child>

View file

@ -92,6 +92,8 @@ mod imp {
pub screenshot: TemplateChild<gtk::Button>,
#[template_child]
pub camera_selection_button: TemplateChild<gtk::MenuButton>,
#[template_child]
pub toolbar_view: TemplateChild<adw::ToolbarView>,
pub stream_list: gio::ListStore,
pub selection: gtk::SingleSelection,
}
@ -103,6 +105,7 @@ mod imp {
type ParentType = adw::Bin;
fn class_init(klass: &mut Self::Class) {
klass.set_css_name("camera");
klass.bind_template();
klass.bind_template_instance_callbacks();
}
@ -123,6 +126,7 @@ mod imp {
stack: TemplateChild::default(),
picture: TemplateChild::default(),
screenshot: TemplateChild::default(),
toolbar_view: TemplateChild::default(),
stream_list: gio::ListStore::new(glib::BoxedAnyObject::static_type()),
selection: Default::default(),
}
@ -280,10 +284,14 @@ impl Camera {
CameraState::NotFound => {
tracing::info!("The camera state changed: Not Found");
imp.stack.set_visible_child_name("not-found");
imp.toolbar_view.set_extend_content_to_top_edge(false);
imp.toolbar_view.remove_css_class("extended");
}
CameraState::Ready => {
tracing::info!("The camera state changed: Ready");
imp.stack.set_visible_child_name("stream");
imp.toolbar_view.set_extend_content_to_top_edge(true);
imp.toolbar_view.add_css_class("extended");
imp.spinner.stop();
}
}