This repository has been archived by the owner on Oct 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
103 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,16 +5,10 @@ authors = ["Anurag Dhadse <[email protected]>"] | |
edition = "2021" | ||
|
||
[dependencies] | ||
log = "0.4" | ||
pretty_env_logger = "0.4" | ||
once_cell = "1.9" | ||
gtk-macros = "0.3.0" | ||
strum = "0.24.1" | ||
strum_macros = "0.24.3" | ||
futures = "0.3.28" | ||
anyhow = "1.0.70" | ||
rust-crypto = "0.2.36" | ||
tracing = "0.1" | ||
tracker = "0.1" | ||
tracing-subscriber = "0.3" | ||
relm4-macros = "0.5.1" | ||
|
||
|
@@ -39,6 +33,3 @@ version = "1.0.91" | |
package = "epub" | ||
version = "2.0.0" | ||
|
||
[build-dependencies] | ||
relm4-macros = "0.5.1" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Bookx - bookxbook.rs | ||
// Bookx - bookx_book.rs | ||
// Copyright (C) 2023 Anurag Dhadse <[email protected]> | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
|
@@ -15,12 +15,11 @@ | |
// along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
use epub::doc::{DocError, EpubDoc}; | ||
use log::debug; | ||
use relm4::{ | ||
gtk::{self, gdk_pixbuf::Pixbuf, glib, prelude::*}, | ||
ComponentParts, ComponentSender, SimpleComponent, | ||
}; | ||
use tracing::{error, info}; | ||
use tracing::error; | ||
|
||
use std::fs; | ||
use std::io::Write; | ||
|
@@ -120,9 +119,10 @@ impl BookxBook { | |
Ok(()) => { | ||
let mut f = fs::File::create(cover_path.clone()).unwrap(); | ||
let resp = f.write_all(&cover_data); | ||
debug!( | ||
tracing::debug!( | ||
"Writing book cover for: {:?}; Response: {:?}", | ||
book_path, resp | ||
book_path, | ||
resp | ||
); | ||
} | ||
Err(e) => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Bookx - library.rs | ||
// Bookx - bookx_library.rs | ||
// Copyright (C) 2023 Anurag Dhadse <[email protected]> | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
mod about; | ||
mod library; | ||
mod main_container; | ||
mod preferences; | ||
mod utils; | ||
|
||
pub use about::AboutDialog; | ||
pub use main_container::MainContainer; | ||
pub use main_container::BookxMainContainer; | ||
pub use preferences::BookxPreferences; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Bookx - preferences.rs | ||
// Copyright (C) 2023 Anurag Dhadse <[email protected]> | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
use gettextrs::gettext; | ||
use relm4::{ | ||
adw::{self, prelude::*}, | ||
gtk, ComponentParts, ComponentSender, SimpleComponent, | ||
}; | ||
|
||
pub struct BookxPreferences {} | ||
|
||
#[relm4::component(pub)] | ||
impl SimpleComponent for BookxPreferences { | ||
type Init = (); | ||
type Input = (); | ||
type Output = (); | ||
|
||
view! { | ||
#[name = "preferences_window"] | ||
adw::PreferencesWindow { | ||
set_default_width: 480, | ||
set_search_enabled: false, | ||
set_modal: true, | ||
|
||
add = &adw::PreferencesPage { | ||
set_title: &gettext("General"), | ||
|
||
add = &adw::PreferencesGroup { | ||
set_title: &gettext("Books Location"), | ||
adw::ActionRow { | ||
set_title: &gettext("Load books from folder"), | ||
#[wrap(Some)] | ||
set_activatable_widget = >k::Button::builder().valign(gtk::Align::Center).build(), | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
fn init( | ||
_: Self::Init, | ||
root: &Self::Root, | ||
_sender: ComponentSender<Self>, | ||
) -> ComponentParts<Self> { | ||
let model = Self {}; | ||
|
||
let widgets = view_output!(); | ||
|
||
ComponentParts { model, widgets } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters