gio action
This commit is contained in:
parent
bd7f3368c6
commit
86e58e1a29
@ -112,6 +112,7 @@
|
|||||||
<workItem from="1720301553869" duration="12211000" />
|
<workItem from="1720301553869" duration="12211000" />
|
||||||
<workItem from="1720423242486" duration="3396000" />
|
<workItem from="1720423242486" duration="3396000" />
|
||||||
<workItem from="1720476457389" duration="7123000" />
|
<workItem from="1720476457389" duration="7123000" />
|
||||||
|
<workItem from="1720502207843" duration="1286000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use crate::apt_package_row::AptPackageRow;
|
use crate::apt_package_row::AptPackageRow;
|
||||||
use adw::gio::Action;
|
use adw::gio::{Action, SimpleAction};
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use adw::ActionRow;
|
use adw::ActionRow;
|
||||||
use gtk::glib::*;
|
use gtk::glib::*;
|
||||||
@ -34,7 +34,7 @@ pub struct AptPackageSocket {
|
|||||||
pub installed_size: u64,
|
pub installed_size: u64,
|
||||||
pub is_last: bool,
|
pub is_last: bool,
|
||||||
}
|
}
|
||||||
pub fn apt_update_page(window: adw::ApplicationWindow, retry_signal_action: >k::Button) -> gtk::Box {
|
pub fn apt_update_page(window: adw::ApplicationWindow, retry_signal_action: &SimpleAction) -> gtk::Box {
|
||||||
let (update_percent_sender, update_percent_receiver) = async_channel::unbounded::<String>();
|
let (update_percent_sender, update_percent_receiver) = async_channel::unbounded::<String>();
|
||||||
let update_percent_sender = update_percent_sender.clone();
|
let update_percent_sender = update_percent_sender.clone();
|
||||||
let (update_status_sender, update_status_receiver) = async_channel::unbounded::<String>();
|
let (update_status_sender, update_status_receiver) = async_channel::unbounded::<String>();
|
||||||
@ -150,7 +150,7 @@ pub fn apt_update_page(window: adw::ApplicationWindow, retry_signal_action: >k
|
|||||||
|
|
||||||
apt_update_dialog.clone().choose(None::<&gio::Cancellable>, move |choice| {
|
apt_update_dialog.clone().choose(None::<&gio::Cancellable>, move |choice| {
|
||||||
if choice == "apt_update_dialog_retry" {
|
if choice == "apt_update_dialog_retry" {
|
||||||
retry_signal_action0.emit_by_name("clicked", &[])
|
retry_signal_action0.activate(None);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@ use std::ops::Deref;
|
|||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
use adw::glib::ffi::G_VARIANT_TYPE_ANY;
|
||||||
|
use gtk::pango::AttrType::Variant;
|
||||||
|
|
||||||
pub fn build_ui(app: &adw::Application) {
|
pub fn build_ui(app: &adw::Application) {
|
||||||
// setup glib
|
// setup glib
|
||||||
@ -108,6 +110,10 @@ pub fn build_ui(app: &adw::Application) {
|
|||||||
.icon_name("dialog-information-symbolic")
|
.icon_name("dialog-information-symbolic")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
let refresh_button = gtk::Button::builder()
|
||||||
|
.label(t!("refresh_button_label"))
|
||||||
|
.build();
|
||||||
|
|
||||||
let credits_window = adw::AboutWindow::builder()
|
let credits_window = adw::AboutWindow::builder()
|
||||||
.application_icon(APP_ICON)
|
.application_icon(APP_ICON)
|
||||||
.application_name(t!("application_name"))
|
.application_name(t!("application_name"))
|
||||||
@ -119,6 +125,7 @@ pub fn build_ui(app: &adw::Application) {
|
|||||||
.issue_url(APP_GITHUB.to_owned() + "/issues")
|
.issue_url(APP_GITHUB.to_owned() + "/issues")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
window_headerbar.pack_end(&refresh_button);
|
||||||
window_headerbar.pack_end(&credits_button);
|
window_headerbar.pack_end(&credits_button);
|
||||||
credits_button
|
credits_button
|
||||||
.connect_clicked(clone!(@weak credits_button => move |_| credits_window.present()));
|
.connect_clicked(clone!(@weak credits_button => move |_| credits_window.present()));
|
||||||
@ -129,16 +136,22 @@ pub fn build_ui(app: &adw::Application) {
|
|||||||
|
|
||||||
// Apt Update Page
|
// Apt Update Page
|
||||||
|
|
||||||
let apt_retry_signal_action = gtk::Button::builder().build();
|
let apt_retry_signal_action = gio::SimpleAction::new("retry", None);
|
||||||
|
|
||||||
let apt_update_view_stack_bin = adw::Bin::builder()
|
let apt_update_view_stack_bin = adw::Bin::builder()
|
||||||
.child(&apt_update_page::apt_update_page(window.clone(), &apt_retry_signal_action))
|
.child(&apt_update_page::apt_update_page(window.clone(), &apt_retry_signal_action))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
apt_retry_signal_action.connect_clicked(clone!(@weak window, @strong apt_retry_signal_action, @strong apt_update_view_stack_bin => move |_| {
|
apt_retry_signal_action.connect_activate(clone!(@weak window, @strong apt_retry_signal_action, @strong apt_update_view_stack_bin => move |_, _| {
|
||||||
apt_update_view_stack_bin.set_child(Some(&apt_update_page::apt_update_page(window, &apt_retry_signal_action)));
|
apt_update_view_stack_bin.set_child(Some(&apt_update_page::apt_update_page(window, &apt_retry_signal_action)));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
window_adw_view_stack.add_titled_with_icon(&apt_update_view_stack_bin, Some("apt_update_page"), &t!("apt_update_page_title"), "software-update-available-symbolic");
|
window_adw_view_stack.add_titled_with_icon(&apt_update_view_stack_bin, Some("apt_update_page"), &t!("apt_update_page_title"), "software-update-available-symbolic");
|
||||||
window_adw_view_stack.add_titled(>k::Image::builder().icon_name("firefox").build(), Some("apt_update_page2"), &t!("apt_update_page_title2"));
|
window_adw_view_stack.add_titled(>k::Image::builder().icon_name("firefox").build(), Some("apt_update_page2"), &t!("apt_update_page_title2"));
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
refresh_button.connect_clicked(clone!(@weak apt_retry_signal_action => move |_| {
|
||||||
|
apt_retry_signal_action.activate(None);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user