From 2a8e1c75863bc84c55eadcff1f3adb42d409d180 Mon Sep 17 00:00:00 2001 From: Ricky Kresslein Date: Sun, 20 Feb 2022 19:19:45 +0100 Subject: - Distinctive development mode --- Cargo.lock | 2 +- Cargo.toml | 3 +- .../flatpak/com.lakoliu.Furtherance.Devel.json | 58 ++++++++++++++++++++++ .../apps/com.lakoliu.Furtherance.Devel.svg | 58 ++++++++++++++++++++++ data/icons/meson.build | 8 +-- meson.build | 6 +++ meson_options.txt | 11 ++++ src/config.rs.in | 1 + src/main.rs | 4 +- src/meson.build | 5 +- src/settings_manager.rs | 2 +- src/ui/history_box.rs | 8 +++ src/ui/window.rs | 6 ++- 13 files changed, 159 insertions(+), 13 deletions(-) create mode 100644 build-aux/flatpak/com.lakoliu.Furtherance.Devel.json create mode 100644 data/icons/hicolor/scalable/apps/com.lakoliu.Furtherance.Devel.svg create mode 100644 meson_options.txt diff --git a/Cargo.lock b/Cargo.lock index c977cd5..4740756 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -205,7 +205,7 @@ dependencies = [ [[package]] name = "furtherance" -version = "0.1.0" +version = "1.0.0" dependencies = [ "chrono", "dbus", diff --git a/Cargo.toml b/Cargo.toml index 0283d90..09fa4d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "furtherance" -version = "0.1.0" +version = "1.0.0" +authors = ["Ricky Kresslein "] edition = "2018" [dependencies] diff --git a/build-aux/flatpak/com.lakoliu.Furtherance.Devel.json b/build-aux/flatpak/com.lakoliu.Furtherance.Devel.json new file mode 100644 index 0000000..4f2d826 --- /dev/null +++ b/build-aux/flatpak/com.lakoliu.Furtherance.Devel.json @@ -0,0 +1,58 @@ +{ + "app-id" : "com.lakoliu.Furtherance.Devel", + "runtime" : "org.gnome.Platform", + "runtime-version" : "master", + "sdk" : "org.gnome.Sdk", + "sdk-extensions" : [ + "org.freedesktop.Sdk.Extension.rust-stable" + ], + "command" : "furtherance", + "tags" : [ + "nightly" + ], + "finish-args" : [ + "--share=network", + "--share=ipc", + "--socket=fallback-x11", + "--device=dri", + "--socket=wayland", + "--socket=session-bus" + ], + "build-options" : { + "append-path" : "/usr/lib/sdk/rust-stable/bin", + "build-args" : [ + "--share=network" + ], + "env" : { + "RUST_BACKTRACE" : "1", + "RUST_LOG" : "furtherance=debug" + } + }, + "cleanup" : [ + "/include", + "/lib/pkgconfig", + "/man", + "/share/doc", + "/share/gtk-doc", + "/share/man", + "/share/pkgconfig", + "*.la", + "*.a" + ], + "modules" : [ + { + "name" : "furtherance", + "builddir" : true, + "buildsystem" : "meson", + "config-opts" : [ + "-Dprofile=development" + ], + "sources" : [ + { + "type" : "git", + "url" : "file:///home/ricky/Documents/SoftwareDev/Rust/furtherance" + } + ] + } + ] +} diff --git a/data/icons/hicolor/scalable/apps/com.lakoliu.Furtherance.Devel.svg b/data/icons/hicolor/scalable/apps/com.lakoliu.Furtherance.Devel.svg new file mode 100644 index 0000000..fea4fe3 --- /dev/null +++ b/data/icons/hicolor/scalable/apps/com.lakoliu.Furtherance.Devel.svg @@ -0,0 +1,58 @@ + + + + + + + + + + + + + diff --git a/data/icons/meson.build b/data/icons/meson.build index 7ffa296..43c5da6 100644 --- a/data/icons/meson.build +++ b/data/icons/meson.build @@ -1,13 +1,13 @@ -application_id = 'com.lakoliu.Furtherance' - scalable_dir = join_paths('hicolor', 'scalable', 'apps') install_data( - join_paths(scalable_dir, ('@0@.svg').format(application_id)), + join_paths(scalable_dir, ('@0@.svg').format(app_id)), install_dir: join_paths(get_option('datadir'), 'icons', scalable_dir) ) + + symbolic_dir = join_paths('hicolor', 'symbolic', 'apps') install_data( - join_paths(symbolic_dir, ('@0@-symbolic.svg').format(application_id)), + join_paths(symbolic_dir, 'com.lakoliu.Furtherance-symbolic.svg'), install_dir: join_paths(get_option('datadir'), 'icons', symbolic_dir) ) diff --git a/meson.build b/meson.build index 3d0b4df..c9b3580 100644 --- a/meson.build +++ b/meson.build @@ -16,6 +16,12 @@ dependency('libadwaita-1', version: '>=1.0.0') name = 'Furtherance' app_id = 'com.lakoliu.Furtherance' +profile = get_option('profile') + +# Change app id during development +if profile == 'development' + app_id = '@0@.Devel'.format(app_id) +endif i18n = import('i18n') diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..97c7b70 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,11 @@ +option ( + 'profile', + type: 'combo', + choices: [ + 'default', + 'beta', + 'development' + ], + value: 'default' +) + diff --git a/src/config.rs.in b/src/config.rs.in index 4005031..6429916 100644 --- a/src/config.rs.in +++ b/src/config.rs.in @@ -19,3 +19,4 @@ pub static GETTEXT_PACKAGE: &str = @GETTEXT_PACKAGE@; pub static LOCALEDIR: &str = @LOCALEDIR@; pub static PKGDATADIR: &str = @PKGDATADIR@; pub static APP_ID: &str = @APP_ID@; +pub static PROFILE: &str = @PROFILE@; diff --git a/src/main.rs b/src/main.rs index a4959c0..d9b299e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,7 +22,7 @@ mod settings_manager; use self::application::FurtheranceApplication; -use config::{GETTEXT_PACKAGE, LOCALEDIR, PKGDATADIR}; +use config::{GETTEXT_PACKAGE, LOCALEDIR, PKGDATADIR, APP_ID}; use gettextrs::{bind_textdomain_codeset, bindtextdomain, textdomain}; use gtk::{gio, glib}; use gtk::prelude::*; @@ -47,7 +47,7 @@ fn main() { // 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 = FurtheranceApplication::new("com.lakoliu.Furtherance", &gio::ApplicationFlags::empty()); + let app = FurtheranceApplication::new(APP_ID, &gio::ApplicationFlags::empty()); glib::set_application_name("Furtherance"); diff --git a/src/meson.build b/src/meson.build index 66df479..c689689 100644 --- a/src/meson.build +++ b/src/meson.build @@ -14,6 +14,7 @@ conf.set_quoted('GETTEXT_PACKAGE', 'furtherance') conf.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir'))) conf.set_quoted('PKGDATADIR', pkgdatadir) conf.set_quoted('APP_ID', app_id) +conf.set_quoted('PROFILE', profile) configure_file( input: 'config.rs.in', @@ -39,13 +40,11 @@ rust_sources = files( 'ui/history_box.rs', 'ui/window.rs', - 'settings_manager.rs', - 'application.rs', 'config.rs', 'main.rs', - 'database.rs', + 'settings_manager.rs', ) sources = [cargo_sources, rust_sources] diff --git a/src/settings_manager.rs b/src/settings_manager.rs index 0343cdc..66c1092 100644 --- a/src/settings_manager.rs +++ b/src/settings_manager.rs @@ -18,7 +18,7 @@ use gtk::{gio, gio::prelude::*, glib}; use crate::config; pub fn get_settings() -> gio::Settings { - let app_id = config::APP_ID; + let app_id = config::APP_ID.trim_end_matches(".Devel"); gio::Settings::new(app_id) } diff --git a/src/ui/history_box.rs b/src/ui/history_box.rs index 4de6dce..459c751 100644 --- a/src/ui/history_box.rs +++ b/src/ui/history_box.rs @@ -22,6 +22,7 @@ use glib::subclass; use crate::ui::FurTasksPage; use crate::FurtheranceApplication; use crate::database; +use crate::config; enum View { Loading, @@ -92,6 +93,13 @@ impl FurHistoryBox { } else { self.set_view(View::Empty); } + + // Change "empty" page icon for development mode + let imp = imp::FurHistoryBox::from_instance(self); + if config::PROFILE == "development" { + imp.welcome_page.set_icon_name(Some("com.lakoliu.Furtherance.Devel")); + } + } fn set_view(&self, view: View) { diff --git a/src/ui/window.rs b/src/ui/window.rs index 3106306..92c8282 100644 --- a/src/ui/window.rs +++ b/src/ui/window.rs @@ -31,6 +31,7 @@ use crate::ui::FurHistoryBox; use crate::FurtheranceApplication; use crate::database; use crate::settings_manager; +use crate::config; mod imp { use super::*; @@ -155,7 +156,10 @@ impl FurtheranceWindow { let stop_time = Rc::new(RefCell::new(Local::now())); // Development mode - // self.add_css_class("devel"); + if config::PROFILE == "development" { + self.add_css_class("devel"); + } + imp.start_button.connect_clicked(clone!( @weak self as this, -- cgit 1.4.1