fix: examples
This commit is contained in:
parent
e7b9c6493a
commit
f3d9e4c0d3
5 changed files with 19 additions and 10 deletions
|
|
@ -11,4 +11,4 @@ tracing-log = "0.2.0"
|
||||||
[dependencies.libcosmic]
|
[dependencies.libcosmic]
|
||||||
path = "../../"
|
path = "../../"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["debug", "winit", "tokio", "xdg-portal"]
|
features = ["debug", "winit", "tokio", "xdg-portal", "multi-window"]
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,11 @@ impl cosmic::Application for App {
|
||||||
};
|
};
|
||||||
|
|
||||||
app.set_header_title("COSMIC Context Menu Demo".into());
|
app.set_header_title("COSMIC Context Menu Demo".into());
|
||||||
let command = app.set_window_title("COSMIC Context Menu Demo".into());
|
let command = if let Some(win_id) = app.core.main_window_id() {
|
||||||
|
app.set_window_title("COSMIC Context Menu Demo".into(), win_id)
|
||||||
|
} else {
|
||||||
|
Task::none()
|
||||||
|
};
|
||||||
|
|
||||||
(app, command)
|
(app, command)
|
||||||
}
|
}
|
||||||
|
|
@ -108,18 +112,19 @@ impl App {
|
||||||
Some(menu::items(
|
Some(menu::items(
|
||||||
&HashMap::new(),
|
&HashMap::new(),
|
||||||
vec![
|
vec![
|
||||||
menu::Item::Button("New window", ContextMenuAction::WindowNew),
|
menu::Item::Button("New window", None, ContextMenuAction::WindowNew),
|
||||||
menu::Item::Divider,
|
menu::Item::Divider,
|
||||||
menu::Item::Folder(
|
menu::Item::Folder(
|
||||||
"View",
|
"View",
|
||||||
vec![menu::Item::CheckBox(
|
vec![menu::Item::CheckBox(
|
||||||
"Hide content",
|
"Hide content",
|
||||||
|
None,
|
||||||
self.hide_content,
|
self.hide_content,
|
||||||
ContextMenuAction::ToggleHideContent,
|
ContextMenuAction::ToggleHideContent,
|
||||||
)],
|
)],
|
||||||
),
|
),
|
||||||
menu::Item::Divider,
|
menu::Item::Divider,
|
||||||
menu::Item::Button("Quit", ContextMenuAction::WindowClose),
|
menu::Item::Button("Quit", None, ContextMenuAction::WindowClose),
|
||||||
],
|
],
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,4 +11,4 @@ tracing-log = "0.2.0"
|
||||||
[dependencies.libcosmic]
|
[dependencies.libcosmic]
|
||||||
path = "../../"
|
path = "../../"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["debug", "winit", "tokio", "xdg-portal"]
|
features = ["debug", "winit", "tokio", "xdg-portal", "multi-window"]
|
||||||
|
|
|
||||||
|
|
@ -11,4 +11,4 @@ tracing-log = "0.2.0"
|
||||||
[dependencies.libcosmic]
|
[dependencies.libcosmic]
|
||||||
path = "../../"
|
path = "../../"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["debug", "winit", "tokio", "xdg-portal"]
|
features = ["debug", "winit", "tokio", "xdg-portal", "multi-window"]
|
||||||
|
|
|
||||||
|
|
@ -135,9 +135,9 @@ impl cosmic::Application for App {
|
||||||
Some(menu::items(
|
Some(menu::items(
|
||||||
&HashMap::new(),
|
&HashMap::new(),
|
||||||
vec![
|
vec![
|
||||||
menu::Item::Button("Move Up", NavMenuAction::MoveUp(id)),
|
menu::Item::Button("Move Up", None, NavMenuAction::MoveUp(id)),
|
||||||
menu::Item::Button("Move Down", NavMenuAction::MoveDown(id)),
|
menu::Item::Button("Move Down", None, NavMenuAction::MoveDown(id)),
|
||||||
menu::Item::Button("Delete", NavMenuAction::Delete(id)),
|
menu::Item::Button("Delete", None, NavMenuAction::Delete(id)),
|
||||||
],
|
],
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
@ -204,6 +204,10 @@ where
|
||||||
let header_title = self.active_page_title().to_owned();
|
let header_title = self.active_page_title().to_owned();
|
||||||
let window_title = format!("{header_title} — COSMIC AppDemo");
|
let window_title = format!("{header_title} — COSMIC AppDemo");
|
||||||
self.set_header_title(header_title);
|
self.set_header_title(header_title);
|
||||||
self.set_window_title(window_title)
|
if let Some(win_id) = self.core.main_window_id() {
|
||||||
|
self.set_window_title(window_title, win_id)
|
||||||
|
} else {
|
||||||
|
Task::none()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue