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 838e67c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 26 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
31 changes: 21 additions & 10 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),
ContextToggle,
}

#[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::ContextToggle)
}
ContextPage::Settings => {
app::context_drawer::context_drawer(self.settings(), Message::ContextToggle)
.title(self.context_page.title())
}
ContextPage::TaskDetails => app::context_drawer::context_drawer(
self.details.view().map(Message::Details),
Message::ContextToggle,
)
.title(self.context_page.title()),
})
}

Expand Down Expand Up @@ -469,13 +480,13 @@ impl Application for Tasks {
}
}
Message::ToggleContextPage(context_page) => {
if self.context_page == context_page {
self.core.window.show_context = !self.core.window.show_context;
} else {
self.context_page = context_page.clone();
self.core.window.show_context = true;
if self.context_page != context_page {
self.context_page = context_page;
}
self.set_context_title(context_page.clone().title());
tasks.push(self.update(Message::ContextToggle));
}
Message::ContextToggle => {
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 838e67c

Please sign in to comment.