mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
reorganize arguments
This commit is contained in:
parent
e8eaaa5f32
commit
abb9de617d
3 changed files with 16 additions and 16 deletions
|
|
@ -105,7 +105,7 @@ impl Request {
|
||||||
if is_focused(e) {
|
if is_focused(e) {
|
||||||
e.emit_activate()
|
e.emit_activate()
|
||||||
} else {
|
} else {
|
||||||
i.borrow().dialog(&p, Some(e));
|
i.borrow().dialog(e, &p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => panic!(),
|
_ => panic!(),
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,9 @@ impl Info {
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
|
|
||||||
pub fn dialog(&self, profile: &Profile, parent: Option<&impl IsA<gtk::Widget>>) {
|
pub fn dialog(&self, parent: &impl IsA<gtk::Widget>, profile: &Profile) {
|
||||||
use adw::{PreferencesDialog, prelude::AdwDialogExt};
|
use adw::{PreferencesDialog, prelude::AdwDialogExt};
|
||||||
PreferencesDialog::info(self, profile).present(parent)
|
PreferencesDialog::info(profile, self).present(Some(parent))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Actualize `Self`
|
/// Actualize `Self`
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,11 @@ use adw::{
|
||||||
use gtk::glib::gformat;
|
use gtk::glib::gformat;
|
||||||
|
|
||||||
pub trait Dialog {
|
pub trait Dialog {
|
||||||
fn info(this: &Info, profile: &Profile) -> Self;
|
fn info(profile: &Profile, info: &Info) -> Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Dialog for PreferencesDialog {
|
impl Dialog for PreferencesDialog {
|
||||||
fn info(this: &Info, profile: &Profile) -> Self {
|
fn info(profile: &Profile, info: &Info) -> Self {
|
||||||
let d = PreferencesDialog::builder()
|
let d = PreferencesDialog::builder()
|
||||||
.search_enabled(true)
|
.search_enabled(true)
|
||||||
.title("Page info")
|
.title("Page info")
|
||||||
|
|
@ -20,10 +20,10 @@ impl Dialog for PreferencesDialog {
|
||||||
.title("General")
|
.title("General")
|
||||||
.icon_name("help-about-symbolic")
|
.icon_name("help-about-symbolic")
|
||||||
.build();
|
.build();
|
||||||
if this.mime.is_some() {
|
if info.mime.is_some() {
|
||||||
p.add(&{
|
p.add(&{
|
||||||
let g = PreferencesGroup::builder().title("Meta").build();
|
let g = PreferencesGroup::builder().title("Meta").build();
|
||||||
if let Some(ref mime) = this.mime {
|
if let Some(ref mime) = info.mime {
|
||||||
g.add(
|
g.add(
|
||||||
&ActionRow::builder()
|
&ActionRow::builder()
|
||||||
.css_classes(["property"])
|
.css_classes(["property"])
|
||||||
|
|
@ -37,7 +37,7 @@ impl Dialog for PreferencesDialog {
|
||||||
g
|
g
|
||||||
});
|
});
|
||||||
} // @TODO content language, header size, etc.
|
} // @TODO content language, header size, etc.
|
||||||
if this.size.header.is_some() || this.size.content.is_some() {
|
if info.size.header.is_some() || info.size.content.is_some() {
|
||||||
p.add(&{
|
p.add(&{
|
||||||
use crate::tool::Format;
|
use crate::tool::Format;
|
||||||
/// Common `ActionRow` widget pattern
|
/// Common `ActionRow` widget pattern
|
||||||
|
|
@ -53,12 +53,12 @@ impl Dialog for PreferencesDialog {
|
||||||
let g = PreferencesGroup::builder().title("Size").build();
|
let g = PreferencesGroup::builder().title("Size").build();
|
||||||
let mut i = 0; // count group members
|
let mut i = 0; // count group members
|
||||||
let mut t = 0; // count total size
|
let mut t = 0; // count total size
|
||||||
if let Some(ref c) = this.size.header {
|
if let Some(ref c) = info.size.header {
|
||||||
i += 1;
|
i += 1;
|
||||||
t += c;
|
t += c;
|
||||||
g.add(&r("Header", &c.bytes()))
|
g.add(&r("Header", &c.bytes()))
|
||||||
}
|
}
|
||||||
if let Some(ref c) = this.size.content {
|
if let Some(ref c) = info.size.content {
|
||||||
i += 1;
|
i += 1;
|
||||||
t += c;
|
t += c;
|
||||||
g.add(&r("Content", &c.bytes()))
|
g.add(&r("Content", &c.bytes()))
|
||||||
|
|
@ -76,7 +76,7 @@ impl Dialog for PreferencesDialog {
|
||||||
.title("Connection")
|
.title("Connection")
|
||||||
.icon_name("network-transmit-receive")
|
.icon_name("network-transmit-receive")
|
||||||
.build();
|
.build();
|
||||||
if let Some(ref socket) = this.socket {
|
if let Some(ref socket) = info.socket {
|
||||||
use gtk::{
|
use gtk::{
|
||||||
gio::{SocketAddress, SocketFamily},
|
gio::{SocketAddress, SocketFamily},
|
||||||
prelude::{SocketAddressExt, SocketConnectableExt},
|
prelude::{SocketAddressExt, SocketConnectableExt},
|
||||||
|
|
@ -161,7 +161,7 @@ impl Dialog for PreferencesDialog {
|
||||||
}
|
}
|
||||||
p
|
p
|
||||||
});
|
});
|
||||||
if this.redirect.is_some() {
|
if info.redirect.is_some() {
|
||||||
d.add(&{
|
d.add(&{
|
||||||
let g = PreferencesGroup::new();
|
let g = PreferencesGroup::new();
|
||||||
let p = PreferencesPage::builder()
|
let p = PreferencesPage::builder()
|
||||||
|
|
@ -180,7 +180,7 @@ impl Dialog for PreferencesDialog {
|
||||||
chain(b, r)
|
chain(b, r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chain(&mut b, this);
|
chain(&mut b, info);
|
||||||
b.reverse();
|
b.reverse();
|
||||||
let l = b.len(); // calculate once
|
let l = b.len(); // calculate once
|
||||||
let t = b[0].event[0].time(); // first event time to count from
|
let t = b[0].event[0].time(); // first event time to count from
|
||||||
|
|
@ -226,7 +226,7 @@ impl Dialog for PreferencesDialog {
|
||||||
p
|
p
|
||||||
}) // @TODO clickable navigation, test time values
|
}) // @TODO clickable navigation, test time values
|
||||||
}
|
}
|
||||||
if !this.event.is_empty() {
|
if !info.event.is_empty() {
|
||||||
d.add(&{
|
d.add(&{
|
||||||
let p = PreferencesPage::builder()
|
let p = PreferencesPage::builder()
|
||||||
.title("Events")
|
.title("Events")
|
||||||
|
|
@ -234,7 +234,7 @@ impl Dialog for PreferencesDialog {
|
||||||
.build();
|
.build();
|
||||||
p.add(&{
|
p.add(&{
|
||||||
let g = PreferencesGroup::new();
|
let g = PreferencesGroup::new();
|
||||||
let e = &this.event[0];
|
let e = &info.event[0];
|
||||||
let t = e.time();
|
let t = e.time();
|
||||||
let n = e.name();
|
let n = e.name();
|
||||||
g.add(
|
g.add(
|
||||||
|
|
@ -245,7 +245,7 @@ impl Dialog for PreferencesDialog {
|
||||||
.title(n)
|
.title(n)
|
||||||
.build(),
|
.build(),
|
||||||
);
|
);
|
||||||
for e in &this.event[1..] {
|
for e in &info.event[1..] {
|
||||||
g.add(
|
g.add(
|
||||||
&ActionRow::builder()
|
&ActionRow::builder()
|
||||||
.subtitle(gformat!(
|
.subtitle(gformat!(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue