mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-26 03:47:23 +01:00
71 lines
2.2 KiB
Rust
71 lines
2.2 KiB
Rust
/* window.rs
|
|
*
|
|
* Copyright 2023 Unknown
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*/
|
|
|
|
use gtk::prelude::*;
|
|
use adw::subclass::prelude::*;
|
|
use gtk::{gio, glib};
|
|
|
|
mod imp {
|
|
use super::*;
|
|
|
|
#[derive(Debug, Default, gtk::CompositeTemplate)]
|
|
#[template(resource = "/de/johrpan/musicus/window.ui")]
|
|
pub struct MusicusWindow {
|
|
// Template widgets
|
|
#[template_child]
|
|
pub header_bar: TemplateChild<gtk::HeaderBar>,
|
|
#[template_child]
|
|
pub label: TemplateChild<gtk::Label>,
|
|
}
|
|
|
|
#[glib::object_subclass]
|
|
impl ObjectSubclass for MusicusWindow {
|
|
const NAME: &'static str = "MusicusWindow";
|
|
type Type = super::MusicusWindow;
|
|
type ParentType = adw::ApplicationWindow;
|
|
|
|
fn class_init(klass: &mut Self::Class) {
|
|
klass.bind_template();
|
|
}
|
|
|
|
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
|
|
obj.init_template();
|
|
}
|
|
}
|
|
|
|
impl ObjectImpl for MusicusWindow {}
|
|
impl WidgetImpl for MusicusWindow {}
|
|
impl WindowImpl for MusicusWindow {}
|
|
impl ApplicationWindowImpl for MusicusWindow {}
|
|
impl AdwApplicationWindowImpl for MusicusWindow {}
|
|
}
|
|
|
|
glib::wrapper! {
|
|
pub struct MusicusWindow(ObjectSubclass<imp::MusicusWindow>)
|
|
@extends gtk::Widget, gtk::Window, gtk::ApplicationWindow, adw::ApplicationWindow, @implements gio::ActionGroup, gio::ActionMap;
|
|
}
|
|
|
|
impl MusicusWindow {
|
|
pub fn new<P: glib::IsA<gtk::Application>>(application: &P) -> Self {
|
|
glib::Object::builder()
|
|
.property("application", application)
|
|
.build()
|
|
}
|
|
}
|