Compare commits
17 Commits
Author | SHA1 | Date |
---|---|---|
Nefo Fortressia | 60fc36c852 | |
Nefo Fortressia | 4a152416ff | |
Nefo Fortressia | 319bc3914b | |
Nefo Fortressia | e077e690f2 | |
Nefo Fortressia | c6da158bb6 | |
Nefo Fortressia | f785463540 | |
Nefo Fortressia | fa128ca284 | |
Nefo Fortressia | e0d353a10b | |
Nefo Fortressia | b53915afa0 | |
Nefo Fortressia | 9b99932fdd | |
Nefo Fortressia | 8e31be7e47 | |
Nefo Fortressia | c8fd305d90 | |
Nefo Fortressia | 10ae0cf783 | |
Nefo Fortressia | 9e06e96fed | |
Nefo Fortressia | c3a0e5dcee | |
Nefo Fortressia | 87fdfc8d9c | |
Nefo Fortressia | 0bd8b34cfe |
|
@ -0,0 +1,15 @@
|
|||
# Description
|
||||
|
||||
Please write down a clear and concise description of this Merge Request.
|
||||
|
||||
# Closes
|
||||
|
||||
Please write down the issues that this MR closes.
|
||||
|
||||
# Implementation Insight
|
||||
|
||||
Please write down how did you implement this in a clear and concise manner.
|
||||
|
||||
# TO-DOs
|
||||
|
||||
A list of TO-DOs of things you have did before the MR is undrafted.
|
|
@ -1,3 +1,15 @@
|
|||
---
|
||||
|
||||
name: Bug Report
|
||||
about: Report a bug affecting Echidna Code Editor
|
||||
title: bug:
|
||||
ref: main
|
||||
labels:
|
||||
|
||||
- bug
|
||||
- help needed
|
||||
---
|
||||
|
||||
## Description
|
||||
|
||||
Please write a clear and concise description of the issue you are getting.
|
|
@ -1,3 +1,15 @@
|
|||
---
|
||||
|
||||
name: Feature Request
|
||||
about: Request a new feature or support that can be implemented into Echidna.
|
||||
title: "feat: "
|
||||
ref: main
|
||||
labels:
|
||||
|
||||
- enhancement
|
||||
|
||||
---
|
||||
|
||||
## Description
|
||||
|
||||
Please write a clear and concise description of the issue you are getting.
|
|
@ -1 +0,0 @@
|
|||
"clippy::style" = "deny"
|
|
@ -15,10 +15,11 @@
|
|||
<object class="GtkSourceView" id="sourceview">
|
||||
<property name="vexpand">1</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="show-line-numbers">1</property>
|
||||
<property name="show-line-marks">1</property>
|
||||
<property name="buffer">
|
||||
<object class="GtkSourceBuffer"></object>
|
||||
</property>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
@ -24,8 +24,8 @@ impl EchidnaCoreEditor {
|
|||
// 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());
|
||||
|
||||
if file.is_some() {
|
||||
let file = file.unwrap();
|
||||
match file {
|
||||
Some(file) => {
|
||||
let file_location = file
|
||||
.location()
|
||||
.expect("file is required to have a location");
|
||||
|
@ -76,6 +76,8 @@ impl EchidnaCoreEditor {
|
|||
);
|
||||
}
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
this
|
||||
}
|
||||
|
||||
|
@ -118,10 +120,10 @@ impl EchidnaCoreEditor {
|
|||
|_, _| {},
|
||||
|result| {
|
||||
if result.is_err() {
|
||||
panic!(format!(
|
||||
panic!(
|
||||
"Found an error while saving the file:\n{}",
|
||||
result.err().expect("No error")
|
||||
))
|
||||
)
|
||||
}
|
||||
},
|
||||
);
|
||||
|
|
|
@ -15,3 +15,9 @@ impl EchidnaSidebar {
|
|||
glib::Object::new(&[]).expect("Failed to create 'EchidnaSidebar' component.")
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for EchidnaSidebar {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,9 +36,9 @@ impl BuildableImpl for TabLabel {
|
|||
fn add_child(
|
||||
&self,
|
||||
buildable: &Self::Type,
|
||||
builder: >k::Builder,
|
||||
_builder: >k::Builder,
|
||||
child: &glib::Object,
|
||||
type_: Option<&str>,
|
||||
_type_: Option<&str>,
|
||||
) {
|
||||
buildable.prepend(child.downcast_ref::<gtk::Widget>().unwrap());
|
||||
}
|
||||
|
|
|
@ -17,8 +17,9 @@ impl TabLabel {
|
|||
pub fn new<U: IsA<gtk::Widget>>(tab_label: Option<&U>) -> Self {
|
||||
let this: Self = glib::Object::new(&[]).expect("Failed to create 'TabLabel' component.");
|
||||
|
||||
if tab_label.is_some() {
|
||||
this.prepend(tab_label.unwrap());
|
||||
match tab_label {
|
||||
Some(tab_label) => this.prepend(tab_label),
|
||||
None => {}
|
||||
}
|
||||
this
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ pub trait FileImplementedEditor {
|
|||
fn action_open_file(&self);
|
||||
fn open_file(notebook: >k::Notebook, file: gio::File);
|
||||
fn action_save_file_as(&self);
|
||||
fn action_new_file(&self);
|
||||
fn action_save_file(&self);
|
||||
}
|
||||
|
||||
|
@ -66,7 +67,7 @@ impl FileImplementedEditor for super::EchidnaWindow {
|
|||
notebook.prepend_closable_page(
|
||||
&editor_page,
|
||||
Some(&Label::new(Some(
|
||||
&file_location
|
||||
file_location
|
||||
.path()
|
||||
.expect("The file's path is missing")
|
||||
.file_name()
|
||||
|
@ -102,6 +103,14 @@ impl FileImplementedEditor for super::EchidnaWindow {
|
|||
}));
|
||||
}
|
||||
|
||||
fn action_new_file(&self) {
|
||||
let editor_page = EchidnaCoreEditor::new(None);
|
||||
|
||||
self.to_imp()
|
||||
.notebook
|
||||
.prepend_closable_page(&editor_page, Some(>k::Label::new(Some(&"Untitled"))));
|
||||
}
|
||||
|
||||
fn action_save_file(&self) {
|
||||
let page: EchidnaCoreEditor = self
|
||||
.get_current_tab()
|
||||
|
|
|
@ -122,6 +122,16 @@ impl MenubarImplementedEditor for EchidnaWindow {
|
|||
window.action_save_file_as();
|
||||
}));
|
||||
}
|
||||
{
|
||||
let action_new_file = SimpleAction::new("new-file", None);
|
||||
|
||||
self.add_action(&action_new_file);
|
||||
|
||||
action_new_file.connect_activate(clone!(@weak self as window =>
|
||||
move |_action, _variant| {
|
||||
window.action_new_file();
|
||||
}));
|
||||
}
|
||||
{
|
||||
let action_save = SimpleAction::new("save", None);
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use crate::components::tab_label::TabLabel;
|
||||
use glib::IsA;
|
||||
use gtk::{prelude::*, Box, Button, Widget};
|
||||
use gtk::{prelude::*, Widget};
|
||||
|
||||
pub trait ClosableTabImplementedNotebook {
|
||||
fn prepend_closable_page<T: IsA<Widget>, U: IsA<Widget>>(
|
||||
|
|
Loading…
Reference in New Issue