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/cozy/ui/main_view.py b/cozy/ui/main_view.py index e0b2e20a..24e0f1a7 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 @@ -75,12 +76,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): @@ -112,13 +114,6 @@ def __init_window(self): self.no_media_file_chooser = self.window_builder.get_object("no_media_file_chooser") self.no_media_file_chooser.connect("clicked", self._open_audiobook_dir_selector) - 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): @@ -129,6 +124,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) @@ -179,49 +175,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): @@ -314,9 +323,6 @@ def _set_audiobook_path(self, path): 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 709488a1..3fa2ca0b 100644 --- a/cozy/ui/preferences_view.py +++ b/cozy/ui/preferences_view.py @@ -1,11 +1,9 @@ -from gi.repository import Gtk -from cozy.view_model.settings_view_model import SettingsViewModel -import gi -from gi.repository import Adw, Gio +from gi.repository import Adw, Gio, Gtk from cozy.ext import inject from cozy.ui.widgets.error_reporting import ErrorReporting from cozy.ui.widgets.storage_list_box_row import StorageListBoxRow +from cozy.view_model.settings_view_model import SettingsViewModel @Gtk.Template.from_resource('/com/github/geigi/cozy/preferences.ui') @@ -46,8 +44,6 @@ def __init__(self, **kwargs): self._bind_settings() self._bind_view_model() - self.connect("close-request", self._hide_window) - self.sleep_timer_fadeout_switch.connect("notify::active", self._on_sleep_fadeout_switch_changed) self.fadeout_duration_spin_button.set_sensitive(self.sleep_timer_fadeout_switch.props.active) @@ -159,7 +155,4 @@ def _on_lock_ui_changed(self): self.external_storage_toggle_button.set_sensitive(sensitive) self.default_storage_button.set_sensitive(sensitive) self._on_storage_box_changed(None, self.storage_list_box.get_selected_row()) - - def _hide_window(self, *_): - self.hide() - return True + 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/meson.build b/data/meson.build index a32d61bc..6100c09e 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') diff --git a/data/ui/gresource.xml b/data/ui/gresource.xml index 05828d20..51d9146d 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