feat: create starter component for GettingStartedPage

feat/getting-started
Nefo Fortressia 2021-11-13 13:45:25 +07:00
parent 0c43be616e
commit fa6f4b6b5b
Signed by: fortressia
GPG Key ID: 6D7972CC76174995
2 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,35 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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 = "./getting-started.ui")]
pub struct GettingStartedPage {
#[template_child]
pub link_new_file: TemplateChild<gtk::LinkButton>,
#[template_child]
pub link_open_file: TemplateChild<gtk::Button>,
}
#[glib::object_subclass]
impl ObjectSubclass for GettingStartedPage {
const NAME: &'static str = "GettingStartedPage";
type Type = super::GettingStartedPage;
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 GettingStartedPage {}
impl WidgetImpl for GettingStartedPage {}
impl BoxImpl for GettingStartedPage {}

View File

@ -0,0 +1,28 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
pub mod imp;
use crate::components::prelude::*;
use glib::clone;
use gtk::prelude::*;
use gtk::subclass::prelude::*;
glib::wrapper! {
pub struct GettingStartedPage(ObjectSubclass<imp::GettingStartedPage>)
@extends gtk::Box, gtk::Widget,
@implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
}
impl GettingStartedPage {
pub fn new() -> Self {
glib::Object::new(&[]).expect("Failed to create 'GettingStartedPage' component.")
}
pub fn setup_actions<P: glib::IsA<crate::components::EchidnaWindow>>(&self, window: &P)
where
P: FileImplementedEditor,
{
let imp_class = imp::GettingStartedPage::from_instance(self);
}
}