Skip to content

Commit

Permalink
chore: update libcosmic
Browse files Browse the repository at this point in the history
  • Loading branch information
edfloreshz committed Nov 18, 2024
1 parent 07d4fec commit 98d44c4
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 22 deletions.
30 changes: 15 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ thiserror = "1.0.65"
[dependencies.libcosmic]
git = "https://github.com/pop-os/libcosmic.git"
default-features = false
features = ["multi-window", "tokio", "winit", "wgpu", "desktop"]
features = ["multi-window", "tokio", "winit", "wgpu", "about"]

[dependencies.i18n-embed]
version = "0.14"
Expand Down
25 changes: 19 additions & 6 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::core::models::Task;
use crate::core::service::{Provider, TaskService};
use chrono::{Local, NaiveDate};
use cli_clipboard::{ClipboardContext, ClipboardProvider};
use cosmic::app::context_drawer::ContextDrawer;
use cosmic::app::{message, Core, Message as CosmicMessage};
use cosmic::cosmic_config::Update;
use cosmic::cosmic_theme::ThemeMode;
Expand Down Expand Up @@ -62,6 +63,7 @@ pub enum Message {
ToggleContextPage(ContextPage),
Application(ApplicationAction),
Open(String),
ToggleContextDrawer,
}

#[derive(Debug, Clone)]
Expand Down Expand Up @@ -272,15 +274,24 @@ impl Application for Tasks {
(app, app::Task::batch(tasks))
}

fn context_drawer(&self) -> Option<Element<Message>> {
fn context_drawer(&self) -> Option<ContextDrawer<Self::Message>> {
if !self.core.window.show_context {
return None;
}

Some(match self.context_page {
ContextPage::About => widget::about(&self.about, Message::Open),
ContextPage::Settings => self.settings(),
ContextPage::TaskDetails => self.details.view().map(Message::Details),
ContextPage::About => {
app::context_drawer::about(&self.about, Message::Open, Message::ToggleContextDrawer)
}
ContextPage::Settings => {
app::context_drawer::context_drawer(self.settings(), Message::ToggleContextDrawer)
.title(self.context_page.title())
}
ContextPage::TaskDetails => app::context_drawer::context_drawer(
self.details.view().map(Message::Details),
Message::ToggleContextDrawer,
)
.title(self.context_page.title()),
})
}

Expand Down Expand Up @@ -472,10 +483,12 @@ impl Application for Tasks {
if self.context_page == context_page {
self.core.window.show_context = !self.core.window.show_context;
} else {
self.context_page = context_page.clone();
self.context_page = context_page;
self.core.window.show_context = true;
}
self.set_context_title(context_page.clone().title());
}
Message::ToggleContextDrawer => {
self.core.window.show_context = !self.core.window.show_context
}
Message::Dialog(dialog_action) => match dialog_action {
DialogAction::Open(page) => {
Expand Down

0 comments on commit 98d44c4

Please sign in to comment.