Skip to content

Commit

Permalink
fix: examples
Browse files Browse the repository at this point in the history
  • Loading branch information
edfloreshz authored and wash2 committed Nov 18, 2024
1 parent e7b9c64 commit f3d9e4c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion examples/context-menu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ tracing-log = "0.2.0"
[dependencies.libcosmic]
path = "../../"
default-features = false
features = ["debug", "winit", "tokio", "xdg-portal"]
features = ["debug", "winit", "tokio", "xdg-portal", "multi-window"]
11 changes: 8 additions & 3 deletions examples/context-menu/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ impl cosmic::Application for App {
};

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)
}
Expand Down Expand Up @@ -108,18 +112,19 @@ impl App {
Some(menu::items(
&HashMap::new(),
vec![
menu::Item::Button("New window", ContextMenuAction::WindowNew),
menu::Item::Button("New window", None, ContextMenuAction::WindowNew),
menu::Item::Divider,
menu::Item::Folder(
"View",
vec![menu::Item::CheckBox(
"Hide content",
None,
self.hide_content,
ContextMenuAction::ToggleHideContent,
)],
),
menu::Item::Divider,
menu::Item::Button("Quit", ContextMenuAction::WindowClose),
menu::Item::Button("Quit", None, ContextMenuAction::WindowClose),
],
))
}
Expand Down
2 changes: 1 addition & 1 deletion examples/menu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ tracing-log = "0.2.0"
[dependencies.libcosmic]
path = "../../"
default-features = false
features = ["debug", "winit", "tokio", "xdg-portal"]
features = ["debug", "winit", "tokio", "xdg-portal", "multi-window"]
2 changes: 1 addition & 1 deletion examples/nav-context/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ tracing-log = "0.2.0"
[dependencies.libcosmic]
path = "../../"
default-features = false
features = ["debug", "winit", "tokio", "xdg-portal"]
features = ["debug", "winit", "tokio", "xdg-portal", "multi-window"]
12 changes: 8 additions & 4 deletions examples/nav-context/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ impl cosmic::Application for App {
Some(menu::items(
&HashMap::new(),
vec![
menu::Item::Button("Move Up", NavMenuAction::MoveUp(id)),
menu::Item::Button("Move Down", NavMenuAction::MoveDown(id)),
menu::Item::Button("Delete", NavMenuAction::Delete(id)),
menu::Item::Button("Move Up", None, NavMenuAction::MoveUp(id)),
menu::Item::Button("Move Down", None, NavMenuAction::MoveDown(id)),
menu::Item::Button("Delete", None, NavMenuAction::Delete(id)),
],
))
}
Expand Down Expand Up @@ -204,6 +204,10 @@ where
let header_title = self.active_page_title().to_owned();
let window_title = format!("{header_title} — COSMIC AppDemo");
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()
}
}
}

0 comments on commit f3d9e4c

Please sign in to comment.