diff --git a/gnome/src/app.rs b/gnome/src/app.rs index 149feb1..4421882 100644 --- a/gnome/src/app.rs +++ b/gnome/src/app.rs @@ -1,4 +1,4 @@ -use crate::{about, search_window::SearchWindow, shortcuts}; +use crate::ui; use adw::prelude::*; use gtk::{ gdk, @@ -18,7 +18,7 @@ pub fn start(app: &adw::Application, files: &[gio::File]) { STYLE_PROVIDER_PRIORITY_APPLICATION, ); - let window = SearchWindow::new(app); + let window = ui::SearchWindow::new(app); if let Some(dir) = files.first() { if let Some(path) = dir.path() { @@ -32,7 +32,7 @@ pub fn start(app: &adw::Application, files: &[gio::File]) { about_action.connect_activate(clone!( #[weak] window, - move |_, _| about::dialog().present(Some(&window)) + move |_, _| ui::about_dialog().present(Some(&window)) )); app.add_action(&about_action); @@ -41,7 +41,7 @@ pub fn start(app: &adw::Application, files: &[gio::File]) { #[weak] window, move |_, _| { - shortcuts::show_shortcuts(&window); + ui::show_shortcuts(&window); } )); app.add_action(&shortcuts_action); diff --git a/gnome/src/main.rs b/gnome/src/main.rs index 3402038..c191911 100644 --- a/gnome/src/main.rs +++ b/gnome/src/main.rs @@ -2,13 +2,10 @@ use adw::prelude::*; use gtk::gio::ApplicationFlags; use std::path::PathBuf; -mod about; mod app; mod config; -mod error_window; mod search; -mod search_window; -mod shortcuts; +mod ui; const APP_ID: &str = env!("APP_ID"); diff --git a/gnome/src/about.rs b/gnome/src/ui/about.rs similarity index 94% rename from gnome/src/about.rs rename to gnome/src/ui/about.rs index d32fc0b..36e2a9f 100644 --- a/gnome/src/about.rs +++ b/gnome/src/ui/about.rs @@ -8,7 +8,7 @@ static RELEASE_NOTES: &str = r#" "#; -pub fn dialog() -> adw::AboutDialog { +pub fn about_dialog() -> adw::AboutDialog { adw::AboutDialog::builder() .application_name("Clapgrep") .version("1.2") diff --git a/gnome/src/error_window/error_window.blp b/gnome/src/ui/error_window/error_window.blp similarity index 100% rename from gnome/src/error_window/error_window.blp rename to gnome/src/ui/error_window/error_window.blp diff --git a/gnome/src/error_window/imp.rs b/gnome/src/ui/error_window/imp.rs similarity index 91% rename from gnome/src/error_window/imp.rs rename to gnome/src/ui/error_window/imp.rs index 469ece4..2bb2aa8 100644 --- a/gnome/src/error_window/imp.rs +++ b/gnome/src/ui/error_window/imp.rs @@ -4,10 +4,10 @@ use glib::subclass::InitializingObject; use gtk::{glib, CompositeTemplate}; use std::cell::RefCell; -use crate::search_window::SearchWindow; +use crate::ui::SearchWindow; #[derive(CompositeTemplate, glib::Properties, Default)] -#[template(file = "src/error_window/error_window.blp")] +#[template(file = "src/ui/error_window/error_window.blp")] #[properties(wrapper_type = super::ErrorWindow)] pub struct ErrorWindow { #[property(get, set)] diff --git a/gnome/src/error_window/mod.rs b/gnome/src/ui/error_window/mod.rs similarity index 94% rename from gnome/src/error_window/mod.rs rename to gnome/src/ui/error_window/mod.rs index 8661392..93fcde0 100644 --- a/gnome/src/error_window/mod.rs +++ b/gnome/src/ui/error_window/mod.rs @@ -3,7 +3,7 @@ mod imp; use glib::Object; use gtk::{gio, glib, prelude::*}; -use crate::search_window::SearchWindow; +use crate::ui::SearchWindow; glib::wrapper! { pub struct ErrorWindow(ObjectSubclass) diff --git a/gnome/src/ui/mod.rs b/gnome/src/ui/mod.rs new file mode 100644 index 0000000..d8d84f7 --- /dev/null +++ b/gnome/src/ui/mod.rs @@ -0,0 +1,11 @@ +mod about; +pub use about::about_dialog; + +mod shortcuts; +pub use shortcuts::show_shortcuts; + +mod error_window; +pub use error_window::ErrorWindow; + +mod search_window; +pub use search_window::SearchWindow; diff --git a/gnome/src/search_window/imp.rs b/gnome/src/ui/search_window/imp.rs similarity index 98% rename from gnome/src/search_window/imp.rs rename to gnome/src/ui/search_window/imp.rs index 688c197..7a529e9 100644 --- a/gnome/src/search_window/imp.rs +++ b/gnome/src/ui/search_window/imp.rs @@ -1,4 +1,4 @@ -use crate::{config::Config, error_window::ErrorWindow, search::SearchModel}; +use crate::{config::Config, search::SearchModel, ui::ErrorWindow}; use adw::subclass::prelude::*; use clapgrep_core::{SearchEngine, SearchFlags, SearchMessage, SearchParameters}; use glib::subclass::InitializingObject; @@ -15,7 +15,7 @@ use std::{ }; #[derive(CompositeTemplate, glib::Properties, Default)] -#[template(file = "src/search_window/search_window.blp")] +#[template(file = "src/ui/search_window/search_window.blp")] #[properties(wrapper_type = super::SearchWindow)] pub struct SearchWindow { #[property(get, set)] diff --git a/gnome/src/search_window/mod.rs b/gnome/src/ui/search_window/mod.rs similarity index 100% rename from gnome/src/search_window/mod.rs rename to gnome/src/ui/search_window/mod.rs diff --git a/gnome/src/search_window/search_window.blp b/gnome/src/ui/search_window/search_window.blp similarity index 100% rename from gnome/src/search_window/search_window.blp rename to gnome/src/ui/search_window/search_window.blp diff --git a/gnome/src/shortcuts.rs b/gnome/src/ui/shortcuts/mod.rs similarity index 79% rename from gnome/src/shortcuts.rs rename to gnome/src/ui/shortcuts/mod.rs index 72491cb..1a185cb 100644 --- a/gnome/src/shortcuts.rs +++ b/gnome/src/ui/shortcuts/mod.rs @@ -1,10 +1,10 @@ use gtk::prelude::*; use gtk_blueprint::include_blp; -use crate::search_window::SearchWindow; +use crate::ui::SearchWindow; pub fn show_shortcuts(window: &SearchWindow) { - let blueprint = include_blp!("gnome/src/shortcuts.blp"); + let blueprint = include_blp!("gnome/src/ui/shortcuts/shortcuts.blp"); let builder = gtk::Builder::from_string(blueprint); let help_overlay = builder .object::("help-overlay") diff --git a/gnome/src/shortcuts.blp b/gnome/src/ui/shortcuts/shortcuts.blp similarity index 100% rename from gnome/src/shortcuts.blp rename to gnome/src/ui/shortcuts/shortcuts.blp