Skip to content

Commit

Permalink
general: Allow dual installation of app bundles
Browse files Browse the repository at this point in the history
Allows for the installation of development bundles alongside
stable versions.
  • Loading branch information
Felipe Kinoshita committed Jun 17, 2023
1 parent d16f2df commit 0371336
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id" : "io.github.fkinoshita.Telegraph",
"id" : "io.github.fkinoshita.Telegraph.Devel",
"runtime" : "org.gnome.Platform",
"runtime-version" : "master",
"sdk" : "org.gnome.Sdk",
Expand All @@ -26,11 +26,13 @@
"name" : "telegraph",
"builddir" : true,
"buildsystem" : "meson",
"config-opts" : [
"-Dprofile=development"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/fkinoshita/Telegraph.git",
"branch" : "main"
"type" : "dir",
"path" : ".."
}
]
}
Expand Down
8 changes: 6 additions & 2 deletions data/icons/meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
application_id = 'io.github.fkinoshita.Telegraph'

if get_option('profile') == 'development'
application_id = '@[email protected]'.format(application_id)
endif

scalable_dir = join_paths('hicolor', 'scalable', 'apps')
install_data(
join_paths(scalable_dir, ('@[email protected]').format(application_id)),
Expand All @@ -8,6 +12,6 @@ install_data(

symbolic_dir = join_paths('hicolor', 'symbolic', 'apps')
install_data(
join_paths(symbolic_dir, ('@0@-symbolic.svg').format(application_id)),
join_paths(symbolic_dir, ('io.github.fkinoshita.Telegraph-symbolic.svg')),
install_dir: join_paths(get_option('datadir'), 'icons', symbolic_dir)
)
)
2 changes: 1 addition & 1 deletion data/io.github.fkinoshita.Telegraph.gschema.xml.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="telegraph">
<schema id="io.github.fkinoshita.Telegraph" path="/io/github/fkinoshita/Telegraph/">
<schema id="@APP_ID@" path="/io/github/fkinoshita/Telegraph/">
<key type="ai" name="window-size">
<default>[415, 500]</default>
<summary>Window Size</summary>
Expand Down
2 changes: 1 addition & 1 deletion data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ gschema_conf = configuration_data()
gschema_conf.set('APP_ID', application_id)
gschema_conf.set('GETTEXT_PACKAGE', gettext_package)
configure_file(
input: '@[email protected]'.format(project_id),
input: '@[email protected]'.format(base_id),
output: '@[email protected]'.format(application_id),
configuration: gschema_conf,
install: true,
Expand Down
17 changes: 14 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ i18n = import('i18n')
python = import('python')
gnome = import('gnome')

project_id = 'io.github.fkinoshita.Telegraph'
base_id = 'io.github.fkinoshita.Telegraph'
project_name = 'Telegraph'
package_url = 'https://github.com/fkinoshita/Telegraph'
copyright = '© 2023 Felipe Kinoshita.'
Expand All @@ -30,8 +30,19 @@ dependency('libadwaita-1', version: '>=1.2')

DATA_DIR = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())

application_id = project_id
version = meson.project_version()
# Profiles
if get_option('profile') == 'development'
profile = 'Devel'
application_id = '@0@.@1@'.format(base_id, profile)

find_program('git')
rev_txt = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip()
version = meson.project_version() + '-' + rev_txt
else
application_id = base_id
profile = 'Default'
version = meson.project_version()
endif

top_source_dir = meson.current_source_dir()
gettext_package = meson.project_name()
Expand Down
9 changes: 9 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
option(
'profile',
type: 'combo',
choices: [
'default',
'development'
],
value: 'default'
)
3 changes: 2 additions & 1 deletion src/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@

from gi.repository import Adw, Gtk, Gio

from .const import APP_ID
from .window import TelegraphWindow


class TelegraphApplication(Adw.Application):
def __init__(self):
super().__init__(
application_id='io.github.fkinoshita.Telegraph',
application_id=APP_ID,
flags=Gio.ApplicationFlags.FLAGS_NONE
)

Expand Down
25 changes: 14 additions & 11 deletions src/meson.build
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
moduledir = join_paths(DATA_DIR, 'telegraph')

conf = configuration_data()
const = configuration_data()

conf.set('VERSION', version)
conf.set('APPID', application_id)
conf.set('GETTEXT_PACKAGE', meson.project_name())
conf.set('LOCALE_DIR', join_paths(get_option('prefix'), get_option('datadir'), 'locale'))
conf.set('NAME', project_name)
conf.set('PYTHON', python.find_installation('python3').path())
conf.set('DATA_DIR', DATA_DIR)
conf.set('APPID', application_id)
const.set('APPID', application_id)
const.set('PROFILE', profile)

configure_file(
input: 'const.py.in',
output: 'const.py',
configuration: conf,
configuration: const,
install: true,
install_dir: get_option('bindir')
install_dir: moduledir
)

conf = configuration_data()

conf.set('VERSION', version)
conf.set('GETTEXT_PACKAGE', meson.project_name())
conf.set('LOCALE_DIR', join_paths(get_option('prefix'), get_option('datadir'), 'locale'))
conf.set('PYTHON', python.find_installation('python3').full_path())
conf.set('DATA_DIR', DATA_DIR)
conf.set('APPID', application_id)

configure_file(
input: 'telegraph.in',
output: 'telegraph',
Expand Down
2 changes: 0 additions & 2 deletions src/telegraph.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ import locale
import gettext

VERSION = '@VERSION@'
APP_ID = "@APPID@"
GETTEXT_PACKAGE = "@GETTEXT_PACKAGE@"
LOCALEDIR = "@LOCALE_DIR@"
NAME = "@NAME@"
PKGDATADIR = "@DATA_DIR@"

sys.path.insert(1, PKGDATADIR)
Expand Down
4 changes: 4 additions & 0 deletions src/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from gi.repository import Adw, Gtk, Gdk, Gio, GLib

from .const import PROFILE
from .utils import Utils

@Gtk.Template(resource_path='/io/github/fkinoshita/Telegraph/ui/window.ui')
Expand All @@ -28,6 +29,9 @@ class TelegraphWindow(Adw.ApplicationWindow):
def __init__(self, **kwargs):
super().__init__(**kwargs)

if PROFILE == 'Devel':
self.add_css_class('devel')

self.settings = Gio.Settings.new(Gio.Application.get_default().get_application_id())

# Set saved window size
Expand Down

0 comments on commit 0371336

Please sign in to comment.