Commit 255a3260 authored by Christopher Davis's avatar Christopher Davis

flatpak: Allow dual install

With this commit the development and stable versions can be
installed and run at the same time.

Part of GNOME/Initiatives#1
parent 1af7bea7
{
"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
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
<?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>
......
......@@ -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;
......
[Shell Search Provider]
DesktopId=org.gnome.clocks.desktop
BusName=org.gnome.clocks
ObjectPath=/org/gnome/clocks/SearchProvider
Version=2
[Shell Search Provider]
DesktopId=@appid@.desktop
BusName=@appid@
ObjectPath=/org/gnome/clocks@profile@/SearchProvider
Version=2
[D-BUS Service]
Name=org.gnome.clocks
Name=@name@
Exec=@bindir@/gnome-clocks --gapplication-service
......@@ -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
option(
'profile',
type: 'combo',
choices: [
'default',
'development',
],
value: 'default'
)
......@@ -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);
......
[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;
}
......@@ -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;
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment