diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 23ae2401..00000000 --- a/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Julian Geywitz diff --git a/data/ui/about.ui b/AUTHORS.md similarity index 52% rename from data/ui/about.ui rename to AUTHORS.md index 468226d9..5a62de27 100644 --- a/data/ui/about.ui +++ b/AUTHORS.md @@ -1,42 +1,43 @@ - - - - - Cozy - com.github.geigi.cozy - gpl-3-0 - https://github.com/geigi/cozy/issues/new - https://github.com/geigi/cozy - geigi - geigi -A6GibKm -alyssais -apandada1 -AsavarTzeth -Fatih20 -NathanBnm -camellan -chris-kobrzak -elya5 -foliva -grenade -jimmac -jnbr -jubalh -kaphula -leuc -magnickolas -meisenzahl -naglis -oleg-krv -paper42 -phpwutz -rapenne-s -rdbende -thibaultamartin -umeboshi2 -worldofpeace - Ainte +# Code +- Julian Geywitz +- Benedek Dévényi +- A6GibKm +- alyssais +- apandada1 +- AsavarTzeth +- Fatih20 +- NathanBnm +- camellan +- chris-kobrzak +- elya5 +- foliva +- grenade +- jnbr +- jubalh +- kaphula +- leuc +- magnickolas +- meisenzahl +- naglis +- oleg-krv +- paper42 +- phpwutz +- rapenne-s +- thibaultamartin +- umeboshi2 +- worldofpeace + +# Design +- Julian Geywitz +- Tobias Bernard +- Benedek Dévényi + +# Icon +- Jakub Steiner + +# Translators +``` +Ainte AndreBarata Andrey389 Asyx @@ -136,6 +137,5 @@ useruseruser1233211 vanhoxx vlabo xfgusta -yalexaner - - +yalexaner +``` diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 5438dabe..eb661f79 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -1,14 +1,27 @@ # Cozy development -This document is intended for software engineers and translators who would like to help out with the development of Cozy or simply be able to run bleeding edge versions of the code locally. +This document is intended for software engineers and translators who would like to help out with the development of Cozy, or simply be able to run bleeding edge versions of the code locally. -## Ubuntu -_The below instructions have been tested on Ubuntu 20.04_ +## Building with GNOME Builder (recommended) -## Requirements +Cozy can be built and run with [GNOME Builder](https://apps.gnome.org/Builder/). -```bash +1. Open GNOME Builder +2. Click the **Clone Repository** button +3. Enter `https://github.com/geigi/cozy.git` in the **Repository URL** field +4. Click the **Clone Project** button +5. Click the ▶️**Run** button to start building the application + + +## Building manually + +_The below instructions have been tested on Ubuntu 20.04 and Fedora 39_ + + +### Requirements (Ubuntu) + +```console sudo apt update sudo apt install \ appstreamcli \ @@ -21,86 +34,99 @@ sudo apt install \ gstreamer1.0-plugins-ugly \ libgirepository1.0-dev \ libgstreamer1.0-0 \ - libgtk-3-dev \ + libgtk-4-dev \ + libadwaita-1-dev \ pip \ python-gi-cairo \ python3-gst-1.0 \ python3-venv - -sudo add-apt-repository ppa:apandada1/libhandy-1 -sudo apt update -sudo apt install libhandy-1-0 libhandy-1-dev ``` -In case of issues with the `libhandy` installation, please refer to our [GitHub build script](.github/workflows/build.yml) on an alternative source of the library packages. -### UI development +### Requirements (Fedora) -[Glade](https://glade.gnome.org/) is the GUI tool we have been using for generating and managing application [windows and widgets](data/ui/). +```console +sudo dnf install \ + appstream \ + cmake \ + gettext \ + gstreamer1-libav \ + gstreamer1-plugins-ugly \ + gstreamer1-plugins-bad \ + gstreamer1-plugins-good \ + gstreamer1-devel\ + gtk4-devel \ + libadwaita-devel \ + pipenv \ + python3-cairo-devel \ + python3-gstreamer1 +``` -## Source code -```bash +### Source code + +```console git clone https://github.com/geigi/cozy.git cd cozy ``` -## Python packages -It is generally a good idea to set up a virtual environment to avoid referencing packages and the Python binary installed globally. +### Python packages -> At its core, the main purpose of Python virtual environments is to create an isolated environment for Python projects. This means that each project can have its own dependencies, regardless of what dependencies every other project has. -> -> realpython.com +> [!TIP] +> It is generally a good idea to set up a virtual environment for Python projects. It creates an isolated environment where packages can be installed without creating conflicts with other packages installed system-wide. -```bash -# only if you wish to use a virtual environment +```console python3 -m venv venv source ./venv/bin/activate python -m pip install --upgrade pip pip install -r requirements.txt -pip install \ - meson \ - ninja +pip install meson ninja -pip install \ - pytest \ - pytest-mock +pip install pytest pytest-mock ``` -## Build and install +To enter the virtual environment, you will need to run `source ./venv/bin/activate` every time you reopen your terminal. + + +### Build and install Let's assume you wish to build the application under the `build/` directory and install the binaries under `app/`: -```bash -meson --prefix=$(pwd)/app ./build +```console +meson setup --prefix=$(pwd)/app ./build ninja -C build install ``` + ### Install translation files -```bash +```console ninja -C build com.github.geigi.cozy-update-po ninja -C build extra-update-po ``` -## Run application -```bash +### Run application + +```console XDG_DATA_DIRS=app/share:/usr/share \ -PYTHONPATH=app/lib/python3.8/site-packages \ +PYTHONPATH=app/lib/python3.11/site-packages \ app/bin/com.github.geigi.cozy ``` Your Python path may be different so you might need to amend the `PYTHONPATH` environment variable above in case of errors. -Please note, every time you make code changes, you need to execute `ninja -C build install` before you run the application. +> [!NOTE] +> Every time you make changes to the code, you need to execute `ninja -C build install` before you run the application. -## Test + +## Running the test suite ```bash python -m pytest -``` \ No newline at end of file +``` + diff --git a/README.md b/README.md index 9da89caa..3f78995b 100644 --- a/README.md +++ b/README.md @@ -235,7 +235,7 @@ The translators: - karaagac - kevinmueller - leondorus -- libreajans +- Sabri Unal - linuxmasterclub - magnickolas - makaleks diff --git a/com.github.geigi.cozy.json b/com.github.geigi.cozy.json index e7423997..2cf117f8 100644 --- a/com.github.geigi.cozy.json +++ b/com.github.geigi.cozy.json @@ -114,6 +114,7 @@ { "name": "cozy", "buildsystem": "meson", + "run-tests": true, "sources": [ { "type": "dir", diff --git a/cozy/ui/main_view.py b/cozy/ui/main_view.py index f26610e4..bb2593a0 100644 --- a/cozy/ui/main_view.py +++ b/cozy/ui/main_view.py @@ -2,6 +2,7 @@ import os import webbrowser from threading import Thread +from collections import defaultdict from gi.repository import Adw, Gtk, Gio, Gdk, GLib, GObject @@ -76,12 +77,13 @@ def __init_resources(self): os.path.join(self.pkgdir, 'com.github.geigi.cozy.img.gresource')) Gio.Resource._register(resource) + self.appdata_resource = Gio.resource_load( + os.path.join(self.pkgdir, 'com.github.geigi.cozy.appdata.gresource')) + Gio.Resource._register(self.appdata_resource) + self.window_builder = Gtk.Builder.new_from_resource( "/com/github/geigi/cozy/main_window.ui") - self.about_builder = Gtk.Builder.new_from_resource( - "/com/github/geigi/cozy/about.ui") - self.window: Gtk.Window = self.window_builder.get_object("app_window") def __init_window(self): @@ -110,13 +112,6 @@ def __init_window(self): self.navigation_view: Adw.NavigationView = self.window_builder.get_object("navigation_view") self.drop_revealer: Gtk.Revealer = self.window_builder.get_object("drop_revealer") - self.about_dialog = self.about_builder.get_object("about_dialog") - self.about_dialog.set_modal(self.window) - self.about_dialog.connect("close-request", self.hide_window) - self.about_dialog.set_version(self.version) - - self._preferences = PreferencesView() - self.window.present() def __init_actions(self): @@ -127,6 +122,7 @@ def __init_actions(self): about_action = Gio.SimpleAction.new("about", None) about_action.connect("activate", self.about) self.app.add_action(about_action) + self.app.set_accels_for_action("app.about", ["F1"]) quit_action = Gio.SimpleAction.new("quit", None) quit_action.connect("activate", self.quit) @@ -181,49 +177,62 @@ def quit(self, action, parameter): self.on_close(None) self.app.quit() - def about(self, action, parameter): + def _get_contributors(self): + authors_file = self.appdata_resource.lookup_data("/com/github/geigi/cozy/authors", Gio.ResourceLookupFlags.NONE) + + current_section = "" + result = defaultdict(list) + for line in authors_file.get_data().decode().splitlines(): + if line.startswith("#"): + current_section = line[1:].strip().lower() + elif line.startswith("-"): + result[current_section].append(line[1:].strip()) + + return result + + def about(self, *junk): """ Show about window. """ - self.about_dialog.add_acknowledgement_section( + about = Adw.AboutWindow.new_from_appdata( + "/com/github/geigi/cozy/com.github.geigi.cozy.appdata.xml", + release_notes_version=self.version, + ) + + contributors = self._get_contributors() + about.set_developers(sorted(contributors["code"])) + about.set_designers(sorted(contributors["design"])) + about.set_artists(sorted(contributors["icon"])) + + about.set_license_type(Gtk.License.GPL_3_0) + + about.add_acknowledgement_section( _("Patreon Supporters"), ["Fred Warren", "Gabriel", "Hu Mann", "Josiah", "Oleksii Kriukov"] ) - self.about_dialog.add_acknowledgement_section( + about.add_acknowledgement_section( _("m4b chapter support in mutagen"), ("mweinelt",), ) - self.about_dialog.add_acknowledgement_section( + about.add_acknowledgement_section( _("Open Source Projects"), ("Lollypop music player https://gitlab.gnome.org/World/lollypop",), ) - self.about_dialog.add_legal_section( - "python-inject", - "© 2010 Ivan Korobkov", - Gtk.License.APACHE_2_0 - ) - self.about_dialog.present() + # Translators: Replace "translator-credits" with your names, one name per line + about.set_translator_credits(_("translator-credits")) + about.add_legal_section("python-inject", "© 2010 Ivan Korobkov", Gtk.License.APACHE_2_0) - def show_prefs(self, action, parameter): - """ - Show preferences window. - """ - self._preferences.show() + about.set_transient_for(self.window) + about.present() - def hide_window(self, widget, data=None): + def show_prefs(self, *_): """ - Hide a given window. This is used for the about and settings dialog - as they will never be closed only hidden. - - param widget: The widget that will be hidden. + Show preferences window. """ - widget.hide() + PreferencesView().present() - # we handeled the close event so the window must not get destroyed. - return True - - def play_pause(self, action, parameter): + def play_pause(self, *_): self._player.play_pause() def block_ui_buttons(self, block, scan=False): @@ -302,9 +311,6 @@ def _set_audiobook_path(self, path: str | None) -> None: self.scan(None, None) self.fs_monitor.init_offline_mode() - def __about_close_clicked(self, widget): - self.about_dialog.hide() - def on_close(self, widget, data=None): """ Close and dispose everything that needs to be when window is closed. diff --git a/cozy/ui/preferences_view.py b/cozy/ui/preferences_view.py index 6fd02e57..decca8ff 100644 --- a/cozy/ui/preferences_view.py +++ b/cozy/ui/preferences_view.py @@ -1,9 +1,9 @@ from typing import Any - from gi.repository import Adw, Gio, Gtk from cozy.ext import inject from cozy.ui.widgets.error_reporting import ErrorReporting + from cozy.ui.widgets.storages import StorageLocations from cozy.view_model.settings_view_model import SettingsViewModel @@ -12,8 +12,6 @@ class PreferencesView(Adw.PreferencesWindow): __gtype_name__ = "PreferencesWindow" - main_window = inject.attr("MainWindow") - _glib_settings: Gio.Settings = inject.attr(Gio.Settings) _view_model: SettingsViewModel = inject.attr(SettingsViewModel) @@ -31,7 +29,8 @@ class PreferencesView(Adw.PreferencesWindow): fadeout_duration_adjustment: Gtk.Adjustment = Gtk.Template.Child() def __init__(self, **kwargs: Any) -> None: - super().__init__(transient_for=self.main_window.window, **kwargs) + main_window = inject.instance("MainWindow") + super().__init__(transient_for=main_window.window, **kwargs) error_reporting = ErrorReporting() error_reporting.show_header(False) @@ -40,11 +39,8 @@ def __init__(self, **kwargs: Any) -> None: self.storage_locations_view = StorageLocations() self.storages_page.add(self.storage_locations_view) - self._bind_settings() - self._view_model.bind_to("lock_ui", self._on_lock_ui_changed) - - self.connect("close-request", self._hide_window) + self._bind_settings() def _bind_settings(self) -> None: self._glib_settings.bind( @@ -96,10 +92,4 @@ def _bind_settings(self) -> None: ) def _on_lock_ui_changed(self) -> None: - sensitive = not self._view_model.lock_ui - - self.storage_locations_view.set_sensitive(sensitive) - - def _hide_window(self, *_): - self.hide() - return True + self.storage_locations_view.set_sensitive(not self._view_model.lock_ui) diff --git a/data/com.github.geigi.cozy.appdata.xml b/data/com.github.geigi.cozy.appdata.xml index 889fd80a..6e8f6e18 100644 --- a/data/com.github.geigi.cozy.appdata.xml +++ b/data/com.github.geigi.cozy.appdata.xml @@ -44,7 +44,11 @@ https://raw.githubusercontent.com/geigi/cozy/img/img/screenshot4.png + Julian Geywitz + + Julian Geywitz + https://cozy.sh https://github.com/geigi/cozy/issues https://matrix.to/#/#cozy:gnome.org?via=matrix.org&via=gnome.org @@ -220,37 +224,8 @@ - - - none - none - none - none - none - none - none - none - none - none - none - none - none - none - none - none - none - none - none - none - none - none - none - none - none - none - none - - + + #FB6542 #FFFFFF diff --git a/data/gresource.xml b/data/gresource.xml new file mode 100644 index 00000000..79834c56 --- /dev/null +++ b/data/gresource.xml @@ -0,0 +1,8 @@ + + + + com.github.geigi.cozy.appdata.xml + ../AUTHORS.md + + + diff --git a/data/icons/hicolor/scalable/actions/account-symbolic.svg b/data/icons/hicolor/scalable/actions/account-symbolic.svg deleted file mode 100644 index 62c0f357..00000000 --- a/data/icons/hicolor/scalable/actions/account-symbolic.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/data/icons/hicolor/scalable/actions/bed-symbolic.svg b/data/icons/hicolor/scalable/actions/bed-symbolic.svg index 89731104..bfc2907b 100644 --- a/data/icons/hicolor/scalable/actions/bed-symbolic.svg +++ b/data/icons/hicolor/scalable/actions/bed-symbolic.svg @@ -1,106 +1,2 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/data/icons/hicolor/scalable/actions/check-plain-symbolic.svg b/data/icons/hicolor/scalable/actions/check-plain-symbolic.svg new file mode 100644 index 00000000..86c6a05a --- /dev/null +++ b/data/icons/hicolor/scalable/actions/check-plain-symbolic.svg @@ -0,0 +1,2 @@ + + diff --git a/data/icons/hicolor/scalable/actions/checkmark-symbolic.svg b/data/icons/hicolor/scalable/actions/checkmark-symbolic.svg deleted file mode 100644 index 69878794..00000000 --- a/data/icons/hicolor/scalable/actions/checkmark-symbolic.svg +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data/icons/hicolor/scalable/actions/clock-outline-symbolic.svg b/data/icons/hicolor/scalable/actions/clock-outline-symbolic.svg deleted file mode 100644 index 75a4b31c..00000000 --- a/data/icons/hicolor/scalable/actions/clock-outline-symbolic.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/data/icons/hicolor/scalable/actions/download-symbolic.svg b/data/icons/hicolor/scalable/actions/download-symbolic.svg index 67c94404..666a94f3 100644 --- a/data/icons/hicolor/scalable/actions/download-symbolic.svg +++ b/data/icons/hicolor/scalable/actions/download-symbolic.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + diff --git a/data/icons/hicolor/scalable/actions/downloaded-symbolic.svg b/data/icons/hicolor/scalable/actions/downloaded-symbolic.svg index 85c2bc80..df40e217 100644 --- a/data/icons/hicolor/scalable/actions/downloaded-symbolic.svg +++ b/data/icons/hicolor/scalable/actions/downloaded-symbolic.svg @@ -1,9 +1,2 @@ - - - - - - - - - \ No newline at end of file + + diff --git a/data/icons/hicolor/scalable/actions/harddisk-symbolic.svg b/data/icons/hicolor/scalable/actions/harddisk-symbolic.svg index 5ff3fc4b..17ffb678 100644 --- a/data/icons/hicolor/scalable/actions/harddisk-symbolic.svg +++ b/data/icons/hicolor/scalable/actions/harddisk-symbolic.svg @@ -1,109 +1,2 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/data/icons/hicolor/scalable/actions/info-symbolic.svg b/data/icons/hicolor/scalable/actions/info-symbolic.svg deleted file mode 100644 index f411fc00..00000000 --- a/data/icons/hicolor/scalable/actions/info-symbolic.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/data/icons/hicolor/scalable/actions/message-flash-symbolic.svg b/data/icons/hicolor/scalable/actions/message-flash-symbolic.svg deleted file mode 100644 index 7d975522..00000000 --- a/data/icons/hicolor/scalable/actions/message-flash-symbolic.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/data/icons/hicolor/scalable/actions/microphone-symbolic.svg b/data/icons/hicolor/scalable/actions/microphone-symbolic.svg deleted file mode 100644 index fbf0784a..00000000 --- a/data/icons/hicolor/scalable/actions/microphone-symbolic.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/data/icons/hicolor/scalable/actions/microphone2-symbolic.svg b/data/icons/hicolor/scalable/actions/microphone2-symbolic.svg new file mode 100644 index 00000000..a7224845 --- /dev/null +++ b/data/icons/hicolor/scalable/actions/microphone2-symbolic.svg @@ -0,0 +1,2 @@ + + diff --git a/data/icons/hicolor/scalable/actions/no-bed-symbolic.svg b/data/icons/hicolor/scalable/actions/no-bed-symbolic.svg index c7bd083b..b2d45da1 100644 --- a/data/icons/hicolor/scalable/actions/no-bed-symbolic.svg +++ b/data/icons/hicolor/scalable/actions/no-bed-symbolic.svg @@ -1,118 +1,2 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/data/icons/hicolor/scalable/actions/papyrus-vertical-symbolic.svg b/data/icons/hicolor/scalable/actions/papyrus-vertical-symbolic.svg index 5432a3c2..111f2458 100644 --- a/data/icons/hicolor/scalable/actions/papyrus-vertical-symbolic.svg +++ b/data/icons/hicolor/scalable/actions/papyrus-vertical-symbolic.svg @@ -1,106 +1,2 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/data/icons/hicolor/scalable/actions/person-symbolic.svg b/data/icons/hicolor/scalable/actions/person-symbolic.svg new file mode 100644 index 00000000..3f95cfbd --- /dev/null +++ b/data/icons/hicolor/scalable/actions/person-symbolic.svg @@ -0,0 +1,2 @@ + + diff --git a/data/icons/hicolor/scalable/actions/playback-speed-symbolic.svg b/data/icons/hicolor/scalable/actions/playback-speed-symbolic.svg index 122971ce..e1af2bc9 100644 --- a/data/icons/hicolor/scalable/actions/playback-speed-symbolic.svg +++ b/data/icons/hicolor/scalable/actions/playback-speed-symbolic.svg @@ -1,112 +1,2 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/data/icons/hicolor/scalable/actions/recent-symbolic.svg b/data/icons/hicolor/scalable/actions/recent-symbolic.svg new file mode 100644 index 00000000..c412fda9 --- /dev/null +++ b/data/icons/hicolor/scalable/actions/recent-symbolic.svg @@ -0,0 +1,4 @@ + + + + diff --git a/data/icons/hicolor/scalable/actions/settings-symbolic.svg b/data/icons/hicolor/scalable/actions/settings-symbolic.svg index 70f45e6f..4ac785e2 100644 --- a/data/icons/hicolor/scalable/actions/settings-symbolic.svg +++ b/data/icons/hicolor/scalable/actions/settings-symbolic.svg @@ -1,106 +1,2 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/data/meson.build b/data/meson.build index 7eb59a61..6a03c242 100644 --- a/data/meson.build +++ b/data/meson.build @@ -2,6 +2,15 @@ subdir('img') subdir('ui') subdir('icons') +gnome.compile_resources( + meson.project_name() + '.appdata', + 'gresource.xml', + gresource_bundle: true, + install_dir: DATA_DIR, + install: true, +) + + install_data( meson.project_name() + '.gschema.xml', install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas') @@ -17,7 +26,7 @@ endif desktop_file = i18n.merge_file( input: meson.project_name() + '.desktop', output: meson.project_name() + '.desktop', - po_dir: join_paths(meson.source_root(), 'po', 'extra'), + po_dir: join_paths(meson.current_source_dir(), 'po', 'extra'), type: 'desktop', install: true, install_dir: join_paths(get_option('datadir'), 'applications') @@ -33,7 +42,7 @@ endif appstream_file = i18n.merge_file( input: meson.project_name() + '.appdata.xml', output: meson.project_name() + '.appdata.xml', - po_dir: join_paths(meson.source_root(), 'po', 'extra'), + po_dir: join_paths(meson.current_source_dir(), 'po', 'extra'), install: true, install_dir: join_paths(get_option('datadir'), 'metainfo') ) @@ -41,6 +50,7 @@ appstream_file = i18n.merge_file( appstreamcli = find_program('appstreamcli', required: false) if appstreamcli.found() test('Validate appstream file', appstreamcli, - args: ['validate', '--no-net', appstream_file] + args: ['validate', '--no-net', '--explain', appstream_file], + workdir: meson.current_build_dir() ) endif diff --git a/data/ui/gresource.xml b/data/ui/gresource.xml index ad42a176..20228efd 100644 --- a/data/ui/gresource.xml +++ b/data/ui/gresource.xml @@ -2,7 +2,6 @@ style.css - about.ui album_element.ui book_detail.ui book_element.ui diff --git a/data/ui/main_window.ui b/data/ui/main_window.ui index 4a7c3f15..9e948bc9 100644 --- a/data/ui/main_window.ui +++ b/data/ui/main_window.ui @@ -60,7 +60,7 @@ recent Recent - clock-outline-symbolic + recent-symbolic Empty @@ -72,7 +72,7 @@ author Author - account-symbolic + person-symbolic sort_author_scroller @@ -104,7 +104,7 @@ reader Reader - microphone-symbolic + microphone2-symbolic true diff --git a/meson.build b/meson.build index 0d73029c..2a5b4e87 100644 --- a/meson.build +++ b/meson.build @@ -1,11 +1,11 @@ -project('com.github.geigi.cozy', version: '1.3.0') +project('com.github.geigi.cozy', version: '1.3.0', meson_version: '>= 0.59.0') -python = import('python3') +python = import('python') i18n = import('i18n') gnome = import('gnome') message('Looking for dependencies') -python_bin = python.find_python() +python_bin = python.find_installation('python3') if not python_bin.found() error('No valid python3 binary found') else @@ -13,16 +13,22 @@ else endif dependency('glib-2.0') -dependency('libadwaita-1', version: '>= 1.0.0') +dependency('libadwaita-1', version: '>= 1.4.0') # from https://github.com/AsavarTzeth/pulseeffects/blob/master/meson.build # Support Debian non-standard python paths -# Fallback to Meson python3 module if command fails +# Fallback to Meson python module if command fails message('Getting python install path') py3_purelib = '' -r = run_command(python_bin.path(), '-c', 'from distutils.sysconfig import get_python_lib; print(get_python_lib(prefix=""))') +r = run_command( + python_bin.full_path(), + '-c', + 'from distutils.sysconfig import get_python_lib; print(get_python_lib(prefix=""))', + check: false, +) + if r.returncode() != 0 - py3_purelib = python.sysconfig_path('purelib') + py3_purelib = python_bin.get_path('purelib') if not py3_purelib.endswith('site-packages') error('Cannot find python install path') endif @@ -37,7 +43,7 @@ python3_required_modules = ['distro', 'peewee', 'mutagen', 'gi'] foreach p : python3_required_modules # Source: https://docs.python.org/3/library/importlib.html#checking-if-a-module-can-be-imported script = 'import importlib.util; import sys; exit(1) if importlib.util.find_spec(\''+ p +'\') is None else exit(0)' - if run_command(python_bin, '-c', script).returncode() != 0 + if run_command(python_bin, '-c', script, check: false).returncode() != 0 error('Required Python3 module \'' + p + '\' not found') endif endforeach @@ -50,10 +56,10 @@ conf.set('PACKAGE_URL', 'https://github.com/geigi/cozy') conf.set('DATA_DIR', DATA_DIR) conf.set('LOCALE_DIR', join_paths(get_option('prefix'), get_option('datadir'), 'locale')) conf.set('PYTHON_DIR', python_dir) -conf.set('PYTHON_EXEC_DIR', join_paths(get_option('prefix'), python.sysconfig_path('stdlib'))) +conf.set('PYTHON_EXEC_DIR', join_paths(get_option('prefix'), python_bin.get_path('stdlib'))) conf.set('libexecdir', LIBEXEC_DIR) conf.set('VERSION', meson.project_version()) -conf.set('PYTHON', python_bin.path()) +conf.set('PYTHON', python_bin.full_path()) conf.set('INSTALLED', 'true') subdir('data') @@ -88,13 +94,8 @@ configure_file( install_dir: python_dir + '/cozy/report' ) -if meson.version().version_compare('>=0.57.0') - gnome.post_install( - glib_compile_schemas: true, - gtk_update_icon_cache: true, - ) -else - meson.add_install_script('meson/post_install_legacy.py') -endif - -meson.add_install_script('meson/post_install_desktop_database.py') \ No newline at end of file +gnome.post_install( + glib_compile_schemas: true, + gtk_update_icon_cache: true, + update_desktop_database: true, +) diff --git a/meson/post_install_desktop_database.py b/meson/post_install_desktop_database.py deleted file mode 100755 index ef348dc3..00000000 --- a/meson/post_install_desktop_database.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env python3 - -from os import environ, path -from subprocess import call - -prefix = environ.get('MESON_INSTALL_PREFIX', '/usr/local') -datadir = path.join(prefix, 'share') -destdir = environ.get('DESTDIR', '') - -print('Updating desktop database...') -call(['update-desktop-database', '-q', path.join(datadir, 'applications')]) \ No newline at end of file diff --git a/meson/post_install_legacy.py b/meson/post_install_legacy.py deleted file mode 100755 index 7eb2bf3c..00000000 --- a/meson/post_install_legacy.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python3 - -from os import environ, path -from subprocess import call - -prefix = environ.get('MESON_INSTALL_PREFIX', '/usr/local') -datadir = path.join(prefix, 'share') -destdir = environ.get('DESTDIR', '') - -# Package managers set this so we don't need to run -if not destdir: - print('Updating icon cache...') - call(['gtk-update-icon-cache', '-qtf', path.join(datadir, 'icons', 'hicolor')]) - - print('Compiling GSettings schemas...') - call(['glib-compile-schemas', path.join(datadir, 'glib-2.0', 'schemas')]) diff --git a/po/extra/meson.build b/po/extra/meson.build index 404605dd..d9851ffc 100644 --- a/po/extra/meson.build +++ b/po/extra/meson.build @@ -1,6 +1,6 @@ i18n.gettext('extra', args: [ - '--directory=' + meson.source_root(), + '--directory=' + meson.current_source_dir(), '--from-code=UTF-8' ], preset: 'glib', diff --git a/po/meson.build b/po/meson.build index 9e4ea075..a860fcc5 100644 --- a/po/meson.build +++ b/po/meson.build @@ -1,6 +1,6 @@ i18n.gettext(meson.project_name(), args: [ - '--directory=' + meson.source_root(), + '--directory=' + meson.current_source_dir(), '--from-code=UTF-8' ], preset: 'glib'