Allow for parallel development instance

This adds a configuration option in meson, if set it changes the
application ID allowing for stable and development version to be
run at the same time.
This commit is contained in:
Jordan Petridis
2018-08-28 17:22:13 +03:00
parent 15457e1db4
commit 569c00ff5f
16 changed files with 121 additions and 44 deletions
+7 -2
View File
@@ -28,7 +28,8 @@ use std::sync::Arc;
use i18n::i18n;
pub(crate) const APP_ID: &str = "org.gnome.Podcasts";
pub(crate) const APP_ID: &str = env!("APP_ID");
pub(crate) const VERSION: &str = env!("VERSION");
/// Creates an action named `name` in the action map `T with the handler `F`
fn action<T, F>(thing: &T, name: &str, action: F)
@@ -82,12 +83,15 @@ pub(crate) struct App {
impl App {
pub(crate) fn new(application: &gtk::Application) -> Rc<Self> {
let settings = gio::Settings::new(APP_ID);
let settings = gio::Settings::new("org.gnome.Podcasts");
let (sender, receiver) = unbounded();
let window = gtk::ApplicationWindow::new(application);
window.set_title(&i18n("Podcasts"));
if APP_ID.ends_with("Devel") {
window.get_style_context().map(|c| c.add_class("devel"));
}
let weak_s = settings.downgrade();
let weak_app = application.downgrade();
@@ -380,6 +384,7 @@ impl App {
let application = gtk::Application::new(APP_ID, gio::ApplicationFlags::empty())
.expect("Application initialization failed...");
application.set_resource_base_path("/org/gnome/Podcasts");
let weak_app = application.downgrade();
application.connect_startup(move |_| {
+2 -4
View File
@@ -1,4 +1,4 @@
use app::APP_ID;
use app::{APP_ID, VERSION};
use gtk;
use gtk::prelude::*;
@@ -27,9 +27,7 @@ pub(crate) fn about_dialog(window: &gtk::ApplicationWindow) {
dialog.set_copyright("© 2017, 2018 Jordan Petridis");
dialog.set_license_type(gtk::License::Gpl30);
dialog.set_modal(true);
// TODO: make it show it fetches the commit hash from which it was built
// and the version number is kept in sync automatically
dialog.set_version("0.4.4");
dialog.set_version(VERSION);
dialog.set_program_name(&i18n("Podcasts"));
dialog.set_website("https://wiki.gnome.org/Apps/Podcasts");
dialog.set_website_label(i18n("Learn more about GNOME Podcasts").as_str());
+4 -1
View File
@@ -1,4 +1,5 @@
use gtk;
use app::APP_ID;
use gtk::{self, prelude::*};
use std::ops::Deref;
#[derive(Clone, Debug)]
@@ -15,6 +16,8 @@ impl Default for EmptyView {
fn default() -> Self {
let builder = gtk::Builder::new_from_resource("/org/gnome/Podcasts/gtk/empty_view.ui");
let view: gtk::Box = builder.get_object("empty_view").unwrap();
let image: gtk::Image = builder.get_object("image").unwrap();
image.set_from_icon_name(format!("{}-symbolic", APP_ID).as_str(), 256);
EmptyView(view)
}
}