From 9269b2d60b0c18a034615d6bf5b25af58b5d9ef4 Mon Sep 17 00:00:00 2001 From: Ward from fusion-voyager-3 Date: Tue, 6 Aug 2024 23:13:47 +0300 Subject: [PATCH] fix layout --- Cargo.lock | 1 + Cargo.toml | 1 + src/language_page/mod.rs | 9 +++------ 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4855f25..d5f307b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -926,6 +926,7 @@ version = "1.0.2" dependencies = [ "async-channel", "duct", + "glib 0.18.5", "glib 0.20.0", "glob", "gnome-desktop", diff --git a/Cargo.toml b/Cargo.toml index 356d54c..c571ba4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +glib_old = { version = "0.18", package = "glib"} adw = { version = "0.7.0", package = "libadwaita", features = ["v1_5"] } async-channel = "2.3.1" duct = "0.13.7" diff --git a/src/language_page/mod.rs b/src/language_page/mod.rs index 28a2389..e81ee79 100644 --- a/src/language_page/mod.rs +++ b/src/language_page/mod.rs @@ -4,6 +4,8 @@ use gtk::{prelude::*, glib as glib, gio as gio}; use adw::{prelude::*}; use glib::{clone, closure_local}; use std::{process::Command, env, fs, path::Path}; +use gtk::ResponseType::No; + pub fn language_page( main_carousel: &adw::Carousel, language_changed_action: &gio::SimpleAction @@ -232,12 +234,7 @@ pub fn language_page( for locale in locale_list.iter() { let locale = locale.to_string(); - let locale_name_cli = - Command::new("/usr/lib/pika/pika-installer-gtk4/scripts/locale-name.py") - .arg(locale.clone()) - .output() - .expect("failed to execute process"); - let locale_name = String::from_utf8(locale_name_cli.stdout).unwrap(); + let locale_name = gnome_desktop::language_from_locale(&locale, None).unwrap_or(locale.clone().into()).to_string(); let locale_clone = locale.clone(); let locale_checkbutton = gtk::CheckButton::builder() .valign(gtk::Align::Center)