mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-29 20:44:25 +00:00
define strings as const
This commit is contained in:
parent
556a85b7e5
commit
09c1655301
@ -18,6 +18,11 @@ use gtk::{
|
|||||||
};
|
};
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
|
const ICON_NAME: &str = "document-save-symbolic";
|
||||||
|
const STATUS_CANCELLED: &str = "Operation cancelled";
|
||||||
|
const STATUS_LOADING: &str = "Loading...";
|
||||||
|
const TITLE: &str = "Download";
|
||||||
|
|
||||||
/// Create new [StatusPage](https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.StatusPage.html)
|
/// Create new [StatusPage](https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.StatusPage.html)
|
||||||
/// with progress indication and UI controls
|
/// with progress indication and UI controls
|
||||||
/// * applies callback function once on destination [File](https://docs.gtk.org/gio/iface.File.html) selected
|
/// * applies callback function once on destination [File](https://docs.gtk.org/gio/iface.File.html) selected
|
||||||
@ -50,7 +55,7 @@ pub fn new(
|
|||||||
progress.disable();
|
progress.disable();
|
||||||
|
|
||||||
// update `status`
|
// update `status`
|
||||||
status.set_warning("Operation cancelled");
|
status.set_warning(STATUS_CANCELLED);
|
||||||
|
|
||||||
// hide self
|
// hide self
|
||||||
button.set_visible(false);
|
button.set_visible(false);
|
||||||
@ -84,13 +89,13 @@ pub fn new(
|
|||||||
// update destination file
|
// update destination file
|
||||||
file_launcher.set_file(Some(&file));
|
file_launcher.set_file(Some(&file));
|
||||||
|
|
||||||
// update `status`
|
// update `status` text
|
||||||
status.set_default("Loading...");
|
status.set_default(STATUS_LOADING);
|
||||||
|
|
||||||
// show `cancel` button
|
// show `cancel` button
|
||||||
cancel.button.set_visible(true);
|
cancel.button.set_visible(true);
|
||||||
|
|
||||||
// show `spinner`
|
// show spinner
|
||||||
progress.enable();
|
progress.enable();
|
||||||
|
|
||||||
// hide self
|
// hide self
|
||||||
@ -103,7 +108,7 @@ pub fn new(
|
|||||||
// update destination file
|
// update destination file
|
||||||
file_launcher.set_file(File::NONE);
|
file_launcher.set_file(File::NONE);
|
||||||
|
|
||||||
// update `spinner`
|
// hide spinner
|
||||||
progress.disable();
|
progress.disable();
|
||||||
|
|
||||||
// update `status`
|
// update `status`
|
||||||
@ -146,7 +151,7 @@ pub fn new(
|
|||||||
// Init main widget
|
// Init main widget
|
||||||
StatusPage::builder()
|
StatusPage::builder()
|
||||||
.child(&child)
|
.child(&child)
|
||||||
.icon_name("document-save-symbolic")
|
.icon_name(ICON_NAME)
|
||||||
.title("Download")
|
.title(TITLE)
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user