Switch to glib v2_58
Remove the ancient fallbacks Part-of: <https://gitlab.gnome.org/World/Phosh/squeekboard/-/merge_requests/621>
This commit is contained in:
		@ -82,7 +82,7 @@ build_reference:
 | 
			
		||||
  script:
 | 
			
		||||
    - apt-get -y install cargo
 | 
			
		||||
    - cd _build
 | 
			
		||||
    - ../cargo.sh doc --no-deps --document-private-items --features 'glib_v0_14,zbus_v1_5,clap_v4'
 | 
			
		||||
    - ../cargo.sh doc --no-deps --document-private-items --features 'zbus_v1_5,clap_v4'
 | 
			
		||||
  except:
 | 
			
		||||
    variables:
 | 
			
		||||
      - $PKG_ONLY == "1"
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,6 @@ name = "find_orphan_layouts"
 | 
			
		||||
path = "@path@/examples/find_orphan_layouts.rs"
 | 
			
		||||
 | 
			
		||||
[features]
 | 
			
		||||
glib_v0_14 = []
 | 
			
		||||
zbus_v1_5 = []
 | 
			
		||||
clap_v4 = []
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -98,7 +98,7 @@ cargo_toml_base = configure_file(
 | 
			
		||||
 | 
			
		||||
cargo_patch = []
 | 
			
		||||
 | 
			
		||||
cargo_build_flags += ['--features', 'glib_v0_14,zbus_v1_5,clap_v4']
 | 
			
		||||
cargo_build_flags += ['--features', 'zbus_v1_5,clap_v4']
 | 
			
		||||
cargo_deps = files('Cargo.deps')
 | 
			
		||||
cargo_lock = files('Cargo.lock')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -166,8 +166,6 @@ mod c {
 | 
			
		||||
                ControlFlow::Continue
 | 
			
		||||
            },
 | 
			
		||||
        );
 | 
			
		||||
        #[cfg(not(feature = "glib_v0_14"))]
 | 
			
		||||
        ctx.release();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// A single iteration of the UI loop.
 | 
			
		||||
 | 
			
		||||
@ -108,10 +108,7 @@ mod variants {
 | 
			
		||||
fn get_settings(schema_name: &str) -> Option<gio::Settings> {
 | 
			
		||||
    let mut error_handler = logging::Print{};
 | 
			
		||||
 | 
			
		||||
    #[cfg(feature = "glib_v0_14")]
 | 
			
		||||
    let ss = gio::SettingsSchemaSource::default();
 | 
			
		||||
    #[cfg(not(feature = "glib_v0_14"))]
 | 
			
		||||
    let ss = gio::SettingsSchemaSource::get_default();
 | 
			
		||||
    
 | 
			
		||||
    ss.or_warn(
 | 
			
		||||
            &mut error_handler,
 | 
			
		||||
@ -134,10 +131,7 @@ fn set_layout(kind: &str, name: &str) {
 | 
			
		||||
    if let Some(settings) = settings {
 | 
			
		||||
        let kind = String::from(kind);
 | 
			
		||||
        let name = String::from(name);
 | 
			
		||||
        #[cfg(feature = "glib_v0_14")]
 | 
			
		||||
        let inputs = settings.value("sources");
 | 
			
		||||
        #[cfg(not(feature = "glib_v0_14"))]
 | 
			
		||||
        let inputs = settings.get_value("sources").unwrap();
 | 
			
		||||
 | 
			
		||||
        let current = (kind.clone(), name.clone());
 | 
			
		||||
        let inputs = variants::get_tuples(inputs).into_iter()
 | 
			
		||||
@ -246,10 +240,7 @@ pub fn show(
 | 
			
		||||
    let settings = get_settings("org.gnome.desktop.input-sources");
 | 
			
		||||
    let inputs = settings
 | 
			
		||||
        .map(|settings| {
 | 
			
		||||
            #[cfg(feature = "glib_v0_14")]
 | 
			
		||||
            let inputs = settings.value("sources");
 | 
			
		||||
            #[cfg(not(feature = "glib_v0_14"))]
 | 
			
		||||
            let inputs = settings.get_value("sources").unwrap();
 | 
			
		||||
 | 
			
		||||
            variants::get_tuples(inputs)
 | 
			
		||||
        })
 | 
			
		||||
@ -282,16 +273,10 @@ pub fn show(
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    let model: gio::Menu = {
 | 
			
		||||
        #[cfg(feature = "glib_v0_14")]
 | 
			
		||||
        {
 | 
			
		||||
            let builder = gtk::Builder::from_resource("/sm/puri/squeekboard/popover.ui");
 | 
			
		||||
            builder.object("app-menu").unwrap()
 | 
			
		||||
        }
 | 
			
		||||
        #[cfg(not(feature = "glib_v0_14"))]
 | 
			
		||||
        {
 | 
			
		||||
            let builder = gtk::Builder::new_from_resource("/sm/puri/squeekboard/popover.ui");
 | 
			
		||||
            builder.get_object("app-menu").unwrap()
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    for (tr, l) in human_names.iter().rev() {
 | 
			
		||||
@ -300,10 +285,7 @@ pub fn show(
 | 
			
		||||
        model.prepend_item (&item);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #[cfg(feature = "glib_v0_14")]
 | 
			
		||||
    let menu = gtk::Popover::from_model(Some(&window), &model);
 | 
			
		||||
    #[cfg(not(feature = "glib_v0_14"))]
 | 
			
		||||
    let menu = gtk::Popover::new_from_model(Some(&window), &model);
 | 
			
		||||
 | 
			
		||||
    menu.set_pointing_to(>k::Rectangle::new (
 | 
			
		||||
        position.x.ceil() as i32,
 | 
			
		||||
 | 
			
		||||
@ -41,10 +41,7 @@ pub mod c {
 | 
			
		||||
    fn squeek_load_style() -> *const gtk_sys::GtkCssProvider {
 | 
			
		||||
        unsafe { gtk::set_initialized() };
 | 
			
		||||
        
 | 
			
		||||
        #[cfg(feature = "glib_v0_14")]
 | 
			
		||||
        let theme = gtk::Settings::default();
 | 
			
		||||
        #[cfg(not(feature = "glib_v0_14"))]
 | 
			
		||||
        let theme = gtk::Settings::get_default();
 | 
			
		||||
        
 | 
			
		||||
        let theme = theme.map(|settings| get_theme_name(&settings));
 | 
			
		||||
        
 | 
			
		||||
@ -98,22 +95,16 @@ fn get_theme_name(settings: >k::Settings) -> GtkTheme {
 | 
			
		||||
            e
 | 
			
		||||
        }).ok();
 | 
			
		||||
 | 
			
		||||
    #[cfg(feature = "glib_v0_14")]
 | 
			
		||||
    let prop = |s: >k::Settings, name| {
 | 
			
		||||
        if s.has_property(name, None) {
 | 
			
		||||
            return Ok(s.property_value(name));
 | 
			
		||||
        }
 | 
			
		||||
        return Err("Key not found in settings");
 | 
			
		||||
    };
 | 
			
		||||
    #[cfg(not(feature = "glib_v0_14"))]
 | 
			
		||||
    let prop = |s: >k::Settings, name| s.get_property(name);
 | 
			
		||||
 | 
			
		||||
    #[cfg(feature = "glib_v0_14")]
 | 
			
		||||
    fn check<T, E: std::fmt::Display>(v: Result<T, E>) -> Option<T> {
 | 
			
		||||
        v.or_print(logging::Problem::Surprise, "Key not of expected type")
 | 
			
		||||
    }
 | 
			
		||||
    #[cfg(not(feature = "glib_v0_14"))]
 | 
			
		||||
    fn check<T>(v: Option<T>) -> Option<T> { v }
 | 
			
		||||
 | 
			
		||||
    match env_theme {
 | 
			
		||||
        Some(theme) => theme,
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user