diff --git a/cargo.sh b/cargo.sh index c4be97b..9ba7ed7 100755 --- a/cargo.sh +++ b/cargo.sh @@ -14,9 +14,5 @@ export CARGO_TARGET_DIR cd "$SOURCE_DIR" -# the 'run" command takes arguments at the end, -# so --manifest-path must not be last -CMD="$1" -shift -cargo "$CMD" --manifest-path "$CARGO_TARGET_DIR"/Cargo.toml "$@" +cargo "$@" diff --git a/meson.build b/meson.build index 559bb30..12cb612 100644 --- a/meson.build +++ b/meson.build @@ -61,32 +61,6 @@ summary = [ ] message('\n'.join(summary)) -# Rust deps are changing, depending on compile flags. Cargo can't handle it alone. -cargo_toml_in = files('Cargo.toml.in') -path_data = configuration_data() -path_data.set('path', meson.source_root()) -cargo_toml_base = configure_file( - input: 'Cargo.toml.in', - output: 'Cargo.toml.base', - configuration: path_data, -) - - -cargo_deps = files('Cargo.deps') - -if get_option('legacy') == true - cargo_build_flags += ['--features', 'gtk_v0_5,gio_v0_5'] - cargo_deps = files('Cargo.deps.legacy') -endif - -cat = find_program('cat') -cargo_toml = custom_target( - 'Cargo.toml', - output: 'Cargo.toml', - command: [cat, cargo_toml_base, cargo_deps], - capture: true, -) - dep_cargo = find_program('cargo') cargo_script = find_program('cargo.sh') cargo_build = find_program('cargo_build.sh') diff --git a/src/layout.rs b/src/layout.rs index 41515bc..b1cae8e 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -107,8 +107,8 @@ pub mod c { impl Bounds { pub fn contains(&self, point: &Point) -> bool { - (point.x > self.x && point.x < self.x + self.width - && point.y > self.y && point.y < self.y + self.height) + point.x > self.x && point.x < self.x + self.width + && point.y > self.y && point.y < self.y + self.height } } diff --git a/src/meson.build b/src/meson.build index 0106381..31bda17 100644 --- a/src/meson.build +++ b/src/meson.build @@ -56,8 +56,7 @@ rslibs = custom_target( output: ['librs.a'], install: false, console: true, - command: [cargo_build] + ['@OUTPUT@', '--lib'] + cargo_build_flags, - depends: cargo_toml, + command: [cargo_build] + ['@OUTPUT@', '--lib'] + cargo_build_flags ) build_rstests = custom_target( @@ -72,7 +71,7 @@ build_rstests = custom_target( install: false, console: true, command: [cargo_script, 'test', '--no-run'] + cargo_build_flags, - depends: [rslibs, cargo_toml], # no point building tests if the code itself fails + depends: rslibs # no point building tests if the code itself fails ) test( @@ -81,7 +80,7 @@ test( args: ['test'] + cargo_build_flags, # this is a whole Carg-based test suite, let it run for a while timeout: 900, - depends: [build_rstests, cargo_toml], + depends: build_rstests, ) libsqueekboard = static_library('libsqueekboard', diff --git a/src/popover.rs b/src/popover.rs index 65551a2..4077b8a 100644 --- a/src/popover.rs +++ b/src/popover.rs @@ -14,12 +14,9 @@ use ::resources; // Traits use gio::ActionMapExt; use gio::SettingsExt; -#[cfg(feature = "gio_v0_5")] -use gio::SimpleActionExt; +use gtk::prelude::BuilderExtManual; use glib::translate::FromGlibPtrNone; use glib::variant::ToVariant; -#[cfg(not(feature = "gtk_v0_5"))] -use gtk::BuilderExtManual; use gtk::PopoverExt; use gtk::WidgetExt; use std::io::Write; @@ -131,7 +128,7 @@ fn make_menu_builder(inputs: Vec<(&str, OwnedTranslation)>) -> gtk::Builder { " ).unwrap(); - gtk::Builder::new_from_string( + gtk::Builder::from_string( &String::from_utf8(xml).expect("Bad menu definition") ) } @@ -158,7 +155,7 @@ fn get_settings(schema_name: &str) -> Option { fn set_layout(kind: String, name: String) { let settings = get_settings("org.gnome.desktop.input-sources"); if let Some(settings) = settings { - let inputs = settings.get_value("sources").unwrap(); + let inputs = settings.get_value("sources"); let current = (kind.clone(), name.clone()); let inputs = variants::get_tuples(inputs).into_iter() .filter(|t| t != ¤t); @@ -312,7 +309,7 @@ pub fn show( let settings = get_settings("org.gnome.desktop.input-sources"); let inputs = settings .map(|settings| { - let inputs = settings.get_value("sources").unwrap(); + let inputs = settings.get_value("sources"); variants::get_tuples(inputs) }) .unwrap_or_else(|| Vec::new()); @@ -365,7 +362,7 @@ pub fn show( // than add items imperatively let model: gio::MenuModel = builder.get_object("app-menu").unwrap(); - let menu = gtk::Popover::new_from_model(Some(&window), &model); + let menu = gtk::Popover::from_model(Some(&window), &model); menu.set_pointing_to(>k::Rectangle { x: position.x.ceil() as i32, y: position.y.ceil() as i32, diff --git a/src/style.rs b/src/style.rs index 153431a..2d7d539 100644 --- a/src/style.rs +++ b/src/style.rs @@ -99,13 +99,13 @@ fn get_theme_name(settings: >k::Settings) -> GtkTheme { name: { settings.get_property("gtk-theme-name") .or_print(logging::Problem::Surprise, "No theme name") - .and_then(|value| value.get::()) + .and_then(|value| value.get::().unwrap()) .unwrap_or(DEFAULT_THEME_NAME.into()) }, variant: { settings.get_property("gtk-application-prefer-dark-theme") .or_print(logging::Problem::Surprise, "No settings key") - .and_then(|value| value.get::()) + .and_then(|value| value.get::().unwrap()) .and_then(|dark_preferred| match dark_preferred { true => Some("dark".into()), false => None, diff --git a/tools/meson.build b/tools/meson.build index 75a7e17..cc8b83b 100644 --- a/tools/meson.build +++ b/tools/meson.build @@ -15,6 +15,5 @@ test_layout = custom_target('squeekboard-test-layout', command: [cargo_build, '--rename', 'test_layout', '@OUTPUT@', '--bin', 'test_layout'] + cargo_build_flags, install: true, - install_dir: bindir, - depends: cargo_toml, + install_dir: bindir )