-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
139 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
fn main() { | ||
glib_build_tools::compile_resources( | ||
&["src/resources"], | ||
"src/resources/resources.gresource.xml", | ||
&["src/example/resources"], | ||
"src/example/resources/resources.gresource.xml", | ||
"actions_6.gresource", | ||
); | ||
glib_build_tools::compile_resources( | ||
&["src/ManagerLauncher/resources"], | ||
"src/ManagerLauncher/resources/resources.gresource.xml", | ||
"ManagerLauncher.gresource", | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
mod window; | ||
|
||
use gtk::{gio, glib}; | ||
use window::Window; | ||
use adw::prelude::*; | ||
|
||
const APP_ID: &str = "Sonic4ModLoader.ManagerLauncher"; | ||
|
||
fn main() -> glib::ExitCode { | ||
gio::resources_register_include!("ManagerLauncher.gresource") | ||
.expect("Failed to register resources."); | ||
|
||
let app = adw::Application::builder().application_id(APP_ID).build(); | ||
app.connect_activate(build_ui); | ||
app.run() | ||
} | ||
|
||
fn build_ui(app: &adw::Application) { | ||
Window::new(app).present() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<gresources> | ||
<gresource prefix="/Sonic4ModLoader/ManagerLauncher/"> | ||
<file compressed="true" preprocess="xml-stripblanks">window.ui</file> | ||
</gresource> | ||
</gresources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<interface> | ||
<template class="ManagerLauncher" parent="GtkApplicationWindow"> | ||
<property name="title">ManagerLauncher</property> | ||
<property name="width-request">360</property> | ||
<child> | ||
<object class="GtkBox" id="gtk_box"> | ||
<property name="orientation">vertical</property> | ||
<property name="margin-top">12</property> | ||
<property name="margin-bottom">12</property> | ||
<property name="margin-start">12</property> | ||
<property name="margin-end">12</property> | ||
<property name="spacing">12</property> | ||
<property name="halign">center</property> | ||
<child> | ||
<object class="GtkButton" id="button"> | ||
<property name="label">test</property> | ||
<property name="action-name"></property> | ||
</object> | ||
</child> | ||
</object> | ||
</child> | ||
</template> | ||
</interface> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
use glib::subclass::InitializingObject; | ||
use gtk::subclass::prelude::*; | ||
use gtk::{glib, Button, CompositeTemplate, Label}; | ||
|
||
// Object holding the state | ||
#[derive(CompositeTemplate, Default)] | ||
#[template(resource = "/Sonic4ModLoader/ManagerLauncher/window.ui")] | ||
pub struct Window { | ||
#[template_child] | ||
pub gtk_box: TemplateChild<gtk::Box>, | ||
#[template_child] | ||
pub button: TemplateChild<Button>, | ||
} | ||
|
||
// The central trait for subclassing a GObject | ||
#[glib::object_subclass] | ||
impl ObjectSubclass for Window { | ||
// `NAME` needs to match `class` attribute of template | ||
const NAME: &'static str = "ManagerLauncher"; | ||
type Type = super::Window; | ||
type ParentType = gtk::ApplicationWindow; | ||
|
||
fn class_init(klass: &mut Self::Class) { | ||
klass.bind_template(); | ||
} | ||
|
||
fn instance_init(obj: &InitializingObject<Self>) { | ||
obj.init_template(); | ||
} | ||
} | ||
|
||
// Trait shared by all GObjects | ||
impl ObjectImpl for Window { | ||
fn constructed(&self) { | ||
// Call "constructed" on parent | ||
self.parent_constructed(); | ||
|
||
// Add actions | ||
self.obj().setup_actions(); | ||
} | ||
} | ||
|
||
// Trait shared by all widgets | ||
impl WidgetImpl for Window {} | ||
|
||
// Trait shared by all windows | ||
impl WindowImpl for Window {} | ||
|
||
// Trait shared by all application windows | ||
impl ApplicationWindowImpl for Window {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
mod imp; | ||
|
||
use gio::{ActionEntry, PropertyAction}; | ||
use glib::Object; | ||
use gtk::prelude::*; | ||
use gtk::subclass::prelude::*; | ||
use gtk::{gio, glib, Orientation}; | ||
|
||
glib::wrapper! { | ||
pub struct Window(ObjectSubclass<imp::Window>) | ||
@extends gtk::ApplicationWindow, gtk::Window, gtk::Widget, | ||
@implements gio::ActionGroup, gio::ActionMap, gtk::Accessible, gtk::Buildable, | ||
gtk::ConstraintTarget, gtk::Native, gtk::Root, gtk::ShortcutManager; | ||
} | ||
|
||
impl Window { | ||
pub fn new(app: &adw::Application) -> Self { | ||
Object::builder().property("application", app).build() | ||
} | ||
|
||
fn setup_actions(&self) { | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.