feat: first page
This commit is contained in:
parent
0c6a106c07
commit
7c911282b6
17 changed files with 645 additions and 166 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
|||
target
|
||||
.flatpak
|
||||
src/config.rs
|
18
.vscode/settings.json
vendored
Normal file
18
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"files.watcherExclude": {
|
||||
"**/.git/objects/**": true,
|
||||
"**/.git/subtree-cache/**": true,
|
||||
"**/node_modules/*/**": true,
|
||||
"**/.hg/store/**": true,
|
||||
".flatpak/**": true,
|
||||
"_build/**": true
|
||||
},
|
||||
"mesonbuild.configureOnOpen": false,
|
||||
"mesonbuild.buildFolder": "_build",
|
||||
"mesonbuild.mesonPath": "${workspaceFolder}/.flatpak/meson.sh",
|
||||
"rust-analyzer.server.path": "${workspaceFolder}/.flatpak/rust-analyzer.sh",
|
||||
"rust-analyzer.runnables.command": "${workspaceFolder}/.flatpak/cargo.sh",
|
||||
"rust-analyzer.files.excludeDirs": [
|
||||
".flatpak"
|
||||
]
|
||||
}
|
|
@ -1,51 +1,59 @@
|
|||
{
|
||||
"app-id" : "dev.mnts.ModManager",
|
||||
"runtime" : "org.gnome.Platform",
|
||||
"runtime-version" : "master",
|
||||
"sdk" : "org.gnome.Sdk",
|
||||
"sdk-extensions" : [
|
||||
"org.freedesktop.Sdk.Extension.rust-stable"
|
||||
],
|
||||
"command" : "mod-manager",
|
||||
"finish-args" : [
|
||||
"--share=network",
|
||||
"--share=ipc",
|
||||
"--socket=fallback-x11",
|
||||
"--device=dri",
|
||||
"--socket=wayland"
|
||||
],
|
||||
"build-options" : {
|
||||
"append-path" : "/usr/lib/sdk/rust-stable/bin",
|
||||
"build-args" : [
|
||||
"--share=network"
|
||||
],
|
||||
"env" : {
|
||||
"RUST_BACKTRACE" : "1",
|
||||
"RUST_LOG" : "mod-manager=debug"
|
||||
}
|
||||
},
|
||||
"cleanup" : [
|
||||
"/include",
|
||||
"/lib/pkgconfig",
|
||||
"/man",
|
||||
"/share/doc",
|
||||
"/share/gtk-doc",
|
||||
"/share/man",
|
||||
"/share/pkgconfig",
|
||||
"*.la",
|
||||
"*.a"
|
||||
],
|
||||
"modules" : [
|
||||
"app-id": "dev.mnts.ModManager",
|
||||
"runtime": "org.gnome.Platform",
|
||||
"runtime-version": "master",
|
||||
"sdk": "org.gnome.Sdk",
|
||||
"sdk-extensions": ["org.freedesktop.Sdk.Extension.rust-stable"],
|
||||
"command": "mod-manager",
|
||||
"finish-args": [
|
||||
"--share=network",
|
||||
"--share=ipc",
|
||||
"--socket=fallback-x11",
|
||||
"--device=dri",
|
||||
"--socket=wayland"
|
||||
],
|
||||
"build-options": {
|
||||
"append-path": "/usr/lib/sdk/rust-stable/bin",
|
||||
"build-args": ["--share=network"],
|
||||
"env": {
|
||||
"RUST_BACKTRACE": "1",
|
||||
"RUST_LOG": "mod-manager=debug"
|
||||
}
|
||||
},
|
||||
"cleanup": [
|
||||
"/include",
|
||||
"/lib/pkgconfig",
|
||||
"/man",
|
||||
"/share/doc",
|
||||
"/share/gtk-doc",
|
||||
"/share/man",
|
||||
"/share/pkgconfig",
|
||||
"*.la",
|
||||
"*.a"
|
||||
],
|
||||
"modules": [
|
||||
{
|
||||
"name": "blueprint-compiler",
|
||||
"buildsystem": "meson",
|
||||
"cleanup": ["*"],
|
||||
"sources": [
|
||||
{
|
||||
"name" : "mod-manager",
|
||||
"builddir" : true,
|
||||
"buildsystem" : "meson",
|
||||
"sources" : [
|
||||
{
|
||||
"type" : "git",
|
||||
"url" : "file:///home/tine/projects"
|
||||
}
|
||||
]
|
||||
"type": "git",
|
||||
"url": "https://gitlab.gnome.org/jwestman/blueprint-compiler",
|
||||
"tag": "v0.10.0"
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "mod-manager",
|
||||
"builddir": true,
|
||||
"buildsystem": "meson",
|
||||
"sources": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "file:///home/tine/projects"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ use gtk::{gio, glib};
|
|||
|
||||
use crate::config::VERSION;
|
||||
use crate::ModManagerWindow;
|
||||
use crate::pages::welcome::ModManagerWelcome;
|
||||
|
||||
mod imp {
|
||||
use super::*;
|
||||
|
@ -59,6 +60,10 @@ mod imp {
|
|||
window
|
||||
} else {
|
||||
let window = ModManagerWindow::new(&*application);
|
||||
|
||||
let welcome = &ModManagerWelcome::new().upcast::<adw::NavigationPage>();
|
||||
window.set_page(welcome);
|
||||
|
||||
window.upcast()
|
||||
};
|
||||
|
||||
|
|
24
src/gtk/help-overlay.blp
Normal file
24
src/gtk/help-overlay.blp
Normal file
|
@ -0,0 +1,24 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
ShortcutsWindow help_overlay {
|
||||
modal: true;
|
||||
|
||||
ShortcutsSection {
|
||||
section-name: "shortcuts";
|
||||
max-height: 10;
|
||||
|
||||
ShortcutsGroup {
|
||||
title: C_("shortcut window", "General");
|
||||
|
||||
ShortcutsShortcut {
|
||||
title: C_("shortcut window", "Show Shortcuts");
|
||||
action-name: "win.show-help-overlay";
|
||||
}
|
||||
|
||||
ShortcutsShortcut {
|
||||
title: C_("shortcut window", "Quit");
|
||||
action-name: "app.quit";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkShortcutsWindow" id="help_overlay">
|
||||
<property name="modal">True</property>
|
||||
<child>
|
||||
<object class="GtkShortcutsSection">
|
||||
<property name="section-name">shortcuts</property>
|
||||
<property name="max-height">10</property>
|
||||
<child>
|
||||
<object class="GtkShortcutsGroup">
|
||||
<property name="title" translatable="yes" context="shortcut window">General</property>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="title" translatable="yes" context="shortcut window">Show Shortcuts</property>
|
||||
<property name="action-name">win.show-help-overlay</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="title" translatable="yes" context="shortcut window">Quit</property>
|
||||
<property name="action-name">app.quit</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
34
src/main.rs
34
src/main.rs
|
@ -1,26 +1,24 @@
|
|||
/* main.rs
|
||||
*
|
||||
* Copyright 2023 Tine
|
||||
*
|
||||
* 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
|
||||
/*
|
||||
Copyright (c) 2023 Tine Jozelj
|
||||
|
||||
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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
mod application;
|
||||
mod config;
|
||||
mod window;
|
||||
mod pages;
|
||||
|
||||
use self::application::ModManagerApplication;
|
||||
use self::window::ModManagerWindow;
|
||||
|
|
|
@ -1,8 +1,21 @@
|
|||
pkgdatadir = get_option('prefix') / get_option('datadir') / meson.project_name()
|
||||
gnome = import('gnome')
|
||||
|
||||
blueprints = custom_target('blueprints',
|
||||
input: files(
|
||||
'window.blp',
|
||||
'gtk/help-overlay.blp',
|
||||
'pages/chose-game-location.blp',
|
||||
'pages/main.blp',
|
||||
'pages/welcome.blp',
|
||||
),
|
||||
output: '.',
|
||||
command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
|
||||
)
|
||||
|
||||
gnome.compile_resources('mod-manager',
|
||||
'mod-manager.gresource.xml',
|
||||
dependencies: blueprints,
|
||||
gresource_bundle: true,
|
||||
install: true,
|
||||
install_dir: pkgdatadir,
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/dev/mnts/ModManager">
|
||||
<file preprocess="xml-stripblanks">window.ui</file>
|
||||
<file preprocess="xml-stripblanks">gtk/help-overlay.ui</file>
|
||||
<file>pages/welcome.ui</file>
|
||||
<file>pages/main.ui</file>
|
||||
<file>pages/chose-game-location.blp</file>
|
||||
<file>gtk/help-overlay.ui</file>
|
||||
<file>window.ui</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
|
||||
|
|
123
src/pages/chose-game-location.blp
Normal file
123
src/pages/chose-game-location.blp
Normal file
|
@ -0,0 +1,123 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
Box welcome {
|
||||
orientation: vertical;
|
||||
valign: center;
|
||||
halign: center;
|
||||
|
||||
Image {
|
||||
name: "logo";
|
||||
icon-name: "re.sonny.Workbench";
|
||||
pixel-size: 196;
|
||||
margin-bottom: 30;
|
||||
|
||||
styles [
|
||||
"icon-dropshadow"
|
||||
]
|
||||
}
|
||||
|
||||
Label {
|
||||
label: _("Welcome to Mod Manager");
|
||||
margin-bottom: 30;
|
||||
|
||||
styles [
|
||||
"title-1"
|
||||
]
|
||||
}
|
||||
|
||||
Box subtitle {
|
||||
orientation: vertical;
|
||||
halign: center;
|
||||
margin-bottom: 30;
|
||||
|
||||
Label {
|
||||
label: "Learn and prototype with\nGNOME technologies";
|
||||
justify: center;
|
||||
}
|
||||
}
|
||||
|
||||
Box {
|
||||
orientation: vertical;
|
||||
homogeneous: true;
|
||||
halign: center;
|
||||
|
||||
Box {
|
||||
margin-bottom: 6;
|
||||
|
||||
Image {
|
||||
icon-name: "update-symbolic";
|
||||
margin-end: 12;
|
||||
icon-size: normal;
|
||||
}
|
||||
|
||||
Label {
|
||||
label: _("Edit Style or UI to update the Preview");
|
||||
}
|
||||
}
|
||||
|
||||
Box {
|
||||
margin-bottom: 6;
|
||||
|
||||
Image {
|
||||
icon-name: "media-playback-start-symbolic";
|
||||
margin-end: 12;
|
||||
icon-size: normal;
|
||||
}
|
||||
|
||||
Label {
|
||||
label: _("Hit");
|
||||
}
|
||||
|
||||
ShortcutsShortcut {
|
||||
accelerator: "<Control>Return";
|
||||
margin-start: 12;
|
||||
}
|
||||
|
||||
Label {
|
||||
label: _("to format and run Code");
|
||||
}
|
||||
}
|
||||
|
||||
Box {
|
||||
margin-bottom: 6;
|
||||
|
||||
Image {
|
||||
icon-name: "media-floppy-symbolic";
|
||||
margin-end: 12;
|
||||
icon-size: normal;
|
||||
}
|
||||
|
||||
Label {
|
||||
label: _("Changes are automatically saved and restored");
|
||||
}
|
||||
}
|
||||
|
||||
Box {
|
||||
margin-bottom: 6;
|
||||
|
||||
Image {
|
||||
icon-name: "library-symbolic";
|
||||
margin-end: 12;
|
||||
icon-size: normal;
|
||||
}
|
||||
|
||||
Label {
|
||||
label: _("Browse the Library for demos and examples");
|
||||
}
|
||||
}
|
||||
|
||||
Box {
|
||||
margin-bottom: 6;
|
||||
|
||||
Image {
|
||||
icon-name: "user-bookmarks-symbolic";
|
||||
margin-end: 12;
|
||||
icon-size: normal;
|
||||
}
|
||||
|
||||
Label {
|
||||
label: _("Checkout the Bookmarks menu to learn and get help");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
123
src/pages/main.blp
Normal file
123
src/pages/main.blp
Normal file
|
@ -0,0 +1,123 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
Box welcome {
|
||||
orientation: vertical;
|
||||
valign: center;
|
||||
halign: center;
|
||||
|
||||
Image {
|
||||
name: "logo";
|
||||
icon-name: "re.sonny.Workbench";
|
||||
pixel-size: 196;
|
||||
margin-bottom: 30;
|
||||
|
||||
styles [
|
||||
"icon-dropshadow"
|
||||
]
|
||||
}
|
||||
|
||||
Label {
|
||||
label: _("Welcome to Mod Manager");
|
||||
margin-bottom: 30;
|
||||
|
||||
styles [
|
||||
"title-1"
|
||||
]
|
||||
}
|
||||
|
||||
Box subtitle {
|
||||
orientation: vertical;
|
||||
halign: center;
|
||||
margin-bottom: 30;
|
||||
|
||||
Label {
|
||||
label: "Learn and prototype with\nGNOME technologies";
|
||||
justify: center;
|
||||
}
|
||||
}
|
||||
|
||||
Box {
|
||||
orientation: vertical;
|
||||
homogeneous: true;
|
||||
halign: center;
|
||||
|
||||
Box {
|
||||
margin-bottom: 6;
|
||||
|
||||
Image {
|
||||
icon-name: "update-symbolic";
|
||||
margin-end: 12;
|
||||
icon-size: normal;
|
||||
}
|
||||
|
||||
Label {
|
||||
label: _("Edit Style or UI to update the Preview");
|
||||
}
|
||||
}
|
||||
|
||||
Box {
|
||||
margin-bottom: 6;
|
||||
|
||||
Image {
|
||||
icon-name: "media-playback-start-symbolic";
|
||||
margin-end: 12;
|
||||
icon-size: normal;
|
||||
}
|
||||
|
||||
Label {
|
||||
label: _("Hit");
|
||||
}
|
||||
|
||||
ShortcutsShortcut {
|
||||
accelerator: "<Control>Return";
|
||||
margin-start: 12;
|
||||
}
|
||||
|
||||
Label {
|
||||
label: _("to format and run Code");
|
||||
}
|
||||
}
|
||||
|
||||
Box {
|
||||
margin-bottom: 6;
|
||||
|
||||
Image {
|
||||
icon-name: "media-floppy-symbolic";
|
||||
margin-end: 12;
|
||||
icon-size: normal;
|
||||
}
|
||||
|
||||
Label {
|
||||
label: _("Changes are automatically saved and restored");
|
||||
}
|
||||
}
|
||||
|
||||
Box {
|
||||
margin-bottom: 6;
|
||||
|
||||
Image {
|
||||
icon-name: "library-symbolic";
|
||||
margin-end: 12;
|
||||
icon-size: normal;
|
||||
}
|
||||
|
||||
Label {
|
||||
label: _("Browse the Library for demos and examples");
|
||||
}
|
||||
}
|
||||
|
||||
Box {
|
||||
margin-bottom: 6;
|
||||
|
||||
Image {
|
||||
icon-name: "user-bookmarks-symbolic";
|
||||
margin-end: 12;
|
||||
icon-size: normal;
|
||||
}
|
||||
|
||||
Label {
|
||||
label: _("Checkout the Bookmarks menu to learn and get help");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
2
src/pages/mod.rs
Normal file
2
src/pages/mod.rs
Normal file
|
@ -0,0 +1,2 @@
|
|||
pub mod welcome;
|
||||
pub use welcome::*;
|
111
src/pages/welcome.blp
Normal file
111
src/pages/welcome.blp
Normal file
|
@ -0,0 +1,111 @@
|
|||
using Gtk 4.0;
|
||||
using Adw 1;
|
||||
|
||||
template $ModManagerWelcome : Adw.NavigationPage {
|
||||
|
||||
|
||||
Label {
|
||||
label: _("Welcome to Mod Manager");
|
||||
margin-bottom: 30;
|
||||
|
||||
styles [
|
||||
"title-1"
|
||||
]
|
||||
}
|
||||
|
||||
Box subtitle {
|
||||
orientation: vertical;
|
||||
halign: center;
|
||||
margin-bottom: 30;
|
||||
|
||||
Label {
|
||||
label: "Learn and prototype with\nGNOME technologies";
|
||||
justify: center;
|
||||
}
|
||||
}
|
||||
|
||||
Box {
|
||||
orientation: vertical;
|
||||
homogeneous: true;
|
||||
halign: center;
|
||||
|
||||
Box {
|
||||
margin-bottom: 6;
|
||||
|
||||
Image {
|
||||
icon-name: "update-symbolic";
|
||||
margin-end: 12;
|
||||
icon-size: normal;
|
||||
}
|
||||
|
||||
Label {
|
||||
label: _("Edit Style or UI to update the Preview");
|
||||
}
|
||||
}
|
||||
|
||||
Box {
|
||||
margin-bottom: 6;
|
||||
|
||||
Image {
|
||||
icon-name: "media-playback-start-symbolic";
|
||||
margin-end: 12;
|
||||
icon-size: normal;
|
||||
}
|
||||
|
||||
Label {
|
||||
label: _("Hit");
|
||||
}
|
||||
|
||||
ShortcutsShortcut {
|
||||
accelerator: "<Control>Return";
|
||||
margin-start: 12;
|
||||
}
|
||||
|
||||
Label {
|
||||
label: _("to format and run Code");
|
||||
}
|
||||
}
|
||||
|
||||
Box {
|
||||
margin-bottom: 6;
|
||||
|
||||
Image {
|
||||
icon-name: "media-floppy-symbolic";
|
||||
margin-end: 12;
|
||||
icon-size: normal;
|
||||
}
|
||||
|
||||
Label {
|
||||
label: _("Changes are automatically saved and restored");
|
||||
}
|
||||
}
|
||||
|
||||
Box {
|
||||
margin-bottom: 6;
|
||||
|
||||
Image {
|
||||
icon-name: "library-symbolic";
|
||||
margin-end: 12;
|
||||
icon-size: normal;
|
||||
}
|
||||
|
||||
Label {
|
||||
label: _("Browse the Library for demos and examples");
|
||||
}
|
||||
}
|
||||
|
||||
Box {
|
||||
margin-bottom: 6;
|
||||
|
||||
Image {
|
||||
icon-name: "user-bookmarks-symbolic";
|
||||
margin-end: 12;
|
||||
icon-size: normal;
|
||||
}
|
||||
|
||||
Label {
|
||||
label: _("Checkout the Bookmarks menu to learn and get help");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
66
src/pages/welcome.rs
Normal file
66
src/pages/welcome.rs
Normal file
|
@ -0,0 +1,66 @@
|
|||
/* welcome.rs
|
||||
*
|
||||
* Copyright 2023 Tine
|
||||
*
|
||||
* 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 = "/dev/mnts/ModManager/pages/welcome.ui")]
|
||||
pub struct ModManagerWelcome {
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for ModManagerWelcome {
|
||||
const NAME: &'static str = "ModManagerWelcome";
|
||||
type Type = super::ModManagerWelcome;
|
||||
type ParentType = adw::NavigationPage;
|
||||
|
||||
fn class_init(klass: &mut Self::Class) {
|
||||
klass.bind_template();
|
||||
}
|
||||
|
||||
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
|
||||
obj.init_template();
|
||||
}
|
||||
}
|
||||
|
||||
impl ObjectImpl for ModManagerWelcome {}
|
||||
impl WidgetImpl for ModManagerWelcome {}
|
||||
impl NavigationPageImpl for ModManagerWelcome {}
|
||||
|
||||
}
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct ModManagerWelcome(ObjectSubclass<imp::ModManagerWelcome>)
|
||||
@extends gtk::Widget, gtk::Buildable, adw::NavigationPage,
|
||||
@implements gio::ActionGroup, gio::ActionMap;
|
||||
}
|
||||
|
||||
impl ModManagerWelcome {
|
||||
pub fn new() -> Self {
|
||||
glib::Object::builder()
|
||||
.build()
|
||||
}
|
||||
}
|
||||
|
57
src/window.blp
Normal file
57
src/window.blp
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
Copyright (c) 2023 Tine Jozelj
|
||||
|
||||
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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Gtk 4.0;
|
||||
using Adw 1;
|
||||
|
||||
template $ModManagerWindow : Adw.ApplicationWindow {
|
||||
default-width: 600;
|
||||
default-height: 300;
|
||||
|
||||
content: Adw.ToolbarView {
|
||||
[top]
|
||||
Adw.HeaderBar header_bar {
|
||||
[end]
|
||||
MenuButton {
|
||||
primary: true;
|
||||
icon-name: "open-menu-symbolic";
|
||||
tooltip-text: _("Menu");
|
||||
menu-model: primary_menu;
|
||||
}
|
||||
}
|
||||
content: Adw.NavigationView navigation_view {};
|
||||
};
|
||||
}
|
||||
|
||||
menu primary_menu {
|
||||
section {
|
||||
item {
|
||||
label: _("_Preferences");
|
||||
action: "app.preferences";
|
||||
}
|
||||
|
||||
item {
|
||||
label: _("_Keyboard Shortcuts");
|
||||
action: "win.show-help-overlay";
|
||||
}
|
||||
|
||||
item {
|
||||
label: _("_About Mod-manager");
|
||||
action: "app.about";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,21 +1,18 @@
|
|||
/* window.rs
|
||||
*
|
||||
* Copyright 2023 Tine
|
||||
*
|
||||
* 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
|
||||
/*
|
||||
Copyright (c) 2023 Tine Jozelj
|
||||
|
||||
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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use gtk::prelude::*;
|
||||
|
@ -32,7 +29,7 @@ mod imp {
|
|||
#[template_child]
|
||||
pub header_bar: TemplateChild<adw::HeaderBar>,
|
||||
#[template_child]
|
||||
pub label: TemplateChild<gtk::Label>,
|
||||
pub navigation_view: TemplateChild<adw::NavigationView>,
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
|
@ -59,7 +56,8 @@ mod imp {
|
|||
|
||||
glib::wrapper! {
|
||||
pub struct ModManagerWindow(ObjectSubclass<imp::ModManagerWindow>)
|
||||
@extends gtk::Widget, gtk::Window, gtk::ApplicationWindow, adw::ApplicationWindow, @implements gio::ActionGroup, gio::ActionMap;
|
||||
@extends gtk::Widget, gtk::Window, gtk::ApplicationWindow, adw::ApplicationWindow,
|
||||
@implements gio::ActionGroup, gio::ActionMap;
|
||||
}
|
||||
|
||||
impl ModManagerWindow {
|
||||
|
@ -68,4 +66,9 @@ impl ModManagerWindow {
|
|||
.property("application", application)
|
||||
.build()
|
||||
}
|
||||
|
||||
pub fn set_page(&self, page: &adw::NavigationPage) {
|
||||
imp::ModManagerWindow::from_obj(self)
|
||||
.navigation_view.push(page);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<requires lib="Adw" version="1.0"/>
|
||||
<template class="ModManagerWindow" parent="AdwApplicationWindow">
|
||||
<property name="default-width">600</property>
|
||||
<property name="default-height">300</property>
|
||||
<property name="content">
|
||||
<object class="AdwToolbarView">
|
||||
<child type="top">
|
||||
<object class="AdwHeaderBar" id="header_bar">
|
||||
<child type="end">
|
||||
<object class="GtkMenuButton">
|
||||
<property name="primary">True</property>
|
||||
<property name="icon-name">open-menu-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Menu</property>
|
||||
<property name="menu-model">primary_menu</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<property name="content">
|
||||
<object class="GtkLabel" id="label">
|
||||
<property name="label">Hello, World!</property>
|
||||
<style>
|
||||
<class name="title-1"/>
|
||||
</style>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
</template>
|
||||
<menu id="primary_menu">
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Preferences</attribute>
|
||||
<attribute name="action">app.preferences</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
|
||||
<attribute name="action">win.show-help-overlay</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_About Mod-manager</attribute>
|
||||
<attribute name="action">app.about</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
</interface>
|
Loading…
Reference in a new issue