From 1879f79645a25d39039e618e7211cfd8f310bff8 Mon Sep 17 00:00:00 2001 From: Dirk Van Haerenborgh Date: Sat, 2 Mar 2024 22:34:26 +0100 Subject: [PATCH] fix clippy --- .editorconfig | 21 ---------------- build-aux/io.github.vhdirk.Terms.Devel.yml | 1 + build-aux/io.github.vhdirk.Terms.yml | 2 ++ meson.build | 5 ++-- meson_options.txt | 6 +++++ src/components/mod.rs | 1 - src/components/terminal/imp.rs | 8 +++--- src/components/terminal_tab/imp.rs | 5 ---- src/components/theme_thumbnail/imp.rs | 3 ++- src/meson.build | 29 ++++++++++++++-------- 10 files changed, 35 insertions(+), 46 deletions(-) delete mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 5600faa..0000000 --- a/.editorconfig +++ /dev/null @@ -1,21 +0,0 @@ -root = true -[*] -indent_style = space -end_of_line = lf -trim_trailing_whitespace = true -insert_final_newline = true -charset = utf-8 - -[*.{build,css,doap,scss,ui,xml,xml.in,xml.in.in,yaml,yml}] -indent_size = 2 - -[*.{json,py,rs}] -indent_size = 4 - -[*.{c,h,h.in}] -indent_size = 2 -max_line_length = 80 - -[NEWS] -indent_size = 2 -max_line_length = 72 diff --git a/build-aux/io.github.vhdirk.Terms.Devel.yml b/build-aux/io.github.vhdirk.Terms.Devel.yml index a0d71ed..8e2d51a 100644 --- a/build-aux/io.github.vhdirk.Terms.Devel.yml +++ b/build-aux/io.github.vhdirk.Terms.Devel.yml @@ -78,6 +78,7 @@ modules: builddir: true config-opts: - -Dprofile=development + - -Dflatpak=true sources: - type: dir path: ../ diff --git a/build-aux/io.github.vhdirk.Terms.yml b/build-aux/io.github.vhdirk.Terms.yml index 991b626..a3cac1c 100644 --- a/build-aux/io.github.vhdirk.Terms.yml +++ b/build-aux/io.github.vhdirk.Terms.yml @@ -69,6 +69,8 @@ modules: buildsystem: meson run-tests: true builddir: true + config-opts: + - -Dflatpak=true sources: - type: dir path: ../ diff --git a/meson.build b/meson.build index d596b62..50baa13 100644 --- a/meson.build +++ b/meson.build @@ -39,9 +39,7 @@ desktop_file_validate = find_program('desktop-file-validate', required: false) appstream_util = find_program('appstream-util', required: false) cargo = find_program('cargo', required: true) cargo_version = run_command(cargo, '--version', check: true).stdout().strip() -message(cargo_version) rustc_version = run_command('rustc', '--version', check: true).stdout().strip() -message(rustc_version) version = meson.project_version() @@ -77,7 +75,7 @@ if profile == 'Devel' else version_suffix = '' application_id = base_id - release_date = run_command('git', 'show', '-s', '--format=%cI').stdout().strip() + release_date = run_command('git', 'show', '-s', '--format=%cI', check: false).stdout().strip() endif full_version += version_suffix @@ -109,6 +107,7 @@ summary({ summary({ 'Profile': get_option('profile'), + 'Flatpak': get_option('flatpak'), }, section: 'Build options', ) diff --git a/meson_options.txt b/meson_options.txt index a5dc7f1..6bb5fc4 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -10,3 +10,9 @@ option( value: 'default', description: 'The build profile for Terms. One of "default", "beta", "development" or "hack".' ) + +option( + 'flatpak', + type: 'boolean', + value : false +) diff --git a/src/components/mod.rs b/src/components/mod.rs index c6f22fa..c3c36c0 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -11,7 +11,6 @@ mod theme_thumbnail; mod window; pub use preferences_window::*; -pub use process_manager::*; pub use shortcut_dialog::*; pub use shortcut_row::*; diff --git a/src/components/terminal/imp.rs b/src/components/terminal/imp.rs index 22ca61b..09abf3b 100644 --- a/src/components/terminal/imp.rs +++ b/src/components/terminal/imp.rs @@ -19,7 +19,6 @@ use glib::{clone, subclass::Signal, JoinHandle, Value}; use once_cell::sync::Lazy; use crate::components::search_toolbar::SearchToolbar; -use crate::components::ProcessManager; use crate::config::APP_NAME; use crate::pcre2::PCRE2Flags; use crate::settings::ScrollbackMode; @@ -64,8 +63,6 @@ pub struct Terminal { padding_provider: RefCell>, - process_manager: ProcessManager, - update_source: Option, #[template_child] @@ -129,7 +126,6 @@ impl Default for Terminal { uuid: glib::uuid_string_random().to_string(), spawner: get_spawner(), - process_manager: ProcessManager::new(), last_match: Default::default(), update_source: Default::default(), @@ -486,14 +482,16 @@ impl Terminal { fn on_padding_changed(&self) { // TODO: move to themeprovider if let Some(padding_provider) = self.padding_provider.borrow_mut().take() { + #[allow(deprecated)] self.term.style_context().remove_provider(&padding_provider); } let (top, right, bottom, left) = self.settings.terminal_padding(); let provider = gtk::CssProvider::new(); - provider.load_from_data(&format!("vte-terminal {{ padding: {}px {}px {}px {}px; }}", top, right, bottom, left)); + provider.load_from_string(&format!("vte-terminal {{ padding: {}px {}px {}px {}px; }}", top, right, bottom, left)); + #[allow(deprecated)] self.term.style_context().add_provider(&provider, gtk::STYLE_PROVIDER_PRIORITY_APPLICATION); self.padding_provider.borrow_mut().replace(provider); } diff --git a/src/components/terminal_tab/imp.rs b/src/components/terminal_tab/imp.rs index ff171f2..de54c69 100644 --- a/src/components/terminal_tab/imp.rs +++ b/src/components/terminal_tab/imp.rs @@ -176,11 +176,6 @@ impl TerminalTab { self.panel_grid.selected().map(|p| p.child()).and_downcast() } - fn set_selected(&self, _terminal: Option) { - // todo!(); - // self.panel_grid.set_select - } - fn on_selected_panel_change(&self) { let panel = self.panel_grid.selected(); debug!("on panel changed: {:?}", panel); diff --git a/src/components/theme_thumbnail/imp.rs b/src/components/theme_thumbnail/imp.rs index 8037425..a757237 100644 --- a/src/components/theme_thumbnail/imp.rs +++ b/src/components/theme_thumbnail/imp.rs @@ -137,7 +137,8 @@ impl ThemeThumbnail { if let Some(bg_color) = theme.background { let css_provider = gtk::CssProvider::new(); - css_provider.load_from_data(&format!("picture {{ background-color: {}; }}", bg_color)); + css_provider.load_from_string(&format!("picture {{ background-color: {}; }}", bg_color)); + #[allow(deprecated)] img.style_context().add_provider(&css_provider, gtk::STYLE_PROVIDER_PRIORITY_APPLICATION); } } diff --git a/src/meson.build b/src/meson.build index ceb5683..f57a59b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -13,6 +13,7 @@ config = configure_file( output: 'config.rs', configuration: global_conf ) + # Copy the config.rs output to the source directory. run_command( 'cp', @@ -36,6 +37,23 @@ endif cargo_env = [ 'CARGO_HOME=' + meson.project_build_root() / 'cargo-home', 'BUILD_IS_MESON=true' ] +cargo_command = [ + 'env', + cargo_env, + cargo, 'build', + cargo_options, + '&&', + 'cp', 'src' / rust_target / 'terms', '@OUTPUT0@', +] + +if get_option('flatpak') + cargo_command += [ + '&&', + 'cp', 'src' / rust_target / 'terms-toolbox', '@OUTPUT1@', + ] +endif + + cargo_build = custom_target( 'cargo-build', build_by_default: true, @@ -45,14 +63,5 @@ cargo_build = custom_target( install: true, install_dir: bindir, depends: resources, - command: [ - 'env', - cargo_env, - cargo, 'build', - cargo_options, - '&&', - 'cp', 'src' / rust_target / 'terms', '@OUTPUT0@', - '&&', - 'cp', 'src' / rust_target / 'terms-toolbox', '@OUTPUT1@', - ] + command: cargo_command )