[gnome-music/wip/jfelder/devel-version: 7/9] app: Generate stable and devel versions
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/devel-version: 7/9] app: Generate stable and devel versions
- Date: Tue, 24 Jul 2018 10:06:45 +0000 (UTC)
commit 09921f3a304f2a62504c37cf93dd902462713c84
Author: Jean Felder <jfelder src gnome org>
Date: Wed Jun 27 08:25:41 2018 +0200
app: Generate stable and devel versions
Add a profile option to the meson build. This allows the parallel
installation of multiple versions (Flatpak installations or system
installations).
Generate a different dbus id (stable or devel profile), so different
versions can be installed and ran alongside.
Update icons name, desktop and appdata files to take into account the
profile option.
data/AboutDialog.ui.in | 4 +-
data/meson.build | 44 +++++++++++++++++-----
...ta.xml.in => org.gnome.Music.appdata.xml.in.in} | 4 +-
...ic.desktop.in => org.gnome.Music.desktop.in.in} | 2 +-
gnome-music.in | 10 ++---
gnomemusic/application.py | 7 +++-
gnomemusic/window.py | 1 -
meson.build | 19 ++++++++--
meson_options.txt | 9 +++++
org.gnome.Music.json | 9 +++--
po/meson.build | 2 +-
11 files changed, 81 insertions(+), 30 deletions(-)
---
diff --git a/data/AboutDialog.ui.in b/data/AboutDialog.ui.in
index 4f23f5a4..19d520ef 100644
--- a/data/AboutDialog.ui.in
+++ b/data/AboutDialog.ui.in
@@ -4,7 +4,7 @@
<object class="GtkAboutDialog" id="about_dialog">
<property name="can_focus">False</property>
<property name="modal">True</property>
- <property name="program_name" translatable="yes">Music</property>
+ <property name="program_name">@PROGRAM_NAME@</property>
<property name="version">@PACKAGE_VERSION@</property>
<property name="copyright" translatable="yes">Copyright © 2018 GNOME Music Developers</property>
<property name="comments" translatable="yes">A music player and management application for
GNOME.</property>
@@ -142,7 +142,7 @@ Yosef Or Boczko
Yuras Shumovich
Yuri Myasoedov
</property>
- <property name="logo_icon_name">org.gnome.Music</property>
+ <property name="logo_icon_name">@APPID@</property>
<property name="wrap_license">True</property>
</object>
</interface>
diff --git a/data/meson.build b/data/meson.build
index bd8cfd29..c4f49e5b 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,7 +1,17 @@
# Compiling the resources
+VCS_TAG = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip()
+if VCS_TAG == ''
+ if get_option('profile') != 'default'
+ VCS_TAG = 'devel'
+ else
+ VCS_TAG = 'stable'
+ endif
+endif
about_dialog_conf = configuration_data()
-about_dialog_conf.set('PACKAGE_VERSION', meson.project_version())
+about_dialog_conf.set('PACKAGE_VERSION', '@0@-@1@'.format(meson.project_version(), VCS_TAG))
about_dialog_conf.set('PACKAGE_URL', PACKAGE_URL)
+about_dialog_conf.set('PROGRAM_NAME', 'Music' + NAME_SUFFIX)
+about_dialog_conf.set('APPID', APPLICATION_ID)
gnome.compile_resources(
PROJECT_RDNN_NAME,
@@ -24,11 +34,16 @@ install_data(
)
# Merging the translations with the desktop file
+desktop_conf = configuration_data()
+desktop_conf.set('icon', APPLICATION_ID)
i18n.merge_file(
- output: PROJECT_RDNN_NAME + '.desktop',
- input: PROJECT_RDNN_NAME + '.desktop.in',
- po_dir: join_paths(meson.source_root(), 'po'),
type: 'desktop',
+ input: configure_file(
+ output: PROJECT_RDNN_NAME + '.desktop.in',
+ input: PROJECT_RDNN_NAME + '.desktop.in.in',
+ configuration: desktop_conf),
+ output: APPLICATION_ID + '.desktop',
+ po_dir: join_paths(meson.source_root(), 'po'),
install: true,
install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'applications')
)
@@ -39,14 +54,21 @@ if desktop_file_validate.found()
test (
'Validate desktop file',
desktop_file_validate,
- args: join_paths(meson.current_build_dir (), PROJECT_RDNN_NAME + '.desktop')
+ args: join_paths(meson.current_build_dir (), APPLICATION_ID + '.desktop')
)
endif
# Merging the translations with the appdata file
+appdata_conf = configuration_data()
+appdata_conf.set('appid', APPLICATION_ID)
i18n.merge_file(
- output: PROJECT_RDNN_NAME + '.appdata.xml',
- input: PROJECT_RDNN_NAME + '.appdata.xml.in',
+ 'appdata',
+ input: configure_file(
+ output: PROJECT_RDNN_NAME + '.appdata.xml.in',
+ input: PROJECT_RDNN_NAME + '.appdata.xml.in.in',
+ configuration: appdata_conf
+ ),
+ output: APPLICATION_ID + '.appdata.xml',
po_dir: join_paths(meson.source_root(), 'po'),
install: true,
install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'metainfo')
@@ -58,7 +80,7 @@ if appstreamcli.found()
test (
'Validate appdata file',
appstreamcli,
- args: ['validate', join_paths(meson.current_build_dir (), PROJECT_RDNN_NAME + '.appdata.xml')]
+ args: ['validate', join_paths(meson.current_build_dir (), APPLICATION_ID + '.appdata.xml')]
)
endif
@@ -68,12 +90,14 @@ icon_sizes = ['16', '22', '32', '48', '256']
foreach i : icon_sizes
install_data(
join_paths('icons/hicolor', i + 'x' + i, 'apps', PROJECT_RDNN_NAME + '.png'),
- install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'icons', 'hicolor', i + 'x' + i,
'apps')
+ install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'icons', 'hicolor', i + 'x' + i,
'apps'),
+ rename: '@0@.png'.format(APPLICATION_ID)
)
endforeach
# Installing the symbolic icon
install_data(
join_paths('icons/hicolor/symbolic/apps', PROJECT_RDNN_NAME + '-symbolic.svg'),
- install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'icons/hicolor/symbolic/apps')
+ install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'icons/hicolor/symbolic/apps'),
+ rename: '@0 -symbolic svg'.format(APPLICATION_ID)
)
diff --git a/data/org.gnome.Music.appdata.xml.in b/data/org.gnome.Music.appdata.xml.in.in
similarity index 94%
rename from data/org.gnome.Music.appdata.xml.in
rename to data/org.gnome.Music.appdata.xml.in.in
index 4c79622e..2f11f853 100644
--- a/data/org.gnome.Music.appdata.xml.in
+++ b/data/org.gnome.Music.appdata.xml.in.in
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
- <id>org.gnome.Music.desktop</id>
+ <id>@appid@.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-2.0+ and LGPL-2.0+ and CC-BY-SA-4.0</project_license>
<name>GNOME Music</name>
@@ -38,5 +38,5 @@
</kudos>
<update_contact>mschraal gnome org</update_contact>
- <translation type="gettext">org.gnome.Music</translation>
+ <translation type="gettext">@appid@</translation>
</component>
diff --git a/data/org.gnome.Music.desktop.in b/data/org.gnome.Music.desktop.in.in
similarity index 95%
rename from data/org.gnome.Music.desktop.in
rename to data/org.gnome.Music.desktop.in.in
index 7dfc4e78..62dfd398 100644
--- a/data/org.gnome.Music.desktop.in
+++ b/data/org.gnome.Music.desktop.in.in
@@ -3,7 +3,7 @@ Name=Music
GenericName=Music Player
Comment=Play and organize your music collection
# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
-Icon=org.gnome.Music
+Icon=@icon@
Exec=gnome-music
Terminal=false
Type=Application
diff --git a/gnome-music.in b/gnome-music.in
index 04e7ee51..13f8aeb1 100755
--- a/gnome-music.in
+++ b/gnome-music.in
@@ -105,10 +105,10 @@ def set_log_level():
def set_internationalization():
"""Sets application internationalization."""
- locale.bindtextdomain('@rdnn_name@', LOCALE_DIR)
- locale.textdomain('@rdnn_name@')
- gettext.bindtextdomain('@rdnn_name@', LOCALE_DIR)
- gettext.textdomain('@rdnn_name@')
+ locale.bindtextdomain('@application_id@', LOCALE_DIR)
+ locale.textdomain('@application_id@')
+ gettext.bindtextdomain('@application_id@', LOCALE_DIR)
+ gettext.textdomain('@application_id@')
def set_resources():
@@ -122,7 +122,7 @@ def run_application():
"""Runs GNOME Music application and returns its exit code."""
from gnomemusic.application import Application
- app = Application()
+ app = Application('@application_id@')
signal.signal(signal.SIGINT, signal.SIG_DFL)
return app.run(sys.argv)
diff --git a/gnomemusic/application.py b/gnomemusic/application.py
index bfcfb59b..707ce1b4 100644
--- a/gnomemusic/application.py
+++ b/gnomemusic/application.py
@@ -46,17 +46,19 @@ class Application(Gtk.Application):
return '<Application>'
@log
- def __init__(self):
+ def __init__(self, application_id):
super().__init__(
- application_id='org.gnome.Music',
+ application_id=application_id,
flags=Gio.ApplicationFlags.FLAGS_NONE)
+ self.props.resource_base_path = "/org/gnome/Music"
GLib.set_application_name(_("Music"))
GLib.set_prgname('gnome-music')
GLib.setenv("PULSE_PROP_media.role", "music", True)
self._settings = Gio.Settings.new('org.gnome.Music')
self._init_style()
self._window = None
+ self._application_id = application_id
def _init_style(self):
css_provider_file = Gio.File.new_for_uri(
@@ -110,6 +112,7 @@ class Application(Gtk.Application):
def do_activate(self):
if not self._window:
self._window = Window(self)
+ self._window.set_default_icon_name(self._application_id)
MediaPlayer2Service(self)
self._window.present()
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index 58421e58..270f0593 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -75,7 +75,6 @@ class Window(Gtk.ApplicationWindow):
self.add_action(select_none)
self.set_size_request(200, 100)
- self.set_default_icon_name('org.gnome.Music')
self.prev_view = None
self.curr_view = None
diff --git a/meson.build b/meson.build
index 7c31b091..7883168a 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,6 @@
project('gnome-music',
- version: '3.29.2.1'
+ version: '3.29.2.1',
+ meson_version: '>= 0.46.0'
)
# Importing modules
@@ -17,9 +18,19 @@ PACKAGE_URL = 'https://wiki.gnome.org/Apps/Music'
PACKAGE_URL_BUG = 'https://gitlab.gnome.org/GNOME/gnome-music'
PROJECT_RDNN_NAME = 'org.gnome.Music'
+# NAME_SUFFIX is used in the about dialog
+if get_option('profile') == 'development'
+ PROFILE = 'Devel'
+ NAME_SUFFIX = ' (Development Snapshot)'
+else
+ PROFILE = ''
+ NAME_SUFFIX = ''
+endif
+
+APPLICATION_ID = 'org.gnome.Music@0@'.format(PROFILE)
PYTHON_DIR = join_paths(get_option('prefix'), python.sysconfig_path('purelib'))
-PKGDATA_DIR = join_paths(get_option('prefix'), get_option('datadir'), PROJECT_RDNN_NAME)
-PKGLIB_DIR = join_paths(get_option('prefix'), get_option('libdir'), PROJECT_RDNN_NAME)
+PKGDATA_DIR = join_paths(get_option('prefix'), get_option('datadir'), APPLICATION_ID)
+PKGLIB_DIR = join_paths(get_option('prefix'), get_option('libdir'), APPLICATION_ID)
# Dependencies
dependency('gobject-introspection-1.0', version: '>= 1.35.0')
@@ -53,6 +64,7 @@ install_subdir(
# Install the executable file
bin_config = configuration_data()
+bin_config.set('application_id', APPLICATION_ID)
bin_config.set('rdnn_name', PROJECT_RDNN_NAME)
bin_config.set('pkgdatadir', PKGDATA_DIR)
bin_config.set('localedir', join_paths(get_option('prefix'), get_option('datadir'), 'locale'))
@@ -73,6 +85,7 @@ configure_file(
# Install the builddir executable
local_config = configuration_data()
+local_config.set('application_id', APPLICATION_ID)
local_config.set('rdnn_name', PROJECT_RDNN_NAME)
local_config.set('pkgdatadir', join_paths(meson.build_root(), 'data'))
local_config.set('localedir', join_paths(get_option('prefix'), get_option('datadir'), 'locale'))
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 00000000..a9e396dd
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,9 @@
+option(
+ 'profile',
+ type: 'combo',
+ choices: [
+ 'default',
+ 'development'
+ ],
+ value: 'default'
+)
diff --git a/org.gnome.Music.json b/org.gnome.Music.json
index b9da238d..d3578168 100644
--- a/org.gnome.Music.json
+++ b/org.gnome.Music.json
@@ -1,11 +1,11 @@
{
- "app-id": "org.gnome.Music",
+ "app-id": "org.gnome.MusicDevel",
"runtime": "org.gnome.Platform",
"runtime-version": "master",
"sdk": "org.gnome.Sdk",
"command": "gnome-music",
- "tags": ["nightly"],
- "desktop-file-name-prefix": "(Nightly) ",
+ "tags": ["devel", "development", "nightly"],
+ "desktop-file-name-prefix": "(Development) ",
"finish-args": [
"--share=ipc", "--socket=x11",
"--share=network",
@@ -117,6 +117,9 @@
},
{
"name": "gnome-music",
+ "config-opts" : [
+ "-Dprofile=development"
+ ],
"buildsystem": "meson",
"sources": [
{
diff --git a/po/meson.build b/po/meson.build
index 0fe4c170..da86d012 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -1 +1 @@
-i18n.gettext(PROJECT_RDNN_NAME, preset:'glib')
\ No newline at end of file
+i18n.gettext(APPLICATION_ID, preset:'glib')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]