[gnome-todo/wip/christopherdavis/flatpak-dual-install: 17/18] flatpak: Allow dual installation of flatpak
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo/wip/christopherdavis/flatpak-dual-install: 17/18] flatpak: Allow dual installation of flatpak
- Date: Sun, 20 Jan 2019 06:21:17 +0000 (UTC)
commit cbbd61a704e4bf9388687a157845d95b33f4fb10
Author: Christopher Davis <brainblasted disroot org>
Date: Mon Dec 10 07:05:31 2018 -0500
flatpak: Allow dual installation of flatpak
Provides the setup necessary to allow the parallel installation
and running of To Do stable and To Do development, using profiles
via meson to change the app id to org.gnome.TodoDevel for development
versions.
Part of https://gitlab.gnome.org/GNOME/Initiatives/issues/1
Relevant To Do issue: https://gitlab.gnome.org/GNOME/gnome-todo/issues/172
build-aux/flatpak/org.gnome.Todo.json | 5 ++-
data/appdata/meson.build | 16 +++++---
...ata.xml.in => org.gnome.Todo.appdata.xml.in.in} | 6 +--
data/icons/meson.build | 46 ++++++++++++++++------
data/meson.build | 37 +++++++++--------
data/org.gnome.Todo.Autostart.desktop.in | 4 --
data/org.gnome.Todo.Autostart.desktop.in.in | 4 ++
...odo.desktop.in => org.gnome.Todo.desktop.in.in} | 2 +-
data/org.gnome.Todo.service.in | 2 +-
meson.build | 35 ++++++++++------
meson_options.txt | 2 +
plugins/background/gtd-plugin-background.c | 1 -
plugins/background/meson.build | 2 +-
plugins/todoist/gtd-todoist-preferences-panel.c | 3 +-
plugins/todoist/meson.build | 2 +-
src/gtd-application.c | 9 +++--
src/main.c | 3 +-
src/meson.build | 2 +-
18 files changed, 114 insertions(+), 67 deletions(-)
---
diff --git a/build-aux/flatpak/org.gnome.Todo.json b/build-aux/flatpak/org.gnome.Todo.json
index 0dff712..8407b6a 100644
--- a/build-aux/flatpak/org.gnome.Todo.json
+++ b/build-aux/flatpak/org.gnome.Todo.json
@@ -1,5 +1,5 @@
{
- "app-id" : "org.gnome.Todo",
+ "app-id" : "org.gnome.TodoDevel",
"runtime" : "org.gnome.Platform",
"runtime-version" : "master",
"sdk" : "org.gnome.Sdk",
@@ -145,7 +145,8 @@
"name" : "gnome-todo",
"buildsystem" : "meson",
"config-opts" : [
- "-Dtracing=true"
+ "-Dtracing=true",
+ "-Dprofile=development"
],
"sources" : [
{
diff --git a/data/appdata/meson.build b/data/appdata/meson.build
index b76451f..62f58bb 100644
--- a/data/appdata/meson.build
+++ b/data/appdata/meson.build
@@ -1,9 +1,13 @@
-appdata = 'org.gnome.Todo.appdata.xml'
-
-i18n.merge_file(
- appdata,
- input: appdata + '.in',
- output: appdata,
+appdata_conf = configuration_data()
+appdata_conf.set('appid', application_id)
+appdata = i18n.merge_file(
+ type: 'xml',
+ input: configure_file(
+ input: 'org.gnome.Todo.appdata.xml.in.in',
+ output: 'org.gnome.Todo.appdata.xml.in',
+ configuration: appdata_conf
+ ),
+ output: '@0 appdata xml'.format(application_id),
po_dir: po_dir,
install: true,
install_dir: join_paths(gnome_todo_datadir, 'metainfo')
diff --git a/data/appdata/org.gnome.Todo.appdata.xml.in b/data/appdata/org.gnome.Todo.appdata.xml.in.in
similarity index 98%
rename from data/appdata/org.gnome.Todo.appdata.xml.in
rename to data/appdata/org.gnome.Todo.appdata.xml.in.in
index c795558..2d95559 100644
--- a/data/appdata/org.gnome.Todo.appdata.xml.in
+++ b/data/appdata/org.gnome.Todo.appdata.xml.in.in
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyleft 2015 Georges Basile Stavracas Neto <georges stavracas gmail com> -->
<component type="desktop">
- <id>org.gnome.Todo.desktop</id>
+ <id>@appid@</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0+</project_license>
<name>To Do</name>
@@ -9,8 +9,8 @@
<description>
<p>
- GNOME To Do is a task management application designed to integrate with GNOME. Save and order your
todos.
- Manage multiple todo lists. Keep your todos on your computer or sync them with cloud providers.
+ GNOME To Do is a task management application designed to integrate with GNOME. Save and order your
todos.
+ Manage multiple todo lists. Keep your todos on your computer or sync them with cloud providers.
Customize your experience with plugins.
</p>
</description>
diff --git a/data/icons/meson.build b/data/icons/meson.build
index fd5833c..ed608a0 100644
--- a/data/icons/meson.build
+++ b/data/icons/meson.build
@@ -1,11 +1,35 @@
-icon_sizes = [
- 'scalable',
- 'symbolic'
-]
-
-foreach icon_size: icon_sizes
- install_subdir(
- 'hicolor/' + icon_size,
- install_dir: join_paths(gnome_todo_datadir, 'icons', 'hicolor')
- )
-endforeach
+# Symbolic application icon
+symbolic_icondir = join_paths('hicolor', 'symbolic', 'apps')
+
+install_data(
+ join_paths(symbolic_icondir, 'org.gnome.Todo-symbolic.svg'),
+ install_dir: join_paths(
+ gnome_todo_datadir,
+ join_paths('icons', symbolic_icondir)
+ ),
+ rename: '@0 -symbolic svg'.format(application_id)
+)
+
+# Main application icon
+icondir = join_paths('hicolor', 'scalable', 'apps')
+
+install_data(
+ join_paths(icondir, 'org.gnome.Todo.svg'),
+ install_dir: join_paths(
+ gnome_todo_datadir,
+ join_paths('icons', icondir)
+ ),
+ rename: '@0@.svg'.format(application_id)
+)
+
+# Other icons
+action_icondir = join_paths('hicolor', 'symbolic', 'actions')
+
+install_subdir(
+ action_icondir,
+ install_dir: join_paths(
+ gnome_todo_datadir,
+ join_paths('icons', action_icondir)
+ ),
+ strip_directory: true
+)
diff --git a/data/meson.build b/data/meson.build
index 994daa8..3ba44e6 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,22 +1,26 @@
-desktop = 'org.gnome.Todo.desktop'
-
-i18n.merge_file(
- desktop,
+desktop_conf = configuration_data()
+desktop_conf.set('icon', application_id)
+desktop = i18n.merge_file(
type: 'desktop',
- input: desktop + '.in',
- output: desktop,
+ input: configure_file(
+ input: 'org.gnome.Todo.desktop.in.in',
+ output: 'org.gnome.Todo.desktop.in',
+ configuration: desktop_conf
+ ),
+ output: '@0@.desktop'.format(application_id),
po_dir: po_dir,
install: true,
install_dir: join_paths(gnome_todo_datadir, 'applications')
)
-autostart = 'org.gnome.Todo.Autostart.desktop'
-
-i18n.merge_file(
- autostart,
+autostart = i18n.merge_file(
type: 'desktop',
- input: autostart + '.in',
- output: autostart,
+ input: configure_file(
+ input: 'org.gnome.Todo.Autostart.desktop.in.in',
+ output: 'org.gnome.Todo.Autostart.desktop.in',
+ configuration: desktop_conf
+ ),
+ output: '@0@.Autostart.desktop'.format(application_id),
po_dir: po_dir,
install: true,
install_dir: gnome_todo_pkgdatadir
@@ -24,12 +28,11 @@ i18n.merge_file(
service_conf = configuration_data()
service_conf.set('bindir', gnome_todo_bindir)
+service_conf.set('application_id', application_id)
-service = 'org.gnome.Todo.service'
-
-configure_file(
- input: service + '.in',
- output: service,
+service = configure_file(
+ input: 'org.gnome.Todo.service.in',
+ output: '@0@.service'.format(application_id),
install: true,
install_dir: join_paths(gnome_todo_datadir, 'dbus-1', 'services'),
configuration: service_conf
diff --git a/data/org.gnome.Todo.Autostart.desktop.in.in b/data/org.gnome.Todo.Autostart.desktop.in.in
new file mode 100644
index 0000000..4f55d7f
--- /dev/null
+++ b/data/org.gnome.Todo.Autostart.desktop.in.in
@@ -0,0 +1,4 @@
+[Desktop Entry]
+Type=Application
+Exec=gapplication action @application_id@ start-client
+NoDisplay=True
diff --git a/data/org.gnome.Todo.desktop.in b/data/org.gnome.Todo.desktop.in.in
similarity index 95%
rename from data/org.gnome.Todo.desktop.in
rename to data/org.gnome.Todo.desktop.in.in
index 425b324..86b65c6 100644
--- a/data/org.gnome.Todo.desktop.in
+++ b/data/org.gnome.Todo.desktop.in.in
@@ -3,7 +3,7 @@ Name=To Do
Comment=Manage your personal tasks
Exec=gnome-todo
# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
-Icon=org.gnome.Todo
+Icon=@icon@
Terminal=false
Type=Application
StartupNotify=true
diff --git a/data/org.gnome.Todo.service.in b/data/org.gnome.Todo.service.in
index d0f7613..c367606 100644
--- a/data/org.gnome.Todo.service.in
+++ b/data/org.gnome.Todo.service.in
@@ -1,3 +1,3 @@
[D-BUS Service]
-Name=org.gnome.Todo
+Name=@application_id@
Exec=@bindir@/gnome-todo --gapplication-service
diff --git a/meson.build b/meson.build
index 0e73d02..0c8931d 100644
--- a/meson.build
+++ b/meson.build
@@ -41,12 +41,22 @@ gnome_todo_tracing = get_option('tracing')
cc = meson.get_compiler('c')
+if get_option('profile') == 'development'
+ profile = 'Devel'
+ name_suffix = ' (Development)'
+else
+ profile = ''
+ name_suffix = ''
+endif
+
config_h = configuration_data()
config_h.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+application_id = 'org.gnome.Todo@0@'.format(profile)
+
# development build
-config_h.set('DEVELOPMENT_BUILD', gnome_todo_minor_version.is_odd())
+config_h.set('DEVELOPMENT_BUILD', gnome_todo_minor_version.is_odd() or profile == 'Devel')
# debug options
config_h.set('GNOME_TODO_ENABLE_DEBUG', gnome_todo_debug)
@@ -55,6 +65,9 @@ config_h.set('NDEBUG', not gnome_todo_debug)
# package
set_defines = [
+ ['APPLICATION_ID', application_id],
+ ['AUTOSTART_FILE', application_id + '.Autostart.desktop'],
+ ['NAME_SUFFIX', name_suffix],
['PACKAGE', meson.project_name()],
['PACKAGE_BUGREPORT', 'https://gitlab.gnome.org/GNOME/' + meson.project_name() + '/issues/new'],
['PACKAGE_NAME', meson.project_name()],
@@ -153,17 +166,15 @@ gnome_todo_deps = [
# VCS #
#######
-vcs_identifier_h = vcs_tag(
- input: configure_file(
- output: 'config.h.in',
- configuration: config_h
- ),
- output: 'config.h',
-)
-
-configure_file(
- output: 'config.h',
- configuration: config_h
+vcs_identifier_h = declare_dependency(
+ sources: vcs_tag(
+ fallback: get_option('profile') != 'default'? 'devel' : 'stable',
+ input: configure_file(
+ output: 'config.h.in',
+ configuration: config_h
+ ),
+ output: 'config.h'
+ )
)
gnome = import('gnome')
diff --git a/meson_options.txt b/meson_options.txt
index 0f9ae13..4957dea 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,6 +1,8 @@
option('documentation', type: 'boolean', value: false, description: 'Use gtk-doc to build documentation')
option('introspection', type: 'boolean', value: true, description: 'Enable GObject Introspection (depends on
GObject)')
option('tracing', type: 'boolean', value: false, description: 'Enable application tracing')
+option('profile', type: 'combo', choices: ['default', 'development'], value: 'default', description: 'Build
profiles')
+
# Plugins
option('score_plugin', type: 'boolean', value: true, description: 'Enable Score plugin')
diff --git a/plugins/background/gtd-plugin-background.c b/plugins/background/gtd-plugin-background.c
index ae141bc..cbfc3f8 100644
--- a/plugins/background/gtd-plugin-background.c
+++ b/plugins/background/gtd-plugin-background.c
@@ -25,7 +25,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#define AUTOSTART_FILE "org.gnome.Todo.Autostart.desktop"
#define AUTOSTART_NOTIFICATION_ID "Gtd::BackgroundPlugin::autostart_notification"
#define AUTOSTART_NOTIFICATION_TIMEOUT 3 /* seconds */
#define MAX_BODY_LENGTH 50 /* chars */
diff --git a/plugins/background/meson.build b/plugins/background/meson.build
index b497eb1..cfd41ff 100644
--- a/plugins/background/meson.build
+++ b/plugins/background/meson.build
@@ -6,7 +6,7 @@ plugins_libs += static_library(
plugin_name,
sources: 'gtd-plugin-' + plugin_name + '.c',
include_directories: plugins_incs,
- dependencies: gnome_todo_deps,
+ dependencies: [ vcs_identifier_h, gnome_todo_deps ],
c_args: '-DPACKAGE_DATA_DIR="@0@"'.format(gnome_todo_pkgdatadir),
)
diff --git a/plugins/todoist/gtd-todoist-preferences-panel.c b/plugins/todoist/gtd-todoist-preferences-panel.c
index 85e2ea4..7b31f6a 100644
--- a/plugins/todoist/gtd-todoist-preferences-panel.c
+++ b/plugins/todoist/gtd-todoist-preferences-panel.c
@@ -20,6 +20,7 @@
#include "gtd-todoist-preferences-panel.h"
+#include "config.h"
#include <glib/gi18n.h>
struct _GtdTodoistPreferencesPanel
@@ -146,7 +147,7 @@ on_goa_account_added (GoaClient *client,
g_object_set_data_full (G_OBJECT (row), "goa-object", g_object_ref (object), g_object_unref);
- logo = gtk_image_new_from_icon_name ("org.gnome.Todo");
+ logo = gtk_image_new_from_icon_name (APPLICATION_ID);
desc = gtk_label_new (identity);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
diff --git a/plugins/todoist/meson.build b/plugins/todoist/meson.build
index 6587165..a8ec97f 100644
--- a/plugins/todoist/meson.build
+++ b/plugins/todoist/meson.build
@@ -17,7 +17,7 @@ plugins_libs += static_library(
plugin_name,
sources: sources,
include_directories: plugins_incs,
- dependencies: todoist_deps
+ dependencies: [ vcs_identifier_h, todoist_deps ]
)
plugin_data = plugin_name + '.plugin'
diff --git a/src/gtd-application.c b/src/gtd-application.c
index 6470b3a..5bed416 100644
--- a/src/gtd-application.c
+++ b/src/gtd-application.c
@@ -137,14 +137,15 @@ gtd_application_show_about (GSimpleAction *simple,
self = GTD_APPLICATION (user_data);
+ g_autofree gchar *program_name = g_strconcat (_("To Do"), NAME_SUFFIX, NULL);
gtk_show_about_dialog (GTK_WINDOW (self->window),
- "program-name", _("To Do"),
+ "program-name", program_name,
"version", VERSION,
"copyright", _("Copyright \xC2\xA9 2015–2018 The To Do authors"),
"license-type", GTK_LICENSE_GPL_3_0,
"authors", authors,
"artists", artists,
- "logo-icon-name", "org.gnome.Todo",
+ "logo-icon-name", APPLICATION_ID,
"translator-credits", _("translator-credits"),
NULL);
}
@@ -163,7 +164,7 @@ GtdApplication *
gtd_application_new (void)
{
return g_object_new (GTD_TYPE_APPLICATION,
- "application-id", "org.gnome.Todo",
+ "application-id", APPLICATION_ID,
"flags", G_APPLICATION_HANDLES_COMMAND_LINE,
"resource-base-path", "/org/gnome/todo",
NULL);
@@ -251,7 +252,7 @@ gtd_application_startup (GApplication *application)
G_APPLICATION_CLASS (gtd_application_parent_class)->startup (application);
/* window */
- gtk_window_set_default_icon_name ("org.gnome.Todo");
+ gtk_window_set_default_icon_name (APPLICATION_ID);
self->window = gtd_window_new (self);
/* CSS provider */
diff --git a/src/main.c b/src/main.c
index 8165f19..b73a508 100644
--- a/src/main.c
+++ b/src/main.c
@@ -32,7 +32,8 @@ main (gint argc,
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
- g_set_application_name (_("To Do"));
+ g_autofree gchar *program_name = g_strconcat (_("To Do"), NAME_SUFFIX, NULL);
+ g_set_application_name (program_name);
app = gtd_application_new ();
g_application_set_default (G_APPLICATION (app));
diff --git a/src/meson.build b/src/meson.build
index 5168b43..514557d 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -175,7 +175,7 @@ gnome_todo = executable(
meson.project_name(),
sources,
include_directories: incs,
- dependencies: gtd_deps,
+ dependencies: [ vcs_identifier_h, gtd_deps ],
c_args: cflags,
link_args: ldflags,
install: true,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]