style: format codebase with cargo fmt
parent
5e1de2ec96
commit
48f63a88ea
|
@ -2,36 +2,34 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk::CompositeTemplate;
|
||||
|
||||
#[derive(Default, CompositeTemplate)]
|
||||
#[template(file = "./editor.ui")]
|
||||
pub struct EchidnaCoreEditor {
|
||||
#[template_child]
|
||||
pub minimap: TemplateChild<sourceview::Map>,
|
||||
#[template_child]
|
||||
pub sourceview: TemplateChild<sourceview::View>
|
||||
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk::CompositeTemplate;
|
||||
|
||||
#[derive(Default, CompositeTemplate)]
|
||||
#[template(file = "./editor.ui")]
|
||||
pub struct EchidnaCoreEditor {
|
||||
#[template_child]
|
||||
pub minimap: TemplateChild<sourceview::Map>,
|
||||
#[template_child]
|
||||
pub sourceview: TemplateChild<sourceview::View>,
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for EchidnaCoreEditor {
|
||||
const NAME: &'static str = "EchidnaCoreEditor";
|
||||
type Type = super::EchidnaCoreEditor;
|
||||
type ParentType = gtk::Box;
|
||||
|
||||
fn class_init(class: &mut Self::Class) {
|
||||
Self::bind_template(class);
|
||||
}
|
||||
|
||||
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
|
||||
obj.init_template();
|
||||
}
|
||||
}
|
||||
|
||||
impl ObjectImpl for EchidnaCoreEditor {}
|
||||
impl WidgetImpl for EchidnaCoreEditor {}
|
||||
impl BoxImpl for EchidnaCoreEditor {}
|
||||
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for EchidnaCoreEditor {
|
||||
const NAME: &'static str = "EchidnaCoreEditor";
|
||||
type Type = super::EchidnaCoreEditor;
|
||||
type ParentType = gtk::Box;
|
||||
|
||||
fn class_init(class: &mut Self::Class) {
|
||||
Self::bind_template(class);
|
||||
}
|
||||
|
||||
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
|
||||
obj.init_template();
|
||||
}
|
||||
}
|
||||
|
||||
impl ObjectImpl for EchidnaCoreEditor {}
|
||||
impl WidgetImpl for EchidnaCoreEditor {}
|
||||
impl BoxImpl for EchidnaCoreEditor {}
|
||||
|
|
|
@ -13,19 +13,13 @@ glib::wrapper! {
|
|||
@implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
|
||||
}
|
||||
|
||||
|
||||
|
||||
impl EchidnaCoreEditor {
|
||||
|
||||
|
||||
pub fn new<P: glib::IsA<sourceview::File>>(file: Option<&P>) -> Self {
|
||||
let this: Self =
|
||||
glib::Object::new(&[]).expect("Failed to create 'EchidnaCoreEditor' component.");
|
||||
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>
|
||||
this_imp
|
||||
.minimap
|
||||
.set_view(&this_imp.sourceview.clone());
|
||||
this_imp.minimap.set_view(&this_imp.sourceview.clone());
|
||||
|
||||
if file.is_some() {
|
||||
let file = file.unwrap();
|
||||
|
@ -49,7 +43,6 @@ impl EchidnaCoreEditor {
|
|||
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);
|
||||
|
||||
|
||||
match language {
|
||||
Some(lang) => buffer.set_language(Some(&lang)),
|
||||
None => {}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
pub mod app;
|
||||
pub mod editor;
|
||||
pub mod sidebar;
|
||||
pub mod window;
|
||||
pub mod editor;
|
Loading…
Reference in New Issue