diff options
author | Ricky Kresslein <rk@lakoliu.com> | 2022-09-24 00:34:54 +0200 |
---|---|---|
committer | Ricky Kresslein <rk@lakoliu.com> | 2022-09-24 00:34:54 +0200 |
commit | 87c05770789958e6786e6490eb1fa25cd116b361 (patch) | |
tree | 959c6344c99a0f85657759fd21618dff2e9673a1 /src/application.rs | |
parent | 54e7ba5b16045d4e653f392d38f045a4f7183732 (diff) | |
download | Furtherance-87c05770789958e6786e6490eb1fa25cd116b361.tar.zst |
Ability to change database location - #29
Diffstat (limited to 'src/application.rs')
-rwxr-xr-x | src/application.rs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/application.rs b/src/application.rs index 1646a34..12ea49b 100755 --- a/src/application.rs +++ b/src/application.rs @@ -131,12 +131,6 @@ impl FurtheranceApplication { })); self.add_action(&about_action); - let backup_database_action = gio::SimpleAction::new("backup-database", None); - backup_database_action.connect_activate(clone!(@weak self as app => move |_, _| { - app.backup_database(); - })); - self.add_action(&backup_database_action); - let import_database_action = gio::SimpleAction::new("import-database", None); import_database_action.connect_activate(clone!(@weak self as app => move |_, _| { app.import_database(); @@ -275,6 +269,18 @@ impl FurtheranceApplication { } } + pub fn backup_database_enabled(&self, enabled: bool) { + if enabled { + let backup_database_action = gio::SimpleAction::new("backup-database", None); + backup_database_action.connect_activate(clone!(@weak self as app => move |_, _| { + app.backup_database(); + })); + self.add_action(&backup_database_action); + } else { + self.remove_action("backup-database"); + } + } + pub fn update_light_dark(&self) { let manager = adw::StyleManager::default(); @@ -332,7 +338,6 @@ impl FurtheranceApplication { } pub fn backup_database(&self) { - // TODO Disable if db is empty let window = self.active_window().unwrap(); let dialog = gtk::FileChooserDialog::new( Some(&gettext("Backup Database")), @@ -378,7 +383,7 @@ impl FurtheranceApplication { gtk::FileChooserAction::Open, &[ (&gettext("Cancel"), gtk::ResponseType::Reject), - (&gettext("Save"), gtk::ResponseType::Accept), + (&gettext("Open"), gtk::ResponseType::Accept), ] ); dialog.set_modal(true); |