[gnome-games] build: Allow parallel installation of development builds



commit ba2344dc536a6ab54d0acc33b4547c4d79b4c7e9
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Sun Jul 15 20:42:32 2018 +0500

    build: Allow parallel installation of development builds
    
    Adds '-Dprofile=development' build option that changes application id to
    'org.gnome.GamesDevel' and name to 'GNOME Games (Development)'.

 data/icons/meson.build                               |  9 ++++++---
 data/meson.build                                     | 20 ++++++++++++++++----
 ...data.xml.in => org.gnome.Games.appdata.xml.in.in} |  2 +-
 ...ames.desktop.in => org.gnome.Games.desktop.in.in} |  2 +-
 data/ui/empty-collection.ui                          |  1 -
 meson.build                                          | 13 +++++++++++++
 meson_options.txt                                    | 10 ++++++++++
 src/config.vapi                                      |  3 +++
 src/ui/application.vala                              | 10 +++++-----
 src/ui/empty-collection.vala                         |  7 +++++++
 10 files changed, 62 insertions(+), 15 deletions(-)
---
diff --git a/data/icons/meson.build b/data/icons/meson.build
index 09953d6..95f7ee4 100644
--- a/data/icons/meson.build
+++ b/data/icons/meson.build
@@ -6,12 +6,14 @@ foreach icon_size: icon_sizes
 
   install_data(
     join_paths(hicolor_dir, 'org.gnome.Games.png'),
-    install_dir: join_paths(datadir, 'icons', hicolor_dir)
+    install_dir: join_paths(datadir, 'icons', hicolor_dir),
+    rename: '@0@.png'.format(application_id)
   )
 
   install_data(
     join_paths(highcontrast_dir, 'org.gnome.Games.png'),
-    install_dir: join_paths(datadir, 'icons', highcontrast_dir)
+    install_dir: join_paths(datadir, 'icons', highcontrast_dir),
+    rename: '@0@.png'.format(application_id)
   )
 endforeach
 
@@ -19,5 +21,6 @@ hicolor_dir = join_paths('hicolor', 'scalable', 'apps')
 
 install_data(
   join_paths(hicolor_dir, 'org.gnome.Games-symbolic.svg'),
-  install_dir: join_paths(datadir, 'icons', hicolor_dir)
+  install_dir: join_paths(datadir, 'icons', hicolor_dir),
+  rename: '@0 -symbolic svg'.format(application_id)
 )
diff --git a/data/meson.build b/data/meson.build
index 2e4716a..0e7e5d8 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -4,18 +4,30 @@ resources = gnome.compile_resources(
   c_name: 'resources'
 )
 
+desktop_conf = configuration_data()
+desktop_conf.set('icon', application_id)
 i18n.merge_file ('desktop-file',
   type: 'desktop',
-  input: 'org.gnome.Games.desktop.in',
-  output: 'org.gnome.Games.desktop',
+  input: configure_file(
+    input: files('org.gnome.Games.desktop.in.in'),
+    output: 'org.gnome.Games.desktop.in',
+    configuration: desktop_conf
+  ),
+  output: '@0@.desktop'.format(application_id),
   po_dir: podir,
   install: true,
   install_dir: join_paths (datadir, 'applications')
 )
 
+appdata_conf = configuration_data()
+appdata_conf.set('appid', application_id)
 i18n.merge_file ('appdata-file',
-  input: 'org.gnome.Games.appdata.xml.in',
-  output: 'org.gnome.Games.appdata.xml',
+  input: configure_file(
+    input: files('org.gnome.Games.appdata.xml.in.in'),
+    output: 'org.gnome.Games.appdata.xml.in',
+    configuration: appdata_conf
+  ),
+  output: '@0  appdata xml'.format(application_id),
   po_dir: podir,
   install: true,
   install_dir: join_paths (datadir, 'metainfo')
diff --git a/data/org.gnome.Games.appdata.xml.in b/data/org.gnome.Games.appdata.xml.in.in
similarity index 99%
rename from data/org.gnome.Games.appdata.xml.in
rename to data/org.gnome.Games.appdata.xml.in.in
index db7bb62..cd16ece 100644
--- a/data/org.gnome.Games.appdata.xml.in
+++ b/data/org.gnome.Games.appdata.xml.in.in
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <component type="desktop-application">
-  <id>org.gnome.Games.desktop</id>
+  <id>@appid@.desktop</id>
   <metadata_license>CC0-1.0</metadata_license>
   <project_license>GPL-3.0+</project_license>
   <name>Games</name>
diff --git a/data/org.gnome.Games.desktop.in b/data/org.gnome.Games.desktop.in.in
similarity index 98%
rename from data/org.gnome.Games.desktop.in
rename to data/org.gnome.Games.desktop.in.in
index eb444c1..51633c2 100644
--- a/data/org.gnome.Games.desktop.in
+++ b/data/org.gnome.Games.desktop.in.in
@@ -6,7 +6,7 @@ Comment=View and play your video games collection
 Keywords=game;videogame;video game;player;
 Exec=gnome-games %U
 # Translators: Do NOT translate or transliterate this text (this is an icon file name)!
-Icon=org.gnome.Games
+Icon=@icon@
 Terminal=false
 Type=Application
 StartupNotify=true
diff --git a/data/ui/empty-collection.ui b/data/ui/empty-collection.ui
index 3e27b98..b9461c9 100644
--- a/data/ui/empty-collection.ui
+++ b/data/ui/empty-collection.ui
@@ -13,7 +13,6 @@
         <property name="can_focus">False</property>
         <property name="valign">center</property>
         <property name="pixel_size">128</property>
-        <property name="icon_name">org.gnome.Games-symbolic</property>
         <property name="icon-size">0</property>
         <property name="margin-bottom">18</property>
         <style>
diff --git a/meson.build b/meson.build
index 32ef147..bc20f9e 100644
--- a/meson.build
+++ b/meson.build
@@ -5,6 +5,16 @@ project('gnome-games',
   meson_version: '>= 0.46.1'
 )
 
+if get_option('profile') == 'development'
+  profile = 'Devel'
+  name_suffix = ' (Development)'
+else
+  profile = ''
+  name_suffix = ''
+endif
+
+application_id = 'org.gnome.Games@0@'.format(profile)
+
 gnome = import ('gnome')
 i18n = import('i18n')
 
@@ -38,10 +48,13 @@ options_dir = join_paths (datadir, meson.project_name(), 'options')
 plugins_dir = join_paths (libdir, meson.project_name(), 'plugins')
 
 config_h = configuration_data ()
+config_h.set_quoted ('APPLICATION_ID', application_id)
 config_h.set_quoted ('GETTEXT_PACKAGE', meson.project_name ())
 config_h.set_quoted ('GNOMELOCALEDIR', localedir)
+config_h.set_quoted ('NAME_SUFFIX', name_suffix)
 config_h.set_quoted ('OPTIONS_DIR', options_dir)
 config_h.set_quoted ('PLUGINS_DIR', plugins_dir)
+config_h.set_quoted ('PROFILE', profile)
 config_h.set_quoted ('VERSION', meson.project_version ())
 
 configure_file (output: 'config.h', configuration: config_h)
diff --git a/meson_options.txt b/meson_options.txt
index f70dc61..900ae21 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1,13 @@
+option (
+  'profile',
+  type: 'combo',
+  choices: [
+    'default',
+    'development'
+  ],
+  value: 'default'
+)
+
 # Plugins
 # This must mirror the list in plugins/meson.build
 option ('desktop-plugin',       description: 'Support for desktop games',       type: 'boolean')
diff --git a/src/config.vapi b/src/config.vapi
index 275a7b3..cd8142d 100644
--- a/src/config.vapi
+++ b/src/config.vapi
@@ -1,8 +1,11 @@
 [CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")]
 namespace Config {
+       public const string APPLICATION_ID;
        public const string GETTEXT_PACKAGE;
        public const string GNOMELOCALEDIR;
+       public const string NAME_SUFFIX;
        public const string OPTIONS_DIR;
        public const string PLUGINS_DIR;
+       public const string PROFILE;
        public const string VERSION;
 }
diff --git a/src/ui/application.vala b/src/ui/application.vala
index 3887d95..b67b2bc 100644
--- a/src/ui/application.vala
+++ b/src/ui/application.vala
@@ -13,16 +13,16 @@ public class Games.Application : Gtk.Application {
        private GameCollection game_collection;
 
        internal Application () {
-               Object (application_id: "org.gnome.Games",
+               Object (application_id: Config.APPLICATION_ID,
                        flags: ApplicationFlags.HANDLES_OPEN);
        }
 
        construct {
                Environment.set_prgname ("gnome-games");
                Environment.set_application_name (_("Games"));
-               Gtk.Window.set_default_icon_name ("org.gnome.Games");
+               Gtk.Window.set_default_icon_name (Config.APPLICATION_ID);
                Environment.set_variable ("PULSE_PROP_media.role", "game", true);
-               Environment.set_variable ("PULSE_PROP_application.icon_name", "org.gnome.Games", true);
+               Environment.set_variable ("PULSE_PROP_application.icon_name", Config.APPLICATION_ID, true);
 
                add_actions ();
                add_signal_handlers ();
@@ -351,8 +351,8 @@ public class Games.Application : Gtk.Application {
                dialog.set_transient_for (window);
                dialog.set_modal (true);
 
-               dialog.program_name = _("GNOME Games");
-               dialog.logo_icon_name = "org.gnome.Games";
+               dialog.program_name = _("GNOME Games") + Config.NAME_SUFFIX;
+               dialog.logo_icon_name = Config.APPLICATION_ID;
                dialog.comments = _("A video game player for GNOME");
                dialog.version = Config.VERSION;
 
diff --git a/src/ui/empty-collection.vala b/src/ui/empty-collection.vala
index cdb53bd..f1e1455 100644
--- a/src/ui/empty-collection.vala
+++ b/src/ui/empty-collection.vala
@@ -2,4 +2,11 @@
 
 [GtkTemplate (ui = "/org/gnome/Games/ui/empty-collection.ui")]
 private class Games.EmptyCollection : Gtk.Box {
+       [GtkChild]
+       private Gtk.Image icon;
+
+       construct {
+               var icon_name = Config.APPLICATION_ID + "-symbolic";
+               icon.icon_name = icon_name;
+       }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]