From a6dca9434dda9d3e7bf1671628e6cd34b2149fea Mon Sep 17 00:00:00 2001 From: Tine Jozelj Date: Wed, 20 Dec 2023 22:50:13 +0100 Subject: [PATCH] chore: debuging settings --- data/dev.mnts.ModManager.gschema.xml | 5 ---- data/dev.mnts.ModManager.gschema.xml.in | 9 ++++++ data/dev.mnts.ModManager.metainfo.xml.in | 2 +- data/icons/meson.build | 2 -- data/meson.build | 15 ++++++++-- dev.mnts.ModManager.json | 2 +- meson.build | 1 - src/application.rs | 9 +++--- src/dev.mnts.ModManager.gschema.xml.in | 9 ------ src/main.rs | 36 ++++++++++++------------ src/meson.build | 18 ++---------- src/settings.rs | 12 ++++---- 12 files changed, 54 insertions(+), 66 deletions(-) delete mode 100644 data/dev.mnts.ModManager.gschema.xml create mode 100644 data/dev.mnts.ModManager.gschema.xml.in delete mode 100644 src/dev.mnts.ModManager.gschema.xml.in diff --git a/data/dev.mnts.ModManager.gschema.xml b/data/dev.mnts.ModManager.gschema.xml deleted file mode 100644 index 8f5fde7..0000000 --- a/data/dev.mnts.ModManager.gschema.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/data/dev.mnts.ModManager.gschema.xml.in b/data/dev.mnts.ModManager.gschema.xml.in new file mode 100644 index 0000000..a80203b --- /dev/null +++ b/data/dev.mnts.ModManager.gschema.xml.in @@ -0,0 +1,9 @@ + + + + + {} + Dictionary of games being managed. First string is game name second is path to mods folder. + + + diff --git a/data/dev.mnts.ModManager.metainfo.xml.in b/data/dev.mnts.ModManager.metainfo.xml.in index a3e141e..12e17a3 100644 --- a/data/dev.mnts.ModManager.metainfo.xml.in +++ b/data/dev.mnts.ModManager.metainfo.xml.in @@ -1,6 +1,6 @@ - dev.mnts.ModManager.desktop + @APP_ID@ CC0-1.0 GPL-3.0-or-later diff --git a/data/icons/meson.build b/data/icons/meson.build index fdd4318..9b5e4f1 100644 --- a/data/icons/meson.build +++ b/data/icons/meson.build @@ -1,5 +1,3 @@ -application_id = 'dev.mnts.ModManager' - scalable_dir = 'hicolor' / 'scalable' / 'apps' install_data( scalable_dir / ('@0@.svg').format(application_id), diff --git a/data/meson.build b/data/meson.build index 545b64d..488d00b 100644 --- a/data/meson.build +++ b/data/meson.build @@ -1,5 +1,9 @@ +configuration = configuration_data() +configuration.set('APP_ID', application_id) +configuration.set('GETTEXT_PACKAGE', gettext_package) + desktop_file = i18n.merge_file( - input: 'dev.mnts.ModManager.desktop.in', + input: configure_file(input: 'dev.mnts.ModManager.metainfo.xml.in', output: '@BASENAME@.in', configuration: configuration), output: 'dev.mnts.ModManager.desktop', type: 'desktop', po_dir: '../po', @@ -13,7 +17,7 @@ if desktop_utils.found() endif appstream_file = i18n.merge_file( - input: 'dev.mnts.ModManager.metainfo.xml.in', + input: configure_file(input: 'dev.mnts.ModManager.metainfo.xml.in', output: '@BASENAME@.in', configuration: configuration), output: 'dev.mnts.ModManager.metainfo.xml', po_dir: '../po', install: true, @@ -24,7 +28,12 @@ appstreamcli = find_program('appstreamcli', required: false, disabler: true) test('Validate appstream file', appstreamcli, args: ['validate', '--no-net', '--explain', appstream_file]) -install_data('dev.mnts.ModManager.gschema.xml', + +gschema = configure_file( + input: '@0@.gschema.xml.in'.format(base_id), + output: '@0@.gschema.xml'.format(application_id), + configuration: configuration, + install: true, install_dir: get_option('datadir') / 'glib-2.0' / 'schemas' ) diff --git a/dev.mnts.ModManager.json b/dev.mnts.ModManager.json index 6f4943b..9756ddc 100644 --- a/dev.mnts.ModManager.json +++ b/dev.mnts.ModManager.json @@ -51,7 +51,7 @@ "sources": [ { "type": "git", - "url": "file:///home/tine/projects" + "url": "." } ] } diff --git a/meson.build b/meson.build index f9ddc38..9017219 100644 --- a/meson.build +++ b/meson.build @@ -7,7 +7,6 @@ project('mod-manager', 'rust', i18n = import('i18n') gnome = import('gnome') - base_id = 'dev.mnts.ModManager' gettext_package = meson.project_name() diff --git a/src/application.rs b/src/application.rs index 94b8d87..cf3153a 100644 --- a/src/application.rs +++ b/src/application.rs @@ -22,11 +22,11 @@ use adw::subclass::prelude::*; use gtk::prelude::*; use gtk::{gio, glib}; +use crate::config::APP_ID; use crate::config::VERSION; -use crate::config::APP_ID; -use crate::windows::main::Welcome; -use crate::windows::main::ModManagerWindowMain; use crate::settings::ModManagerSettings; +use crate::windows::main::ModManagerWindowMain; +use crate::windows::main::Welcome; mod imp { @@ -89,7 +89,7 @@ glib::wrapper! { } impl ModManagerApplication { - pub fn new( flags: &gio::ApplicationFlags) -> Self { + pub fn new(flags: &gio::ApplicationFlags) -> Self { glib::Object::builder() .property("application-id", APP_ID) .property("flags", flags) @@ -121,4 +121,3 @@ impl ModManagerApplication { about.present(); } } - diff --git a/src/dev.mnts.ModManager.gschema.xml.in b/src/dev.mnts.ModManager.gschema.xml.in deleted file mode 100644 index 9c4e250..0000000 --- a/src/dev.mnts.ModManager.gschema.xml.in +++ /dev/null @@ -1,9 +0,0 @@ - - - - - {} - Dictionary of games being managed. First string is game name second is path to mods folder. - - - \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 87c08d4..14301bc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,33 +1,33 @@ /* - Copyright (c) 2023 Tine Jozelj +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 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. +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 . - */ +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ -mod application; -mod config; -mod windows; -mod components; mod api; +mod application; +mod components; +mod config; mod settings; +mod windows; use self::application::ModManagerApplication; use config::{GETTEXT_PACKAGE, LOCALEDIR, PKGDATADIR}; use gettextrs::{bind_textdomain_codeset, bindtextdomain, textdomain}; -use gtk::{gio, glib}; use gtk::prelude::*; +use gtk::{gio, glib}; fn main() -> glib::ExitCode { // Set up gettext translations @@ -44,7 +44,7 @@ fn main() -> glib::ExitCode { // Create a new GtkApplication. The application manages our main loop, // application windows, integration with the window manager/compositor, and // desktop features such as file opening and single-instance applications. - let app = ModManagerApplication::new( &gio::ApplicationFlags::empty()); + let app = ModManagerApplication::new(&gio::ApplicationFlags::empty()); // Run the application. This function will block until the application // exits. Upon return, we have our exit code to return to the shell. (This diff --git a/src/meson.build b/src/meson.build index 34d7c14..4e66df6 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,7 +1,7 @@ -datadir = get_option('prefix') / get_option('datadir') -pkgdatadir = datadir / meson.project_name() +pkgdatadir = get_option('prefix') / get_option('datadir') / meson.project_name() gnome = import('gnome') +# GResources blueprints = custom_target('blueprints', input: files( 'windows/main/main.blp', @@ -13,7 +13,6 @@ blueprints = custom_target('blueprints', output: '.', command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'], ) - gnome.compile_resources('mod-manager', 'mod-manager.gresource.xml', dependencies: blueprints, @@ -22,19 +21,6 @@ gnome.compile_resources('mod-manager', install_dir: pkgdatadir, ) -# GSchema -gschema_conf = configuration_data() -gschema_conf.set('APP_ID', application_id) -gschema_conf.set('GETTEXT_PACKAGE', gettext_package) -gschema = configure_file( - input: '@0@.gschema.xml.in'.format(base_id), - output: '@0@.gschema.xml'.format(application_id), - configuration: gschema_conf, - install: true, - install_dir: pkgdatadir / 'glib-2.0' / 'schemas' -) -gnome.compile_schemas(depend_files: gschema) - # Configuration conf = configuration_data() conf.set_quoted('APP_ID', application_id) diff --git a/src/settings.rs b/src/settings.rs index 3a5808b..9a23c3c 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -1,18 +1,20 @@ +use gio::glib; use gsettings_macro::gen_settings; use gtk::gio; -use gio::glib; use std::collections::HashMap; use crate::config::APP_ID; -#[gen_settings( - file = "./src/dev.mnts.ModManager.gschema.xml.in", +#[gen_settings(file = "./data/dev.mnts.ModManager.gschema.xml.in")] +#[gen_settings_define( + key_name = "games", + arg_type = "HashMap", + ret_type = "HashMap" )] -#[gen_settings_define(key_name = "games", arg_type = "HashMap", ret_type = "HashMap")] pub struct ModManagerSettings; impl Default for ModManagerSettings { fn default() -> Self { Self::new(APP_ID) } -} \ No newline at end of file +}