diff --git a/README.md b/README.md
index ecbe2e9..b7dc035 100644
--- a/README.md
+++ b/README.md
@@ -35,18 +35,18 @@ Being this one of my first Vala applications I'm sure that the code can be impro
## Screenshots
### Indicator
-
-
+
+
### Indicator (inc. battery charge percentage):
-
+
### Popover:
-
-
-
+
+
+
### Popover (inc. battery charge percentage):
-
+
### Settings:
-
+
## Building and installation from source
diff --git a/data/icons/Application.css b/data/Application.css
similarity index 100%
rename from data/icons/Application.css
rename to data/Application.css
diff --git a/data/com.github.casasfernando.wingpanel-indicator-airpods.appdata.xml.in b/data/com.github.casasfernando.wingpanel-indicator-airpods.appdata.xml.in
index f0a06d0..9250b05 100644
--- a/data/com.github.casasfernando.wingpanel-indicator-airpods.appdata.xml.in
+++ b/data/com.github.casasfernando.wingpanel-indicator-airpods.appdata.xml.in
@@ -13,28 +13,28 @@
- https://github.com/casasfernando/wingpanel-indicator-airpods/raw/master/data/screenshot_1.png
+ https://github.com/casasfernando/wingpanel-indicator-airpods/raw/master/data/screenshots/screenshot_1.png
- https://github.com/casasfernando/wingpanel-indicator-airpods/raw/master/data/screenshot_2.png
+ https://github.com/casasfernando/wingpanel-indicator-airpods/raw/master/data/screenshots/screenshot_2.png
- https://github.com/casasfernando/wingpanel-indicator-airpods/raw/master/data/screenshot_3.png
+ https://github.com/casasfernando/wingpanel-indicator-airpods/raw/master/data/screenshots/screenshot_3.png
- https://github.com/casasfernando/wingpanel-indicator-airpods/raw/master/data/screenshot_4.png
+ https://github.com/casasfernando/wingpanel-indicator-airpods/raw/master/data/screenshots/screenshot_4.png
- https://github.com/casasfernando/wingpanel-indicator-airpods/raw/master/data/screenshot_5.png
+ https://github.com/casasfernando/wingpanel-indicator-airpods/raw/master/data/screenshots/screenshot_5.png
- https://github.com/casasfernando/wingpanel-indicator-airpods/raw/master/data/screenshot_6.png
+ https://github.com/casasfernando/wingpanel-indicator-airpods/raw/master/data/screenshots/screenshot_6.png
- https://github.com/casasfernando/wingpanel-indicator-airpods/raw/master/data/screenshot_7.png
+ https://github.com/casasfernando/wingpanel-indicator-airpods/raw/master/data/screenshots/screenshot_7.png
- https://github.com/casasfernando/wingpanel-indicator-airpods/raw/master/data/screenshot_8.png
+ https://github.com/casasfernando/wingpanel-indicator-airpods/raw/master/data/screenshots/screenshot_8.png
Fernando Casas Schössow
diff --git a/data/com.github.casasfernando.wingpanel-indicator-airpods.gresource.xml b/data/com.github.casasfernando.wingpanel-indicator-airpods.gresource.xml
new file mode 100644
index 0000000..cab35b4
--- /dev/null
+++ b/data/com.github.casasfernando.wingpanel-indicator-airpods.gresource.xml
@@ -0,0 +1,12 @@
+
+
+
+ Application.css
+ icons/airpods-symbolic.svg
+ icons/airpods-left-symbolic.svg
+ icons/airpods-right-symbolic.svg
+ icons/airpods-case-symbolic.svg
+ icons/airpods-connected-symbolic.svg
+ icons/airpods-disconnected-symbolic.svg
+
+
diff --git a/data/icons/icons.indicator.gresource.xml b/data/icons/icons.indicator.gresource.xml
deleted file mode 100644
index bbce53f..0000000
--- a/data/icons/icons.indicator.gresource.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
- Application.css
- airpods-symbolic.svg
- airpods-left-symbolic.svg
- airpods-right-symbolic.svg
- airpods-case-symbolic.svg
- airpods-connected-symbolic.svg
- airpods-disconnected-symbolic.svg
-
-
diff --git a/data/meson.build b/data/meson.build
index da0e77f..06a27f9 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,56 +1,37 @@
+# Install icons
icon_sizes = ['16', '24', '32', '48', '64', '128']
foreach i : icon_sizes
- install_data(
- join_paths('icons', i, meson.project_name() + '.svg'),
- install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', i + 'x' + i, 'apps')
- )
- install_data(
- join_paths('icons', i, meson.project_name() + '.svg'),
- install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', i + 'x' + i + '@2', 'apps')
- )
+ install_data (
+ join_paths ('icons', i, meson.project_name () + '.svg'),
+ install_dir: join_paths (get_option ('datadir'), 'icons', 'hicolor', i + 'x' + i, 'apps')
+ )
+ install_data (
+ join_paths ('icons', i, meson.project_name() + '.svg'),
+ install_dir: join_paths (get_option ('datadir'), 'icons', 'hicolor', i + 'x' + i + '@2', 'apps')
+ )
endforeach
-i18n.merge_file(
- input: meson.project_name() + '.desktop.in',
- output: meson.project_name() + '.desktop',
- po_dir: join_paths(meson.source_root(), 'po', 'extra'),
- type: 'desktop',
- install: true,
- install_dir: join_paths(get_option('datadir'), 'applications')
+# Translate and install our .desktop file so the Applications Menu will see it
+i18n.merge_file (
+ input: meson.project_name () + '.desktop.in',
+ output: meson.project_name () + '.desktop',
+ po_dir: join_paths (meson.source_root (), 'po', 'extra'),
+ type: 'desktop',
+ install: true,
+ install_dir: join_paths (get_option ('datadir'), 'applications')
)
-i18n.merge_file(
- input: meson.project_name() + '.appdata.xml.in',
- output: meson.project_name() + '.appdata.xml',
- po_dir: join_paths(meson.source_root(), 'po', 'extra'),
- install: true,
- install_dir: join_paths(get_option('datadir'), 'metainfo')
+# Translate and install our .appdata.xml file so AppCenter will see it
+i18n.merge_file (
+ input: meson.project_name () + '.appdata.xml.in',
+ output: meson.project_name () + '.appdata.xml',
+ po_dir: join_paths (meson.source_root (), 'po', 'extra'),
+ install: true,
+ install_dir: join_paths (get_option ('datadir'), 'metainfo')
)
-
-desktop_file_validate = find_program('desktop-file-validate', required:false)
-
-if desktop_file_validate.found()
- test (
- 'Validate desktop file',
- desktop_file_validate,
- args: join_paths(meson.current_build_dir (), meson.project_name() + '.desktop')
- )
-endif
-
-appstreamcli = find_program(['appstreamcli', 'appstream-util'], required:false)
-
-if appstreamcli.found()
- test (
- 'Validate appdata file',
- appstreamcli,
- args: ['validate', join_paths(meson.current_build_dir (), meson.project_name() + '.appdata.xml')]
- )
-endif
-
-install_data(
- meson.project_name() + '.gschema.xml',
- install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'glib-2.0', 'schemas')
+install_data (
+ meson.project_name () + '.gschema.xml',
+ install_dir: join_paths (get_option ('datadir'), 'glib-2.0', 'schemas')
)
-
diff --git a/data/screenshot_1.png b/data/screenshots/screenshot_1.png
similarity index 100%
rename from data/screenshot_1.png
rename to data/screenshots/screenshot_1.png
diff --git a/data/screenshot_2.png b/data/screenshots/screenshot_2.png
similarity index 100%
rename from data/screenshot_2.png
rename to data/screenshots/screenshot_2.png
diff --git a/data/screenshot_3.png b/data/screenshots/screenshot_3.png
similarity index 100%
rename from data/screenshot_3.png
rename to data/screenshots/screenshot_3.png
diff --git a/data/screenshot_4.png b/data/screenshots/screenshot_4.png
similarity index 100%
rename from data/screenshot_4.png
rename to data/screenshots/screenshot_4.png
diff --git a/data/screenshot_5.png b/data/screenshots/screenshot_5.png
similarity index 100%
rename from data/screenshot_5.png
rename to data/screenshots/screenshot_5.png
diff --git a/data/screenshot_6.png b/data/screenshots/screenshot_6.png
similarity index 100%
rename from data/screenshot_6.png
rename to data/screenshots/screenshot_6.png
diff --git a/data/screenshot_7.png b/data/screenshots/screenshot_7.png
similarity index 100%
rename from data/screenshot_7.png
rename to data/screenshots/screenshot_7.png
diff --git a/data/screenshot_8.png b/data/screenshots/screenshot_8.png
similarity index 100%
rename from data/screenshot_8.png
rename to data/screenshots/screenshot_8.png
diff --git a/meson.build b/meson.build
index 0deb47e..30b9e84 100644
--- a/meson.build
+++ b/meson.build
@@ -1,88 +1,95 @@
-project('com.github.casasfernando.wingpanel-indicator-airpods', 'vala', 'c')
+# Project name, programming language and version
+project (
+ 'com.github.casasfernando.wingpanel-indicator-airpods',
+ 'c', 'vala',
+ version: '0.4.7'
+)
+
+# GNOME module
+gnome = import ('gnome')
-gnome = import('gnome')
-i18n = import('i18n')
+# Translation module
+i18n = import ('i18n')
-add_project_arguments(['--vapidir', join_paths(meson.current_source_dir(), 'vapi')], language: 'vala')
-add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()), language:'c')
+# Project arguments
+add_project_arguments (
+ '-DGETTEXT_PACKAGE="@0@"'.format (meson.project_name ()),
+ language: 'c'
+)
-# common dirs
-prefix = get_option('prefix')
-datadir = join_paths(prefix, get_option('datadir'))
-libdir = join_paths(prefix, get_option('libdir'))
-icondir = join_paths(datadir, 'icons', 'hicolor')
+add_project_arguments (
+ ['--vapidir', join_paths (meson.current_source_dir (), 'vapi')],
+ language: 'vala'
+)
-# deps
-wingpanel = dependency('wingpanel')
+# Listing dependencies
+wingpanel = dependency ('wingpanel')
-icons_gresource = gnome.compile_resources(
- 'gresource_icons',
- 'data/icons/icons.indicator.gresource.xml',
- source_dir: 'data/icons',
+common_dependencies = [
+ dependency ('granite'),
+ dependency ('gtk+-3.0'),
+ dependency ('gee-0.8'),
+ dependency ('glib-2.0'),
+ dependency ('gobject-2.0'),
+ wingpanel
+]
+
+executable_dependencies = [
+ common_dependencies,
+ dependency ('libhandy-1'),
+ meson.get_compiler ('c').find_library ('m', required : false),
+ meson.get_compiler ('vala').find_library ('posix')
+]
+
+indicator_dependencies = [
+ common_dependencies,
+ dependency ('libnotify')
+]
+
+# Compiling resources
+asresources = gnome.compile_resources (
+ 'as-resources',
+ join_paths ('data', meson.project_name ()) + '.gresource.xml',
+ source_dir: 'data',
c_name: 'as'
)
-config_data = configuration_data()
-config_data.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+# Config
+config_data = configuration_data ()
+config_data.set_quoted ('GETTEXT_PACKAGE', meson.project_name ())
-configure_file(output: 'config.h', configuration: config_data)
-config_h_dir = include_directories('.')
+configure_file (output: 'config.h', configuration: config_data)
c_args = [
'-include', 'config.h',
'-w',
]
-executable(
- meson.project_name(),
- icons_gresource,
- 'src/Application.vala',
- 'src/MainWindow.vala',
- 'src/Widgets/ComboRow.vala',
- 'src/Widgets/SpinRow.vala',
- 'src/Widgets/Toggles.vala',
+subdir ('src')
+
+# Define executable
+executable (
+ meson.project_name (),
+ executable_sources,
+ asresources,
c_args: c_args,
- dependencies: [
- dependency('gee-0.8'),
- dependency('glib-2.0'),
- dependency('gobject-2.0'),
- dependency('granite'),
- dependency('gtk+-3.0'),
- dependency('libhandy-1'),
- wingpanel,
- meson.get_compiler('c').find_library('m', required : false),
- meson.get_compiler('vala').find_library('posix')
- ],
+ dependencies: executable_dependencies,
install: true
)
-shared_module(
+# Define indicator
+shared_module (
'wingpanel-indicator-airpods',
- 'src/Indicator.vala',
- 'src/Services/Airpods.vala',
- 'src/Services/Bluez.vala',
- 'src/Services/Dbus.vala',
- 'src/Services/Mpris.vala',
- 'src/Services/Upower.vala',
- 'src/Widgets/DisplayWidget.vala',
- 'src/Widgets/IndicatorWidget.vala',
- 'src/Widgets/PopoverWidget.vala',
- 'src/Widgets/PopoverWidgetRowIconic.vala',
- icons_gresource,
+ indicator_sources,
+ asresources,
c_args: c_args,
- dependencies: [
- dependency('gee-0.8'),
- dependency('glib-2.0'),
- dependency('gobject-2.0'),
- dependency('libnotify'),
- dependency('granite'),
- dependency('gtk+-3.0'),
- wingpanel,
- ],
+ dependencies: indicator_dependencies,
install: true,
- install_dir : wingpanel.get_pkgconfig_variable('indicatorsdir', define_variable: ['libdir', libdir]),
+ install_dir : wingpanel.get_pkgconfig_variable('indicatorsdir', define_variable: ['libdir', join_paths (get_option ('prefix'), get_option ('libdir'))]),
)
-subdir('data')
-subdir('po')
-meson.add_install_script('meson/post_install.py')
+
+subdir ('data')
+subdir ('po')
+
+meson.add_install_script ('meson/post_install.py')
diff --git a/meson/post_install.py b/meson/post_install.py
index 1c0ac73..64a5225 100644
--- a/meson/post_install.py
+++ b/meson/post_install.py
@@ -1,25 +1,17 @@
#!/usr/bin/env python3
-import os
+from os import path, environ
import subprocess
-prefix = os.environ.get('MESON_INSTALL_PREFIX', '/usr/local')
-datadir = os.path.join(prefix, 'share')
-schemadir = os.path.join(os.environ['MESON_INSTALL_PREFIX'], 'share', 'glib-2.0', 'schemas')
+prefix = environ.get('MESON_INSTALL_PREFIX', '/usr/local')
+schemadir = path.join(environ['MESON_INSTALL_PREFIX'], 'share', 'glib-2.0', 'schemas')
+datadir = path.join(prefix, 'share')
+desktop_database_dir = path.join(datadir, 'applications')
-# Packaging tools define DESTDIR and this isn't needed for them
-if 'DESTDIR' not in os.environ:
- print('Updating icon cache...')
- icon_cache_dir = os.path.join(datadir, 'icons', 'hicolor')
- if not os.path.exists(icon_cache_dir):
- os.makedirs(icon_cache_dir)
- subprocess.call(['gtk-update-icon-cache', '-qtf', icon_cache_dir])
-
- print('Updating desktop database...')
- desktop_database_dir = os.path.join(datadir, 'applications')
- if not os.path.exists(desktop_database_dir):
- os.makedirs(desktop_database_dir)
+if not environ.get('DESTDIR'):
+ print('Compiling gsettings schemas…')
+ subprocess.call(['glib-compile-schemas', schemadir])
+ print('Updating desktop database…')
subprocess.call(['update-desktop-database', '-q', desktop_database_dir])
-
- print('Compiling gsettings schemas...')
- subprocess.call(['glib-compile-schemas', schemadir])
\ No newline at end of file
+ print('Updating icon cache…')
+ subprocess.call(['gtk-update-icon-cache', '-qtf', path.join(datadir, 'icons', 'hicolor')])
diff --git a/po/extra/meson.build b/po/extra/meson.build
index c296095..40dde32 100644
--- a/po/extra/meson.build
+++ b/po/extra/meson.build
@@ -1,5 +1,8 @@
-i18n.gettext('extra',
- args: '--directory=' + meson.source_root(),
- preset: 'glib',
- install: false
+# Install metadata translations
+i18n.gettext ('extra',
+ args: [
+ '--directory=' + meson.source_root (),
+ '--from-code=UTF-8'
+ ],
+ install: false
)
diff --git a/po/meson.build b/po/meson.build
index fd7edee..f0ac581 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -1,6 +1,10 @@
-i18n.gettext(meson.project_name(),
- args: '--directory=' + meson.source_root(),
- preset: 'glib'
+# Install main translations
+i18n.gettext (meson.project_name (),
+ args: [
+ '--directory=' + meson.source_root (),
+ '--from-code=UTF-8',
+ '-cTRANSLATORS'
+ ]
)
subdir ('extra')
diff --git a/src/Indicator.vala b/src/Indicator.vala
index 03d7311..60e7289 100644
--- a/src/Indicator.vala
+++ b/src/Indicator.vala
@@ -46,7 +46,7 @@ namespace WingpanelAirPods {
construct {
var provider = new Gtk.CssProvider ();
- provider.load_from_resource ("/com/github/casasfernando/wingpanel-indicator-airpods/icons/Application.css");
+ provider.load_from_resource ("/com/github/casasfernando/wingpanel-indicator-airpods/Application.css");
Gtk.StyleContext.add_provider_for_screen (
Gdk.Screen.get_default (),
provider,
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..cd6b280
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,23 @@
+executable_sources = files (
+ 'Application.vala',
+ 'MainWindow.vala',
+
+ 'Widgets/ComboRow.vala',
+ 'Widgets/SpinRow.vala',
+ 'Widgets/Toggles.vala'
+)
+
+indicator_sources = files (
+ 'Indicator.vala',
+
+ 'Services/Airpods.vala',
+ 'Services/Bluez.vala',
+ 'Services/Dbus.vala',
+ 'Services/Mpris.vala',
+ 'Services/Upower.vala',
+
+ 'Widgets/DisplayWidget.vala',
+ 'Widgets/IndicatorWidget.vala',
+ 'Widgets/PopoverWidget.vala',
+ 'Widgets/PopoverWidgetRowIconic.vala'
+)