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