add translations

This commit is contained in:
Ward from fusion-voyager-3 2024-10-02 20:36:14 +03:00
parent ee5a9dd14a
commit f978bb2faa
4 changed files with 50 additions and 18 deletions

View File

@ -146,9 +146,13 @@
"flatpak_remote_add_error_used_no_label": "No", "flatpak_remote_add_error_used_no_label": "No",
"flatpak_remote_add_error_used_yes_label": "Yes", "flatpak_remote_add_error_used_yes_label": "Yes",
"flatpak_flatref_install_button_tooltip_text": "Install a FlatRef File", "flatpak_flatref_install_button_tooltip_text": "Install a FlatRef File",
"flatpak_ref_install_flatref_path_file_dialog_title": "Open a Flatpak Repository Referance File", "flatpak_ref_install_flatref_path_file_dialog_title": "Open a Flatpak Repository Reference File",
"flatpak_ref_install_flatref_path_file_dialog_accept_label": "Open", "flatpak_ref_install_flatref_path_file_dialog_accept_label": "Open",
"flatpak_ref_install_flatref_path_file_dialog_cancel_label": "Cancel", "flatpak_ref_install_flatref_path_file_dialog_cancel_label": "Cancel",
"flatpak_ref_install_flatref_path_entry_open_file_dialog_text": "Open File Chooser", "flatpak_ref_install_flatref_path_entry_open_file_dialog_text": "Open File Chooser",
"flatpak_ref_install_label": "{NAME} Will be Installed and It Uses The remote \"{REMOTE}\" Which Will Be Installed\nOn Your System If It Isn't Already" "flatpak_ref_install_label": "{NAME} Will be Installed and It Uses The remote \"{REMOTE}\" Which Will Be Installed\nOn Your System If It Isn't Already",
"flatpak_ref_install_flatref_path_prefrencesgroup_title": "The File Path to The Flatpak Reference File You Want to Install",
"flatpak_ref_install_dialog_heading": "Flatpak Reference File Installer",
"flatpak_ref_install_dialog_add_label": "Install",
"flatpak_ref_install_dialog_cancel_label": "Cancel"
} }

View File

@ -9,6 +9,7 @@ use gtk::glib::{clone, MainContext};
use gtk::{License, WindowControls}; use gtk::{License, WindowControls};
use std::borrow::Borrow; use std::borrow::Borrow;
use std::cell::RefCell; use std::cell::RefCell;
use std::ops::Index;
use std::process::Command; use std::process::Command;
use std::rc::Rc; use std::rc::Rc;
use std::thread; use std::thread;
@ -181,7 +182,6 @@ pub fn build_ui(app: &Application) {
let _ = glib_settings.set_int("window-width", size.0); let _ = glib_settings.set_int("window-width", size.0);
let _ = glib_settings.set_int("window-height", size.1); let _ = glib_settings.set_int("window-height", size.1);
let _ = glib_settings.set_boolean("is-maximized", window.is_maximized()); let _ = glib_settings.set_boolean("is-maximized", window.is_maximized());
application.remove_window(window);
} }
glib::Propagation::Proceed glib::Propagation::Proceed
}); });
@ -300,8 +300,17 @@ pub fn build_ui(app: &Application) {
let apt_manage_page_toggle_button = add_content_button(&window_adw_stack, false, "apt_manage_page".to_string(), t!("apt_manage_page_title").to_string(), &null_toggle_button); let apt_manage_page_toggle_button = add_content_button(&window_adw_stack, false, "apt_manage_page".to_string(), t!("apt_manage_page_title").to_string(), &null_toggle_button);
window_adw_view_switcher_sidebar_box.append(&apt_manage_page_toggle_button); window_adw_view_switcher_sidebar_box.append(&apt_manage_page_toggle_button);
let flatpak_entry_signal_action = gio::SimpleAction::new("entry-change", Some(glib::VariantTy::STRING));
let flatpak_flatref_install_button = gtk::Button::builder()
.icon_name("document-open-symbolic")
.tooltip_text(t!("flatpak_flatref_install_button_tooltip_text"))
//.halign(Align::End)
.valign(gtk::Align::End)
.build();
window_adw_stack.add_titled( window_adw_stack.add_titled(
&flatpak_manage_page(window.clone(), &flatpak_retry_signal_action), &flatpak_manage_page(window.clone(), &flatpak_retry_signal_action, &flatpak_entry_signal_action, &flatpak_flatref_install_button),
Some("flatpak_manage_page"), Some("flatpak_manage_page"),
&t!("flatpak_manage_page_title"), &t!("flatpak_manage_page_title"),
); );
@ -316,6 +325,10 @@ pub fn build_ui(app: &Application) {
flatpak_manage_page_toggle_button, flatpak_manage_page_toggle_button,
#[strong] #[strong]
window, window,
#[strong]
flatpak_flatref_install_button,
#[strong]
flatpak_entry_signal_action,
move |_, cmdline| { move |_, cmdline| {
// Create Vec from cmdline // Create Vec from cmdline
let mut gtk_application_args = Vec::new(); let mut gtk_application_args = Vec::new();
@ -327,7 +340,7 @@ pub fn build_ui(app: &Application) {
} }
// Check for cmd lines // Check for cmd lines
if !(gtk_application_args.contains(&"--hidden".to_string())) && !window.is_visible() { if !(gtk_application_args.contains(&"--hidden".to_string())) && !(gtk_application_args.contains(&"--flatpak-installer".to_string())) && !window.is_visible() {
window.present(); window.present();
} }
@ -339,6 +352,11 @@ pub fn build_ui(app: &Application) {
flatpak_manage_page_toggle_button.set_active(true); flatpak_manage_page_toggle_button.set_active(true);
flatpak_manage_page_toggle_button.emit_clicked(); flatpak_manage_page_toggle_button.emit_clicked();
} }
if gtk_application_args.contains(&"--flatpak-installer".to_string()) {
flatpak_flatref_install_button.emit_clicked();
let index = ((gtk_application_args.iter().position(|r| r == "--flatpak-installer").unwrap() as i32) +1) as usize;
flatpak_entry_signal_action.activate(Some(&glib::Variant::from(&gtk_application_args[index])));
}
0 0
})); }));

View File

@ -29,8 +29,9 @@ pub fn install_ref_dialog_fn(
window: adw::ApplicationWindow, window: adw::ApplicationWindow,
reload_action: &gio::SimpleAction, reload_action: &gio::SimpleAction,
flatpak_retry_signal_action: &SimpleAction, flatpak_retry_signal_action: &SimpleAction,
flatpak_ref_entry_action: &SimpleAction,
) )
{ {
let flatpak_ref_install_dialog_child_box = Box::builder() let flatpak_ref_install_dialog_child_box = Box::builder()
.hexpand(true) .hexpand(true)
.orientation(Orientation::Vertical) .orientation(Orientation::Vertical)
@ -53,6 +54,16 @@ pub fn install_ref_dialog_fn(
.hexpand(true) .hexpand(true)
.build(); .build();
flatpak_ref_entry_action.connect_activate(clone!(
#[strong]
flatpak_ref_install_flatref_path_entry,
move |_ , param|
{
flatpak_ref_install_flatref_path_entry.set_text(&param.unwrap().get::<String>().unwrap());
}
)
);
let flatpak_ref_install_flatref_path_entry_open_file_dialog = gtk::Button::builder() let flatpak_ref_install_flatref_path_entry_open_file_dialog = gtk::Button::builder()
.tooltip_text(t!("flatpak_ref_install_flatref_path_entry_open_file_dialog_text")) .tooltip_text(t!("flatpak_ref_install_flatref_path_entry_open_file_dialog_text"))
.halign(gtk::Align::End) .halign(gtk::Align::End)
@ -113,6 +124,8 @@ pub fn install_ref_dialog_fn(
.build(); .build();
let flatpak_ref_install_label0 = gtk::Label::builder() let flatpak_ref_install_label0 = gtk::Label::builder()
.margin_top(10)
.margin_bottom(10)
.build(); .build();
let flatpak_remote_user_togglebutton = gtk::ToggleButton::builder() let flatpak_remote_user_togglebutton = gtk::ToggleButton::builder()
@ -270,6 +283,7 @@ pub fn install_ref_dialog_fn(
let reload_action_clone0 = reload_action.clone(); let reload_action_clone0 = reload_action.clone();
let flatpak_retry_signal_action_clone0 = flatpak_retry_signal_action.clone(); let flatpak_retry_signal_action_clone0 = flatpak_retry_signal_action.clone();
let flatpak_ref_install_flatref_path_entry_clone0 = flatpak_ref_install_flatref_path_entry.clone();
let tbi_remote_name_clone0 = tbi_remote_name.clone(); let tbi_remote_name_clone0 = tbi_remote_name.clone();
let tbi_remote_url_clone0 = tbi_remote_url.clone(); let tbi_remote_url_clone0 = tbi_remote_url.clone();
@ -283,7 +297,7 @@ pub fn install_ref_dialog_fn(
} }
(_,_) => {} (_,_) => {}
} }
run_flatpak_ref_install_transaction(&flatpak_retry_signal_action_clone0, &reload_action_clone0, flatpak_remote_system_togglebutton.is_active(), window, &flatpak_ref_install_flatref_path_entry.text()); run_flatpak_ref_install_transaction(&flatpak_retry_signal_action_clone0, &reload_action_clone0, flatpak_remote_system_togglebutton.is_active(), window, &flatpak_ref_install_flatref_path_entry_clone0.text());
} }
_ => {} _ => {}
} }

View File

@ -34,6 +34,8 @@ enum FlatpakRemote {
pub fn flatpak_manage_page( pub fn flatpak_manage_page(
window: adw::ApplicationWindow, window: adw::ApplicationWindow,
flatpak_retry_signal_action: &SimpleAction, flatpak_retry_signal_action: &SimpleAction,
flatpak_ref_entry_action: &SimpleAction,
flatpak_flatref_install_button: &gtk::Button,
) -> gtk::Box { ) -> gtk::Box {
let retry_signal_action = gio::SimpleAction::new("flatpak_manage_action", None); let retry_signal_action = gio::SimpleAction::new("flatpak_manage_action", None);
let cancellable_no = libflatpak::gio::Cancellable::NONE; let cancellable_no = libflatpak::gio::Cancellable::NONE;
@ -294,13 +296,6 @@ pub fn flatpak_manage_page(
.valign(Align::End) .valign(Align::End)
.build(); .build();
let flatpak_flatref_install_button = Button::builder()
.icon_name("document-open-symbolic")
.tooltip_text(t!("flatpak_flatref_install_button_tooltip_text"))
//.halign(Align::End)
.valign(Align::End)
.build();
let flatpak_remote_remove_button = Button::builder() let flatpak_remote_remove_button = Button::builder()
.icon_name("edit-delete-symbolic") .icon_name("edit-delete-symbolic")
.tooltip_text(t!("flatpak_remote_remove_button_tooltip_text")) .tooltip_text(t!("flatpak_remote_remove_button_tooltip_text"))
@ -334,21 +329,22 @@ pub fn flatpak_manage_page(
retry_signal_action, retry_signal_action,
#[strong] #[strong]
flatpak_retry_signal_action, flatpak_retry_signal_action,
#[strong]
flatpak_ref_entry_action,
move move
|_| |_|
{ {
install_ref_dialog::install_ref_dialog_fn( install_ref_dialog::install_ref_dialog_fn(
window.clone(), window.clone(),
&retry_signal_action, &retry_signal_action,
&flatpak_retry_signal_action &flatpak_retry_signal_action,
&flatpak_ref_entry_action
); );
} }
) )
); );
flatpak_remote_remove_button.connect_clicked(clone!( flatpak_remote_remove_button.connect_clicked(clone!(
#[strong]
window,
#[strong] #[strong]
flatpak_remotes_selection_model_rc, flatpak_remotes_selection_model_rc,
#[strong] #[strong]
@ -451,7 +447,7 @@ pub fn flatpak_manage_page(
// //
flatpak_remotes_edit_box.append(&flatpak_remote_add_button); flatpak_remotes_edit_box.append(&flatpak_remote_add_button);
flatpak_remotes_edit_box.append(&flatpak_flatref_install_button); flatpak_remotes_edit_box.append(flatpak_flatref_install_button);
flatpak_remotes_edit_box.append(&flatpak_remote_remove_button); flatpak_remotes_edit_box.append(&flatpak_remote_remove_button);
flatpak_remotes_box.append(&flatpak_remotes_columnview_bin); flatpak_remotes_box.append(&flatpak_remotes_columnview_bin);