[gnome-clocks/wip/christopherdavis/flatpak-dual-install: 3/4] flatpak: Allow dual install
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks/wip/christopherdavis/flatpak-dual-install: 3/4] flatpak: Allow dual install
- Date: Sun, 23 Dec 2018 06:14:33 +0000 (UTC)
commit 255a3260d171f94cd7c9c9be0228aa55e4ea43e1
Author: Christopher Davis <brainblasted disroot org>
Date: Sun Dec 23 01:02:10 2018 -0500
flatpak: Allow dual install
With this commit the development and stable versions can be
installed and run at the same time.
Part of https://gitlab.gnome.org/GNOME/Initiatives/issues/1
data/flatpak/org.gnome.clocks.json | 9 ++--
data/meson.build | 51 ++++++++++++++++-----
...a.xml.in => org.gnome.clocks.appdata.xml.in.in} | 4 +-
...s.desktop.in => org.gnome.clocks.desktop.in.in} | 2 +-
data/org.gnome.clocks.search-provider.ini | 5 --
data/org.gnome.clocks.search-provider.ini.in | 5 ++
data/org.gnome.clocks.service.in | 2 +-
gnome-clocks.flatpak | Bin 0 -> 3164128 bytes
meson.build | 19 ++++++--
meson_options.txt | 9 ++++
src/application.vala | 4 +-
src/config.vapi | 3 ++
src/geocoding.vala | 4 +-
src/window.vala | 10 +++-
14 files changed, 94 insertions(+), 33 deletions(-)
---
diff --git a/data/flatpak/org.gnome.clocks.json b/data/flatpak/org.gnome.clocks.json
index e7cf2ad..803057f 100644
--- a/data/flatpak/org.gnome.clocks.json
+++ b/data/flatpak/org.gnome.clocks.json
@@ -1,11 +1,11 @@
{
- "app-id": "org.gnome.clocks",
+ "app-id": "org.gnome.clocksDevel",
"runtime": "org.gnome.Platform",
"runtime-version": "master",
"sdk": "org.gnome.Sdk",
"command": "gnome-clocks",
"tags": ["nightly"],
- "desktop-file-name-prefix": "(Nightly) ",
+ "desktop-file-name-prefix": "(Development) ",
"finish-args": [
/* X11 + XShm access */
"--share=ipc", "--socket=x11",
@@ -83,6 +83,9 @@
{
"name": "gnome-clocks",
"buildsystem": "meson",
+ "config-opts": [
+ "-Dprofile=development"
+ ],
"sources": [
{
"type": "git",
@@ -91,4 +94,4 @@
]
}
]
-}
+}
\ No newline at end of file
diff --git a/data/meson.build b/data/meson.build
index 8861e45..748e017 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,7 +1,16 @@
-iconsdir = join_paths(get_option('datadir'), 'icons/hicolor')
-foreach size: ['scalable', 'symbolic']
- install_subdir('icons/hicolor/' + size, install_dir: iconsdir)
-endforeach
+scalable_iconsdir = join_paths('icons', 'hicolor', 'scalable', 'apps')
+install_data(
+ join_paths(scalable_iconsdir, 'org.gnome.clocks.svg'),
+ install_dir: join_paths(get_option('datadir'), scalable_iconsdir),
+ rename: '@0@.svg'.format(app_id)
+)
+
+symbolic_iconsdir = join_paths('icons', 'hicolor', 'symbolic', 'apps')
+install_data(
+ join_paths(symbolic_iconsdir, 'org.gnome.clocks-symbolic.svg'),
+ install_dir: join_paths(get_option('datadir'), symbolic_iconsdir),
+ rename: '@0 -symbolic svg'.format(app_id)
+)
install_subdir('images/', install_dir: join_paths(get_option('datadir'), meson.project_name()))
@@ -10,9 +19,15 @@ resources = gnome.compile_resources('org.gnome.clocks', resource_files,
c_name: 'resources'
)
+desktop_conf = configuration_data()
+desktop_conf.set('icon', app_id)
custom_target('desktop-file',
- input: 'org.gnome.clocks.desktop.in',
- output: 'org.gnome.clocks.desktop',
+ input: configure_file(
+ input: 'org.gnome.clocks.desktop.in.in',
+ output: 'org.gnome.clocks.desktop.in',
+ configuration: desktop_conf
+ ),
+ output: '@0@.desktop'.format(app_id),
install: true,
install_dir: join_paths(get_option('datadir'), 'applications'),
command: [msgfmt, '--desktop',
@@ -24,23 +39,37 @@ custom_target('desktop-file',
dbusconf = configuration_data()
dbusconf.set('bindir', join_paths(get_option('prefix'), get_option('bindir')))
+dbusconf.set('name', app_id)
configure_file(
input: 'org.gnome.clocks.service.in',
- output: 'org.gnome.clocks.service',
+ output: '@0@.service'.format(app_id),
configuration: dbusconf,
install: true,
install_dir: join_paths(get_option('datadir'), 'dbus-1', 'services'),
)
+appdata_conf = configuration_data()
+appdata_conf.set('appid', app_id)
custom_target('appdata-file',
- input: 'org.gnome.clocks.appdata.xml.in',
- output: 'org.gnome.clocks.appdata.xml',
+ input: configure_file(
+ input: 'org.gnome.clocks.appdata.xml.in.in',
+ output: 'org.gnome.clocks.appdata.xml.in',
+ configuration: appdata_conf,
+ ),
+ output: '@0 appdata xml'.format(app_id),
install: true,
install_dir: join_paths(get_option('datadir'), 'metainfo'),
command: [msgfmt, '--xml', '--template', '@INPUT@', '-d', podir, '-o', '@OUTPUT@'],
)
-install_data('org.gnome.clocks.search-provider.ini',
+search_conf = configuration_data()
+search_conf.set('appid', app_id)
+search_conf.set('profile', profile)
+configure_file(
+ input: 'org.gnome.clocks.search-provider.ini.in',
+ output: '@0 search-provider ini'.format(app_id),
+ configuration: search_conf,
+ install: true,
install_dir: join_paths(get_option('datadir'), 'gnome-shell', 'search-providers'),
)
@@ -52,4 +81,4 @@ configure_file(
configuration: gsettingsconf,
install: true,
install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas'),
-)
+)
\ No newline at end of file
diff --git a/data/org.gnome.clocks.appdata.xml.in b/data/org.gnome.clocks.appdata.xml.in.in
similarity index 97%
rename from data/org.gnome.clocks.appdata.xml.in
rename to data/org.gnome.clocks.appdata.xml.in.in
index a5a055b..e33ce63 100644
--- a/data/org.gnome.clocks.appdata.xml.in
+++ b/data/org.gnome.clocks.appdata.xml.in.in
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
- <id>org.gnome.clocks</id>
+ <id>@appid@</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-2.0</project_license>
<name>GNOME Clocks</name>
@@ -61,7 +61,7 @@
<url type="donation">http://www.gnome.org/friends/</url>
<url type="help">https://help.gnome.org/users/gnome-clocks/stable/</url>
<update_contact>pborelli gnome org</update_contact>
- <launchable type="desktop-id">org.gnome.clocks.desktop</launchable>
+ <launchable type="desktop-id">@appid@.desktop</launchable>
<developer_name>The GNOME Project</developer_name>
<project_group>GNOME</project_group>
<translation type="gettext">gnome-clocks</translation>
diff --git a/data/org.gnome.clocks.desktop.in b/data/org.gnome.clocks.desktop.in.in
similarity index 96%
rename from data/org.gnome.clocks.desktop.in
rename to data/org.gnome.clocks.desktop.in.in
index 6d8d99e..58e6620 100644
--- a/data/org.gnome.clocks.desktop.in
+++ b/data/org.gnome.clocks.desktop.in.in
@@ -7,7 +7,7 @@ Comment=Clocks for world times, plus alarms, stopwatch and a timer
Keywords=time;timer;alarm;world clock;stopwatch;time zone;
Exec=gnome-clocks
# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
-Icon=org.gnome.clocks
+Icon=@icon@
Terminal=false
Type=Application
Categories=GNOME;GTK;Utility;Clock;
diff --git a/data/org.gnome.clocks.search-provider.ini.in b/data/org.gnome.clocks.search-provider.ini.in
new file mode 100644
index 0000000..331422c
--- /dev/null
+++ b/data/org.gnome.clocks.search-provider.ini.in
@@ -0,0 +1,5 @@
+[Shell Search Provider]
+DesktopId=@appid@.desktop
+BusName=@appid@
+ObjectPath=/org/gnome/clocks@profile@/SearchProvider
+Version=2
diff --git a/data/org.gnome.clocks.service.in b/data/org.gnome.clocks.service.in
index b24e7b6..ed75f70 100644
--- a/data/org.gnome.clocks.service.in
+++ b/data/org.gnome.clocks.service.in
@@ -1,3 +1,3 @@
[D-BUS Service]
-Name=org.gnome.clocks
+Name=@name@
Exec=@bindir@/gnome-clocks --gapplication-service
diff --git a/gnome-clocks.flatpak b/gnome-clocks.flatpak
new file mode 100644
index 0000000..a9a5312
Binary files /dev/null and b/gnome-clocks.flatpak differ
diff --git a/meson.build b/meson.build
index 369ebd6..2567830 100644
--- a/meson.build
+++ b/meson.build
@@ -3,7 +3,7 @@ project(
['vala', 'c'],
version: '3.31.1',
license: 'GPL2+',
- meson_version: '>= 0.41.0',
+ meson_version: '>= 0.46.0',
)
gnome = import('gnome')
@@ -35,10 +35,23 @@ int main() {
msgfmt = find_program('msgfmt')
podir = join_paths(meson.source_root(), 'po')
+if get_option('profile') == 'development'
+ name_prefix = '(Development) '
+ profile = 'Devel'
+else
+ name_prefix = ''
+ profile = ''
+endif
+
+app_id = 'org.gnome.clocks@0@'.format(profile)
+
conf = configuration_data()
-conf.set_quoted('G_LOG_DOMAIN', 'org.gnome.Clocks')
+conf.set_quoted('APP_ID', app_id)
+conf.set_quoted('G_LOG_DOMAIN', 'org.gnome.Clocks@0@'.format(profile))
+conf.set_quoted('NAME_PREFIX', name_prefix)
conf.set_quoted('PACKAGE_NAME', meson.project_name())
conf.set_quoted('PACKAGE_VERSION', meson.project_version())
+conf.set_quoted('PROFILE', profile)
conf.set_quoted('VERSION', meson.project_version())
conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
conf.set_quoted('DATADIR', join_paths(get_option('prefix'), get_option('datadir')))
@@ -55,4 +68,4 @@ meson.add_install_script(python3.find_python().path(),
subdir('data')
subdir('help')
subdir('po')
-subdir('src')
+subdir('src')
\ No newline at end of file
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..7469421
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,9 @@
+option(
+ 'profile',
+ type: 'combo',
+ choices: [
+ 'default',
+ 'development',
+ ],
+ value: 'default'
+)
diff --git a/src/application.vala b/src/application.vala
index e44df9f..9bd9a19 100644
--- a/src/application.vala
+++ b/src/application.vala
@@ -46,9 +46,9 @@ public class Application : Gtk.Application {
}
public Application () {
- Object (application_id: "org.gnome.clocks");
+ Object (application_id: Config.APP_ID);
- Gtk.Window.set_default_icon_name ("org.gnome.clocks");
+ Gtk.Window.set_default_icon_name (Config.APP_ID);
add_main_option_entries (option_entries);
add_action_entries (action_entries, this);
diff --git a/src/config.vapi b/src/config.vapi
index b286a75..1126340 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 VERSION;
+ public const string PROFILE;
+ public const string NAME_PREFIX;
public const string GETTEXT_PACKAGE;
public const string GNOMELOCALEDIR;
public const string DATADIR;
+ public const string APP_ID;
}
diff --git a/src/geocoding.vala b/src/geocoding.vala
index 7aa096b..1c0e2c2 100644
--- a/src/geocoding.vala
+++ b/src/geocoding.vala
@@ -22,8 +22,6 @@ namespace Geo {
public class Info : Object {
public GClue.Location? geo_location { get; private set; default = null; }
- private const string DESKTOP_ID = "org.gnome.clocks";
-
private GWeather.Location? found_location;
private string? country_code;
private GClue.Simple simple;
@@ -39,7 +37,7 @@ public class Info : Object {
public async void seek () {
try {
- simple = yield new GClue.Simple (DESKTOP_ID, GClue.AccuracyLevel.CITY, null);
+ simple = yield new GClue.Simple (Config.APP_ID, GClue.AccuracyLevel.CITY, null);
} catch (Error e) {
warning ("Failed to connect to GeoClue2 service: %s", e.message);
return;
diff --git a/src/window.vala b/src/window.vala
index 0d62cfd..84f17a4 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -138,6 +138,11 @@ public class Window : Gtk.ApplicationWindow {
stack.visible_child = panels[settings.get_enum ("panel-id")];
+ Gtk.StyleContext style = get_style_context ();
+ if (Config.PROFILE == "Devel") {
+ style.add_class ("devel");
+ }
+
update_header_bar ();
show_all ();
@@ -255,9 +260,10 @@ public class Window : Gtk.ApplicationWindow {
null
};
+ var program_name = Config.NAME_PREFIX + "Clocks";
Gtk.show_about_dialog (this,
- "program-name", _("Clocks"),
- "logo-icon-name", "org.gnome.clocks",
+ "program-name", _(program_name),
+ "logo-icon-name", Config.APP_ID,
"version", Config.VERSION,
"comments", _("Utilities to help you with the time."),
"copyright", copyright,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]