[gnome-calendar/wip/christopherdavis/flatpak-dual-install: 1/4] flatpak: Allow dual installation of app bundles
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/wip/christopherdavis/flatpak-dual-install: 1/4] flatpak: Allow dual installation of app bundles
- Date: Sun, 9 Dec 2018 06:33:49 +0000 (UTC)
commit 83f722e86f9e593121c27def661682b3944debd2
Author: Christopher Davis <brainblasted disroot org>
Date: Sat Nov 3 20:36:37 2018 -0400
flatpak: Allow dual installation of app bundles
Part of https://gitlab.gnome.org/GNOME/Initiatives/issues/1.
Allows for the installation of development bundles alongside
stable versions.
Related to https://gitlab.gnome.org/GNOME/gnome-calendar/issues/285
build-aux/flatpak/org.gnome.Calendar.json | 5 +--
data/appdata/meson.build | 16 ++++++----
...xml.in => org.gnome.Calendar.appdata.xml.in.in} | 2 +-
data/icons/meson.build | 23 ++++++++++++--
data/meson.build | 36 +++++++++++++--------
...desktop.in => org.gnome.Calendar.desktop.in.in} | 2 +-
data/org.gnome.Calendar.search-provider.ini | 6 ----
data/org.gnome.Calendar.search-provider.ini.in | 6 ++++
data/org.gnome.Calendar.service.in | 2 +-
meson.build | 37 +++++++++++++++++-----
meson_options.txt | 1 +
src/gcal-application.c | 10 +++---
src/meson.build | 4 +--
src/weather/gcal-weather-service.c | 5 ++-
14 files changed, 104 insertions(+), 51 deletions(-)
---
diff --git a/build-aux/flatpak/org.gnome.Calendar.json b/build-aux/flatpak/org.gnome.Calendar.json
index 1bad44b3..94f9b5cb 100644
--- a/build-aux/flatpak/org.gnome.Calendar.json
+++ b/build-aux/flatpak/org.gnome.Calendar.json
@@ -1,5 +1,5 @@
{
- "app-id" : "org.gnome.Calendar",
+ "app-id" : "org.gnome.CalendarDevel",
"runtime" : "org.gnome.Platform",
"runtime-version" : "master",
"sdk" : "org.gnome.Sdk",
@@ -166,7 +166,8 @@
],
"config-opts" : [
"-Dtracing=true",
- "-Ddocumentation=true"
+ "-Ddocumentation=true",
+ "-Dprofile=development"
]
}
]
diff --git a/data/appdata/meson.build b/data/appdata/meson.build
index 68f36015..b5ee6540 100644
--- a/data/appdata/meson.build
+++ b/data/appdata/meson.build
@@ -1,9 +1,13 @@
-info = 'org.gnome.Calendar.appdata.xml'
-
-i18n.merge_file(
- info,
- input: 'org.gnome.Calendar.appdata.xml.in',
- output: info,
+appdata_conf = configuration_data()
+appdata_conf.set('appid', application_id)
+appdata = i18n.merge_file(
+ 'appdata',
+ input: configure_file(
+ input: files('org.gnome.Calendar.appdata.xml.in.in'),
+ output: 'org.gnome.Calendar.appdata.xml.in',
+ configuration: appdata_conf
+ ),
+ output: '@0 appdata xml'.format(application_id),
po_dir: po_dir,
install: true,
install_dir: join_paths(calendar_datadir, 'metainfo')
diff --git a/data/appdata/org.gnome.Calendar.appdata.xml.in
b/data/appdata/org.gnome.Calendar.appdata.xml.in.in
similarity index 99%
rename from data/appdata/org.gnome.Calendar.appdata.xml.in
rename to data/appdata/org.gnome.Calendar.appdata.xml.in.in
index 71cca85a..f6f918f2 100644
--- a/data/appdata/org.gnome.Calendar.appdata.xml.in
+++ b/data/appdata/org.gnome.Calendar.appdata.xml.in.in
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2014 Igor Gnatenko <ignatenko src gnome org> -->
<component type="desktop">
- <id>org.gnome.Calendar.desktop</id>
+ <id>@appid@.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0-or-later</project_license>
<name>Calendar</name>
diff --git a/data/icons/meson.build b/data/icons/meson.build
index 5e2d1029..6e5ee4e2 100644
--- a/data/icons/meson.build
+++ b/data/icons/meson.build
@@ -1,4 +1,21 @@
-install_subdir(
- 'hicolor',
- install_dir: join_paths(calendar_datadir, 'icons')
+symbolic_icondir = join_paths('hicolor', 'symbolic', 'apps')
+
+install_data(
+ join_paths(symbolic_icondir, 'org.gnome.Calendar-symbolic.svg'),
+ install_dir: join_paths(
+ calendar_datadir,
+ join_paths('icons', symbolic_icondir)
+ ),
+ rename: '@0 -symbolic svg'.format(application_id)
+)
+
+icondir = join_paths('hicolor', 'scalable', 'apps')
+
+install_data(
+ join_paths(icondir, 'org.gnome.Calendar.svg'),
+ install_dir: join_paths(
+ calendar_datadir,
+ join_paths('icons', icondir)
+ ),
+ rename: '@0@.svg'.format(application_id)
)
diff --git a/data/meson.build b/data/meson.build
index dca57d3c..246d9ddb 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -18,22 +18,30 @@ enums_xml = gnome.mkenums(
# Desktop files
# Note: This name is registered in gcal-weather-service.c.
-desktop = 'org.gnome.Calendar.desktop'
-
-i18n.merge_file(
- desktop,
- type: 'desktop',
- input: desktop + '.in',
- output: desktop,
- po_dir: po_dir,
- install: true,
+desktop_conf = configuration_data()
+desktop_conf.set('icon', application_id)
+desktop = i18n.merge_file(
+ type: 'desktop',
+ input: configure_file(
+ input: files('org.gnome.Calendar.desktop.in.in'),
+ output: 'org.gnome.Calendar.desktop.in',
+ configuration: desktop_conf
+ ),
+ output: '@0@.desktop'.format(application_id),
+ po_dir: po_dir,
+ install: true,
install_dir: join_paths(calendar_datadir, 'applications')
)
# GNOME Shell search provider
-install_data(
- 'org.gnome.Calendar.search-provider.ini',
- install_dir: join_paths(calendar_datadir, 'gnome-shell', 'search-providers')
+search_provider_conf = configuration_data()
+search_provider_conf.set('appid', application_id)
+search_provider_conf.set('profile', profile)
+configure_file(
+ configuration: search_provider_conf,
+ input: files('org.gnome.Calendar.search-provider.ini.in'),
+ install_dir: join_paths(calendar_datadir, 'gnome-shell', 'search-providers'),
+ output: '@0 search-provider ini'.format(application_id)
)
# GSettings schema
@@ -63,13 +71,13 @@ compiled_schemas = custom_target(
# DBus service files
service_conf = configuration_data()
+service_conf.set('appid', application_id)
service_conf.set('bindir', calendar_bindir)
-
service = 'org.gnome.Calendar.service'
configure_file(
input: service + '.in',
- output: service,
+ output: '@0@.service'.format(application_id),
install: true,
install_dir: join_paths(calendar_datadir, 'dbus-1', 'services'),
configuration: service_conf
diff --git a/data/org.gnome.Calendar.desktop.in b/data/org.gnome.Calendar.desktop.in.in
similarity index 95%
rename from data/org.gnome.Calendar.desktop.in
rename to data/org.gnome.Calendar.desktop.in.in
index 376d31c0..656f2812 100644
--- a/data/org.gnome.Calendar.desktop.in
+++ b/data/org.gnome.Calendar.desktop.in.in
@@ -3,7 +3,7 @@ Name=Calendar
Comment=Access and manage your calendars
Exec=gnome-calendar
# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
-Icon=org.gnome.Calendar
+Icon=@icon@
Terminal=false
Type=Application
StartupNotify=true
diff --git a/data/org.gnome.Calendar.search-provider.ini.in b/data/org.gnome.Calendar.search-provider.ini.in
new file mode 100644
index 00000000..3db030db
--- /dev/null
+++ b/data/org.gnome.Calendar.search-provider.ini.in
@@ -0,0 +1,6 @@
+[Shell Search Provider]
+Icon=gnome-calendar
+DesktopId=@appid@.desktop
+BusName=@appid@
+ObjectPath=/org/gnome/Calendar@profile@/SearchProvider
+Version=2
diff --git a/data/org.gnome.Calendar.service.in b/data/org.gnome.Calendar.service.in
index f3134612..70fbdd84 100644
--- a/data/org.gnome.Calendar.service.in
+++ b/data/org.gnome.Calendar.service.in
@@ -1,3 +1,3 @@
[D-BUS Service]
-Name=org.gnome.Calendar
+Name=@appid@
Exec=@bindir@/gnome-calendar --gapplication-service
diff --git a/meson.build b/meson.build
index 09514271..9626138a 100644
--- a/meson.build
+++ b/meson.build
@@ -34,6 +34,18 @@ calendar_schemadir = join_paths(calendar_datadir, 'glib-2.0', 'schemas')
# Options #
###########
+rev_txt = run_command('git','rev-parse','--short','HEAD').stdout().strip()
+if get_option('profile') == 'development'
+ profile = 'Devel'
+ name_suffix = ' (Development)'
+ rev = '-@0@'.format(rev_txt)
+else
+ profile = ''
+ name_suffix = ''
+ rev = ''
+endif
+
+application_id = 'org.gnome.Calendar@0@'.format(profile)
calendar_buildtype = get_option('buildtype')
calendar_debug = calendar_minor_version.is_odd() or calendar_buildtype.contains('debug')
enable_tracing = get_option('tracing')
@@ -53,9 +65,12 @@ set_defines = [
['PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), calendar_version)],
['PACKAGE_TARNAME', meson.project_name()],
['PACKAGE_URL', 'https://wiki.gnome.org/Apps/Calendar'],
- ['PACKAGE_VERSION', calendar_version],
- ['VERSION', calendar_version],
- ['GETTEXT_PACKAGE', meson.project_name()]
+ ['PACKAGE_VERSION', calendar_version + rev],
+ ['VERSION', calendar_version + rev],
+ ['GETTEXT_PACKAGE', meson.project_name()],
+ ['PROFILE', profile],
+ ['NAME_SUFFIX', name_suffix],
+ ['APPLICATION_ID', application_id]
]
foreach define: set_defines
@@ -162,6 +177,17 @@ data_dir = join_paths(meson.source_root(), 'data')
po_dir = join_paths(meson.source_root(), 'po')
src_dir = join_paths(meson.source_root(), 'src')
+config = declare_dependency(
+ sources: vcs_tag(
+ command: ['git', 'rev-parse', '--short', 'HEAD'],
+ fallback: get_option('profile') != 'default'? 'devel' : 'stable',
+ input: configure_file(
+ output: 'config.h.in',
+ configuration: config_h
+ ),
+ output: 'config.h'
+ )
+)
###########
# Subdirs #
@@ -178,11 +204,6 @@ if enable_gtk_doc
subdir('doc/reference')
endif
-configure_file(
- output: 'config.h',
- configuration: config_h
-)
-
output = '\n\n GNOME Calendar ' + calendar_version + '\n'
output += ' =========================\n\n'
output += ' Source ..........................: ' + meson.source_root() + '\n'
diff --git a/meson_options.txt b/meson_options.txt
index 27e07971..00afd50e 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,2 +1,3 @@
option('tracing', type: 'boolean', value: false, description: 'add extra debugging information')
option('documentation', type: 'boolean', value: false, description: 'use gtk-doc to build documentation')
+option('profile', type: 'combo', choices: ['default', 'development'], value: 'default')
diff --git a/src/gcal-application.c b/src/gcal-application.c
index 9037dc32..1a2ec1dd 100644
--- a/src/gcal-application.c
+++ b/src/gcal-application.c
@@ -470,7 +470,7 @@ gcal_application_dbus_register (GApplication *application,
if (!G_APPLICATION_CLASS (gcal_application_parent_class)->dbus_register (application, connection,
object_path, error))
GCAL_RETURN (FALSE);
- search_provider_path = g_strconcat (object_path, "/SearchProvider", NULL);
+ search_provider_path = g_strconcat (object_path, PROFILE, "/SearchProvider", NULL);
if (!gcal_shell_search_provider_dbus_export (self->search_provider, connection, search_provider_path,
error))
GCAL_RETURN (FALSE);
@@ -641,16 +641,18 @@ gcal_application_show_about (GSimpleAction *simple,
self = GCAL_APPLICATION (user_data);
+
+ g_autofree gchar *program_name = g_strconcat (_("Calendar"), NAME_SUFFIX, NULL);
dialog = g_object_new (GTK_TYPE_ABOUT_DIALOG,
"transient-for", GTK_WINDOW (self->window),
"modal", TRUE,
"destroy-with-parent", TRUE,
- "program-name", _("Calendar"),
+ "program-name", program_name,
"version", VERSION,
"license-type", GTK_LICENSE_GPL_3_0,
"authors", authors,
"artists", artists,
- "logo-icon-name", "org.gnome.Calendar",
+ "logo-icon-name", APPLICATION_ID,
"translator-credits", _("translator-credits"),
NULL);
@@ -681,7 +683,7 @@ gcal_application_new (void)
{
return g_object_new (gcal_application_get_type (),
"resource-base-path", "/org/gnome/calendar",
- "application-id", "org.gnome.Calendar",
+ "application-id", APPLICATION_ID,
"flags", G_APPLICATION_HANDLES_COMMAND_LINE,
NULL);
}
diff --git a/src/meson.build b/src/meson.build
index 724ff425..cc7ccf09 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -119,7 +119,7 @@ libgcal = shared_library(
'gcal-private',
sources: sources,
include_directories: incs,
- dependencies: gcal_deps,
+ dependencies: [ gcal_deps, config ],
install: false,
)
@@ -137,7 +137,7 @@ executable(
meson.project_name(),
sources + files('main.c'),
include_directories: incs,
- dependencies: gcal_deps,
+ dependencies: [ gcal_deps, config ],
install: true,
install_dir: calendar_bindir
)
diff --git a/src/weather/gcal-weather-service.c b/src/weather/gcal-weather-service.c
index 53e2ce9a..7ff1d206 100644
--- a/src/weather/gcal-weather-service.c
+++ b/src/weather/gcal-weather-service.c
@@ -18,13 +18,12 @@
#define G_LOG_DOMAIN "GcalWeatherService"
-#define DESKTOP_FILE_NAME "org.gnome.Calendar"
-
#include <geocode-glib/geocode-glib.h>
#include <geoclue.h>
#include <string.h>
#include <math.h>
+#include "config.h"
#include "gcal-debug.h"
#include "gcal-timer.h"
#include "gcal-weather-service.h"
@@ -1134,7 +1133,7 @@ gcal_weather_service_run (GcalWeatherService *self,
g_cancellable_cancel (self->location_cancellable);
g_cancellable_reset (self->location_cancellable);
- gclue_simple_new (DESKTOP_FILE_NAME,
+ gclue_simple_new (APPLICATION_ID,
GCLUE_ACCURACY_LEVEL_EXACT,
self->location_cancellable,
(GAsyncReadyCallback) on_gclue_simple_creation_cb,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]