feat: menubar popups
This commit is contained in:
parent
abfee2c532
commit
720caa5dba
5 changed files with 1021 additions and 728 deletions
1688
Cargo.lock
generated
1688
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -92,6 +92,7 @@ default = [
|
|||
"io-uring",
|
||||
"notify",
|
||||
"wgpu",
|
||||
"wayland",
|
||||
"xz2",
|
||||
]
|
||||
dbus-config = ["libcosmic/dbus-config"]
|
||||
|
|
@ -124,10 +125,6 @@ fastrand = "2"
|
|||
test-log = "0.2"
|
||||
tokio = { version = "1", features = ["rt", "macros"] }
|
||||
|
||||
[patch.crates-io]
|
||||
# https://github.com/smol-rs/polling/pull/235
|
||||
polling = { git = "https://github.com/jackpot51/polling.git", branch = "master" }
|
||||
|
||||
# [patch.'https://github.com/pop-os/cosmic-text']
|
||||
# cosmic-text = { path = "../cosmic-text" }
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
log = "0.4"
|
||||
zbus = "4"
|
||||
zbus = "5"
|
||||
|
||||
[dependencies.cosmic-files]
|
||||
path = ".."
|
||||
default-features = false
|
||||
features = ["desktop", "gvfs", "wayland", "wgpu"]
|
||||
|
||||
|
|
|
|||
44
src/menu.rs
44
src/menu.rs
|
|
@ -387,13 +387,15 @@ pub fn dialog_menu(
|
|||
|
||||
MenuBar::new(vec![
|
||||
menu::Tree::with_children(
|
||||
widget::button::icon(widget::icon::from_name(match tab.config.view {
|
||||
tab::View::Grid => "view-grid-symbolic",
|
||||
tab::View::List => "view-list-symbolic",
|
||||
}))
|
||||
// This prevents the button from being shown as insensitive
|
||||
.on_press(Message::None)
|
||||
.padding(8),
|
||||
Element::from(
|
||||
widget::button::icon(widget::icon::from_name(match tab.config.view {
|
||||
tab::View::Grid => "view-grid-symbolic",
|
||||
tab::View::List => "view-list-symbolic",
|
||||
}))
|
||||
// This prevents the button from being shown as insensitive
|
||||
.on_press(Message::None)
|
||||
.padding(8),
|
||||
),
|
||||
menu::items(
|
||||
key_binds,
|
||||
vec![
|
||||
|
|
@ -413,14 +415,16 @@ pub fn dialog_menu(
|
|||
),
|
||||
),
|
||||
menu::Tree::with_children(
|
||||
widget::button::icon(widget::icon::from_name(if sort_direction {
|
||||
"view-sort-ascending-symbolic"
|
||||
} else {
|
||||
"view-sort-descending-symbolic"
|
||||
}))
|
||||
// This prevents the button from being shown as insensitive
|
||||
.on_press(Message::None)
|
||||
.padding(8),
|
||||
Element::from(
|
||||
widget::button::icon(widget::icon::from_name(if sort_direction {
|
||||
"view-sort-ascending-symbolic"
|
||||
} else {
|
||||
"view-sort-descending-symbolic"
|
||||
}))
|
||||
// This prevents the button from being shown as insensitive
|
||||
.on_press(Message::None)
|
||||
.padding(8),
|
||||
),
|
||||
menu::items(
|
||||
key_binds,
|
||||
vec![
|
||||
|
|
@ -459,10 +463,12 @@ pub fn dialog_menu(
|
|||
),
|
||||
),
|
||||
menu::Tree::with_children(
|
||||
widget::button::icon(widget::icon::from_name("view-more-symbolic"))
|
||||
// This prevents the button from being shown as insensitive
|
||||
.on_press(Message::None)
|
||||
.padding(8),
|
||||
Element::from(
|
||||
widget::button::icon(widget::icon::from_name("view-more-symbolic"))
|
||||
// This prevents the button from being shown as insensitive
|
||||
.on_press(Message::None)
|
||||
.padding(8),
|
||||
),
|
||||
menu::items(
|
||||
key_binds,
|
||||
vec![
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ use mime_guess::{mime, Mime};
|
|||
use once_cell::sync::Lazy;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
cell::Cell,
|
||||
cmp::Ordering,
|
||||
collections::HashMap,
|
||||
|
|
@ -1762,7 +1763,7 @@ impl Item {
|
|||
mime_apps.iter().position(|x| x.is_default),
|
||||
move |index| index,
|
||||
)
|
||||
.icons(mime_app_cache.icons(&self.mime)),
|
||||
.icons(Cow::Borrowed(mime_app_cache.icons(&self.mime))),
|
||||
)
|
||||
.map(|index| {
|
||||
let mime_app = &mime_apps[index];
|
||||
|
|
@ -1838,7 +1839,7 @@ impl Item {
|
|||
widget::settings::item::builder(user_name)
|
||||
.description(fl!("owner"))
|
||||
.control(widget::dropdown(
|
||||
&MODE_NAMES,
|
||||
Cow::Borrowed(MODE_NAMES.as_slice()),
|
||||
Some(get_mode_part(mode, MODE_SHIFT_USER).try_into().unwrap()),
|
||||
move |selected| {
|
||||
Message::SetPermissions(
|
||||
|
|
@ -1861,7 +1862,7 @@ impl Item {
|
|||
widget::settings::item::builder(group_name)
|
||||
.description(fl!("group"))
|
||||
.control(widget::dropdown(
|
||||
&MODE_NAMES,
|
||||
Cow::Borrowed(MODE_NAMES.as_slice()),
|
||||
Some(get_mode_part(mode, MODE_SHIFT_GROUP).try_into().unwrap()),
|
||||
move |selected| {
|
||||
Message::SetPermissions(
|
||||
|
|
@ -1879,7 +1880,7 @@ impl Item {
|
|||
let other_path = path.clone();
|
||||
settings.push(widget::settings::item::builder(fl!("other")).control(
|
||||
widget::dropdown(
|
||||
&MODE_NAMES,
|
||||
Cow::Borrowed(MODE_NAMES.as_slice()),
|
||||
Some(get_mode_part(mode, MODE_SHIFT_OTHER).try_into().unwrap()),
|
||||
move |selected| {
|
||||
Message::SetPermissions(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue