[gnome-music/wip/cdavis/about-window] application: Port about to AdwAboutWindow




commit bb134b9ecd32a3204e87f97c6acbbcf5d885a7ea
Author: Christopher Davis <christopherdavis gnome org>
Date:   Thu Jul 7 18:49:52 2022 -0400

    application: Port about to AdwAboutWindow
    
    AdwAboutWindow doesn't support subclassing,
    so move the definition to application.py.

 data/meson.build                   |   3 +-
 data/org.gnome.Music.gresource.xml |   1 -
 data/ui/AboutDialog.ui.in          | 226 ---------------------------------
 data/ui/meson.build                |  24 ----
 gnome-music.in                     |   4 +-
 gnomemusic/about.py                | 251 +++++++++++++++++++++++++++++++++++++
 gnomemusic/application.py          |   9 +-
 meson.build                        |  17 ++-
 8 files changed, 273 insertions(+), 262 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index cbc6233a3..e67c1a31e 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -6,8 +6,7 @@ gnome.compile_resources(
   gresource_bundle: true,
   source_dir: meson.current_build_dir(),
   install_dir: PKGDATA_DIR,
-  install: true,
-  dependencies: about_dialog
+  install: true
 )
 
 schema_src = PROJECT_RDNN_NAME + '.gschema.xml'
diff --git a/data/org.gnome.Music.gresource.xml b/data/org.gnome.Music.gresource.xml
index 2be39220b..77029c6d6 100644
--- a/data/org.gnome.Music.gresource.xml
+++ b/data/org.gnome.Music.gresource.xml
@@ -4,7 +4,6 @@
     <file alias="gtk/help-overlay.ui" preprocess="xml-stripblanks">ui/help-overlay.ui</file>
     <file>style.css</file>
     <file>icons/welcome-music.svg</file>
-    <file preprocess="xml-stripblanks">ui/AboutDialog.ui</file>
     <file preprocess="xml-stripblanks">ui/AlbumCover.ui</file>
     <file preprocess="xml-stripblanks">ui/AlbumCoverListItem.ui</file>
     <file preprocess="xml-stripblanks">ui/AlbumWidget.ui</file>
diff --git a/gnome-music.in b/gnome-music.in
index 3cc186f00..7f69c1b06 100755
--- a/gnome-music.in
+++ b/gnome-music.in
@@ -51,7 +51,7 @@ Adw.init()
 
 LOCALE_DIR = '@localedir@'
 PKGDATA_DIR = '@pkgdatadir@'
-
+VERSION = '@version@'
 
 def set_exception_hook():
     """Configures sys.excepthook to enforce Gtk application exiting."""
@@ -92,7 +92,7 @@ def run_application():
     """Runs GNOME Music application and returns its exit code."""
     from gnomemusic.application import Application
 
-    app = Application('@application_id@')
+    app = Application('@application_id@', VERSION)
     signal.signal(signal.SIGINT, signal.SIG_DFL)
     return app.run(sys.argv)
 
diff --git a/gnomemusic/about.py b/gnomemusic/about.py
new file mode 100644
index 000000000..a2be02589
--- /dev/null
+++ b/gnomemusic/about.py
@@ -0,0 +1,251 @@
+# aboutwindow.py
+#
+# Copyright 2022 Christopher Davis <christopherdavis gnome org>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+from gettext import gettext as _
+
+from gi.repository import Adw, Gtk
+
+
+def show_about(app_id, version, parent):
+    developers = [
+        "Abhinav Singh",
+        "Adam Blanchet",
+        "Adrian Solom",
+        "Alberto Fanjul",
+        "Alexander Mikhaylenko",
+        "Andre Klapper",
+        "Andreas Nilsson",
+        "Apostol Bakalov",
+        "Arnel A. Borja",
+        "Ashwani Singh Tanwar",
+        "Ashwin Mohan",
+        "Atharva Veer",
+        "Benoît Legat",
+        "Bilal Elmoussaoui",
+        "Billy Barrow",
+        "Bruce Cowan",
+        "Carlos Garnacho",
+        "Carlos Soriano",
+        "Chinmay Gurjar",
+        "Christophe van den Abbeele",
+        "Christopher Davis",
+        "Clayton G. Hobbs",
+        "Divyanshu Vishwakarma",
+        "Eslam Mostafa",
+        "Elias Entrup",
+        "Erik Inkinen",
+        "Evan Nehring",
+        "Evandro Giovanini",
+        "Fabiano Fidêncio",
+        "Felipe Borges",
+        "Florian Darfeuille",
+        "Gaurav Narula",
+        "Georges Basile Stavracas Neto",
+        "Guillaume Quintard",
+        "Gyanesh Malhotra",
+        "Harry Xie",
+        "Hugo Posnic",
+        "Ishaan Shah",
+        "Islam Bahnasy",
+        "Jakub Steiner",
+        "James A. Baker",
+        "Jan Alexander Steffens",
+        "Janne Körkkö",
+        "Jan-Michael Brummer",
+        "Jean Felder",
+        "Jeremy Bicha",
+        "Jesus Bermudez Velazquez",
+        "Jordan Petridis",
+        "Juan José González",
+        "Juan Suarez",
+        "Kainaat Singh",
+        "Kalev Lember",
+        "Kevin Haller",
+        "Konstantin Pospelov",
+        "Koushik Sahu",
+        "Lucy Coleclough",
+        "Marinus Schraal",
+        "Michael Catanzaro",
+        "Mohanna Datta Yelugoti",
+        "Nick Richards",
+        "Niels De Graef",
+        "Nikolay Yanchuk",
+        "Nils Reuße",
+        "Pablo Palácios",
+        "Phil Dawson",
+        "Piotr Drąg",
+        "Prashant Tyagi",
+        "Rafael Coelho",
+        "Rashi Sah",
+        "Rasmus Thomsen",
+        "Reuben Dsouza",
+        "Robert Greener",
+        "Sabri Ünal",
+        "Sagar Lakhani",
+        "Sai Suman Prayaga",
+        "Sam Hewitt",
+        "Sam Thursfield",
+        "Sambhav Kothari",
+        "Seif Lotfy",
+        "Shivani Poddar",
+        "Shivansh Handa",
+        "Simon McVittie",
+        "Sophie Herold",
+        "Subhadip Jana",
+        "Sumaid Syed",
+        "Suyash Garg",
+        "Tapasweni Pathak",
+        "Taylor Garcia",
+        "Tjipke van der Heide",
+        "Vadim Rutkovsky",
+        "Veerasamy Sevagen",
+        "Vineet Reddy",
+        "Weifang Lai",
+        "Yann Delaby",
+        "Yash Singh",
+        "Yosef Or Boczko"
+    ]
+
+    designers = [
+        "Allan Day",
+        "Jakub Steiner",
+        "William Jon McCann"
+    ]
+
+    translators = [
+        "Adolfo Jayme Barrientos",
+        "அருள்ராஜன் அ லை",
+        "A S Alam",
+        "Alain Lojewski",
+        "Alan Mortensen",
+        "Aleksandr Melman",
+        "Alexander Shopov",
+        "Alexandre Franke",
+        "Alexey Rubtsov",
+        "Anders Jonsson",
+        "Andika Triwidada",
+        "Anish Sheela",
+        "Arash Mousavi",
+        "Asier Sarasua Garmendia",
+        "Ask Hjorth Larsen",
+        "Aurimas Černius",
+        "Balázs Meskó",
+        "Balázs Úr",
+        "Baurzhan Muftakhidinov",
+        "Bruce Cowan",
+        "Boyuan Yang",
+        "Carmen Bianca Bakker",
+        "Cédric Valmary",
+        "Chao-Hsiung Liao",
+        "Charles Monzat",
+        "Cheng Lu",
+        "Cheng-Chia Tseng",
+        "Claude Paroz",
+        "Danial Behzadi",
+        "Daniel Korostil",
+        "Daniel Mustieles García",
+        "Daniel Șerbănescu",
+        "David King",
+        "Dušan Kazik",
+        "Efstathios Iosifidis",
+        "Emin Tufan Çetin",
+        "Enrico Nicoletto",
+        "Fábio Nogueira",
+        "Fabio Tomat",
+        "Florentina Mușat",
+        "Fran Diéguez",
+        "Furkan Tokaç",
+        "Gábor Kelemen",
+        "Gil Forcada Codinachs",
+        "Goran Vidović",
+        "Guillaume Bernard",
+        "Henrique Machado Campos",
+        "Hugo Carvalho",
+        "Inaki Larranaga Murgoitio",
+        "Jiri Grönroos",
+        "Joe Hansen",
+        "Jor Teron",
+        "Jordi Mas",
+        "Juliano Camargo",
+        "Julien Humbert",
+        "Justin van Steijn",
+        "Kjartan Maraas",
+        "Kristjan Schmidt",
+        "Kukuh Syafaat",
+        "Luna Jernberg",
+        "Марко Костић",
+        "Marek Černocký",
+        "Mario Blättermann",
+        "Matej Urbančič",
+        "Matheus Barbosa",
+        "Milo Casagrande",
+        "Mingcong Bai",
+        "Mpho Jele",
+        "Мирослав Николић",
+        "Милош Поповић",
+        "Nathan Follens",
+        "Osman Karagöz",
+        "Petr Kovář",
+        "Philipp Kiemle",
+        "Piotr Drąg",
+        "Quentin Pagès",
+        "Rafael Fontenelle",
+        "Rodrigo Lledó Milanca",
+        "Rūdolfs Mazurs",
+        "Ryuta Fujii",
+        "Rūdolfs Mazurs",
+        "Sabri Ünal",
+        "Sebastian Rasmussen",
+        "Seong-ho Cho",
+        "Stas Solovey",
+        "Sveinn í Felli",
+        "Tiago Santos",
+        "Tim Sabsch",
+        "Tjipke van der Heide",
+        "Tom Tryfonidis",
+        "Trần Ngọc Quân",
+        "Vinzenz Vietzke",
+        "Xavi Ivars",
+        "Yaron Shahrabani",
+        "Yi-Jyun Pan",
+        "Yosef Or Boczko",
+        "Yuras Shumovich",
+        "Yuri Chornoivan",
+        "Yuri Myasoedov",
+        "Zander Brown",
+        "Zmicer Turok",
+    ]
+
+    about = Adw.AboutWindow(
+        application_name=_("Music"),
+        application_icon=app_id,
+        developer_name=_("The GNOME Project"),
+        transient_for=parent,
+        developers=developers,
+        designers=designers,
+        translator_credits=_("translator-credits"),
+        version=version,
+        website="https://wiki.gnome.org/Apps/Music";,
+        issue_url="https://gitlab.gnome.org/GNOME/gnome-music/-/issues/new";,
+        copyright=_("Copyright The GNOME Music Developers"),
+        license_type=Gtk.License.GPL_2_0)
+
+    about.add_credit_section(_("Translated by"), translators)
+
+    about.present()
diff --git a/gnomemusic/application.py b/gnomemusic/application.py
index 30ba7606d..dc6cbe187 100644
--- a/gnomemusic/application.py
+++ b/gnomemusic/application.py
@@ -35,6 +35,7 @@ from gettext import gettext as _
 
 from gi.repository import Adw, Gtk, Gio, GLib, Gdk, GObject
 
+from gnomemusic.about import show_about
 from gnomemusic.coregrilo import CoreGrilo
 from gnomemusic.coremodel import CoreModel
 from gnomemusic.coreselection import CoreSelection
@@ -46,14 +47,13 @@ from gnomemusic.pauseonsuspend import PauseOnSuspend
 from gnomemusic.player import Player
 from gnomemusic.scrobbler import LastFmScrobbler
 from gnomemusic.search import Search
-from gnomemusic.widgets.aboutdialog import AboutDialog
 from gnomemusic.widgets.lastfmdialog import LastfmDialog
 from gnomemusic.window import Window
 
 
 class Application(Adw.Application):
 
-    def __init__(self, application_id):
+    def __init__(self, application_id, version):
         super().__init__(
             application_id=application_id,
             flags=Gio.ApplicationFlags.FLAGS_NONE)
@@ -62,6 +62,7 @@ class Application(Adw.Application):
         GLib.set_prgname(application_id)
         GLib.setenv("PULSE_PROP_media.role", "music", True)
 
+        self._version = version
         self._window = None
 
         self._log = MusicLogger()
@@ -225,9 +226,7 @@ class Application(Adw.Application):
         self._lastfm_dialog.present()
 
     def _about(self, action, param):
-        about = AboutDialog()
-        about.props.transient_for = self._window
-        about.present()
+        show_about(self.props.application_id, self._version, self._window)
 
     def do_startup(self):
         Adw.Application.do_startup(self)
diff --git a/meson.build b/meson.build
index b3892a2d7..02cbbb2b3 100644
--- a/meson.build
+++ b/meson.build
@@ -39,13 +39,26 @@ APPLICATION_ID = 'org.gnome.Music@0@'.format(PROFILE)
 PYTHON_DIR = py_installation.get_path('purelib')
 PKGDATA_DIR = join_paths(get_option('prefix'), get_option('datadir'), APPLICATION_ID)
 PKGLIB_DIR = join_paths(get_option('prefix'), get_option('libdir'), APPLICATION_ID)
+VCS_TAG = ''
+if get_option('profile') != 'default'
+  git = find_program('git', required : false)
+  if git.found()
+    VCS_TAG = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip()
+  endif
+  if VCS_TAG == ''
+    VCS_TAG = '-devel'
+  else
+    VCS_TAG = '-@0@'.format(VCS_TAG)
+  endif
+endif
+
 
 # Dependencies
 dependency('glib-2.0', version: '>= 2.67.1')
 dependency('goa-1.0', version: '>= 3.35.90')
 dependency('gobject-introspection-1.0', version: '>= 1.35.0')
 dependency('gtk4', version: '>= 4.5.0')
-dependency('libadwaita-1', version: '>= 1.0')
+dependency('libadwaita-1', version: '>= 1.2.alpha')
 dependency('libmediaart-2.0', version: '>= 1.9.1')
 dependency('libsoup-2.4')
 dependency('tracker-sparql-3.0', version: '>= 2.99.3')
@@ -55,7 +68,6 @@ dependency('py3cairo', version: '>= 1.14.0')
 dependency('grilo-0.3', version: '>= 0.3.13', fallback: ['grilo', 'libgrl_dep'])
 dependency('grilo-plugins-0.3', version: '>= 0.3.12', fallback: ['grilo-plugins', 'grilo_plugins_dep'])
 
-subdir('data/ui')
 subdir('data')
 subdir('help')
 subdir('po')
@@ -73,6 +85,7 @@ bin_config.set('pkgdatadir', PKGDATA_DIR)
 bin_config.set('localedir', join_paths(get_option('prefix'), get_option('datadir'), 'locale'))
 bin_config.set('pythondir', PYTHON_DIR)
 bin_config.set('schemasdir', PKGDATA_DIR)
+bin_config.set('version', meson.project_version() + VCS_TAG)
 
 bin_config.set('local_build', 'False')
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]