diff options
author | Ricky Kresslein <rk@lakoliu.com> | 2022-06-11 08:02:04 +0300 |
---|---|---|
committer | Ricky Kresslein <rk@lakoliu.com> | 2022-06-11 08:02:04 +0300 |
commit | 9f9ac2b47c86630d4864f9748ca0c3a1b18caff1 (patch) | |
tree | 0373abb6e3374c668ded03422a1aee04858d8989 /src/application.rs | |
parent | 2e25f23cd9d5ba2a90021c4daffbf9395fec8fb7 (diff) | |
download | Furtherance-9f9ac2b47c86630d4864f9748ca0c3a1b18caff1.tar.zst |
Export CSV disabled if no tasks
Diffstat (limited to 'src/application.rs')
-rwxr-xr-x | src/application.rs | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/application.rs b/src/application.rs index 157c432..cfacd93 100755 --- a/src/application.rs +++ b/src/application.rs @@ -163,13 +163,6 @@ impl FurtheranceApplication { imp.pomodoro_dialog.lock().unwrap().response(gtk::ResponseType::Reject); })); self.add_action(&stop_pomodoro_action); - - let export_csv_action = gio::SimpleAction::new("export-csv", None); - export_csv_action.connect_activate(clone!(@weak self as app => move |_, _| { - let window = FurtheranceWindow::default(); - window.open_csv_export_dialog(); - })); - self.add_action(&export_csv_action); } fn setup_application(&self) { @@ -257,6 +250,19 @@ impl FurtheranceApplication { } } + pub fn export_csv_enabled(&self, enabled: bool) { + if enabled { + let export_csv_action = gio::SimpleAction::new("export-csv", None); + export_csv_action.connect_activate(clone!(@weak self as app => move |_, _| { + let window = FurtheranceWindow::default(); + window.open_csv_export_dialog(); + })); + self.add_action(&export_csv_action); + } else { + self.remove_action("export-csv"); + } + } + pub fn update_light_dark(&self) { let manager = adw::StyleManager::default(); |