style: format codebase with cargo fmt
parent
5e1de2ec96
commit
48f63a88ea
|
@ -12,8 +12,7 @@
|
||||||
#[template_child]
|
#[template_child]
|
||||||
pub minimap: TemplateChild<sourceview::Map>,
|
pub minimap: TemplateChild<sourceview::Map>,
|
||||||
#[template_child]
|
#[template_child]
|
||||||
pub sourceview: TemplateChild<sourceview::View>
|
pub sourceview: TemplateChild<sourceview::View>,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[glib::object_subclass]
|
#[glib::object_subclass]
|
||||||
|
@ -34,4 +33,3 @@
|
||||||
impl ObjectImpl for EchidnaCoreEditor {}
|
impl ObjectImpl for EchidnaCoreEditor {}
|
||||||
impl WidgetImpl for EchidnaCoreEditor {}
|
impl WidgetImpl for EchidnaCoreEditor {}
|
||||||
impl BoxImpl for EchidnaCoreEditor {}
|
impl BoxImpl for EchidnaCoreEditor {}
|
||||||
|
|
|
@ -13,19 +13,13 @@ glib::wrapper! {
|
||||||
@implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
|
@implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
impl EchidnaCoreEditor {
|
impl EchidnaCoreEditor {
|
||||||
|
|
||||||
|
|
||||||
pub fn new<P: glib::IsA<sourceview::File>>(file: Option<&P>) -> Self {
|
pub fn new<P: glib::IsA<sourceview::File>>(file: Option<&P>) -> Self {
|
||||||
let this: Self =
|
let this: Self =
|
||||||
glib::Object::new(&[]).expect("Failed to create 'EchidnaCoreEditor' component.");
|
glib::Object::new(&[]).expect("Failed to create 'EchidnaCoreEditor' component.");
|
||||||
let this_imp = this.to_imp();
|
let this_imp = this.to_imp();
|
||||||
// Without cloning it, for some reasons the Rust compiler complains about &this.to_imp().sourceview not being IsA<sourceview::View>
|
// Without cloning it, for some reasons the Rust compiler complains about &this.to_imp().sourceview not being IsA<sourceview::View>
|
||||||
this_imp
|
this_imp.minimap.set_view(&this_imp.sourceview.clone());
|
||||||
.minimap
|
|
||||||
.set_view(&this_imp.sourceview.clone());
|
|
||||||
|
|
||||||
if file.is_some() {
|
if file.is_some() {
|
||||||
let file = file.unwrap();
|
let file = file.unwrap();
|
||||||
|
@ -49,7 +43,6 @@ impl EchidnaCoreEditor {
|
||||||
let language_manager = LanguageManager::new();
|
let language_manager = LanguageManager::new();
|
||||||
let language = language_manager.guess_language(Some(&info.name().to_str().expect("Could not open the file because its name is not supported by Unicode.")), None);
|
let language = language_manager.guess_language(Some(&info.name().to_str().expect("Could not open the file because its name is not supported by Unicode.")), None);
|
||||||
|
|
||||||
|
|
||||||
match language {
|
match language {
|
||||||
Some(lang) => buffer.set_language(Some(&lang)),
|
Some(lang) => buffer.set_language(Some(&lang)),
|
||||||
None => {}
|
None => {}
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
pub mod app;
|
pub mod app;
|
||||||
|
pub mod editor;
|
||||||
pub mod sidebar;
|
pub mod sidebar;
|
||||||
pub mod window;
|
pub mod window;
|
||||||
pub mod editor;
|
|
Loading…
Reference in New Issue