about, appdata: Port to AdwAboutDialog.new_from_appdata

This removes a lot of duplicated code, as we can simply reuse the
appdata file. It will also allow us to add release notes without
needing to rewrite them. A simple update in the
`adw_about_dialog_new_from_appdata` method will take care of
displaying the release notes.

This also renames the appdata file from `appdata.xml` to
`metainfo.xml`, as `appdata.xml` is considered a legacy filename.
This commit is contained in:
Hari Rana
2024-04-26 12:56:14 +00:00
committed by Georges Basile Stavracas Neto
parent 704c0815a1
commit 0c8e1834f7
7 changed files with 36 additions and 21 deletions
-1
View File
@@ -1,5 +1,4 @@
subdir('icons')
subdir('appdata')
enum_headers = files(src_dir / 'gcal-enums.h')
+2 -1
View File
@@ -13,7 +13,7 @@ project(
calendar_version = meson.project_version()
version_array = calendar_version.split('.')
calendar_major_version = version_array[0].to_int()
calendar_major_version = version_array[0]
calendar_minor_version = version_array[1]
@@ -71,6 +71,7 @@ set_defines = [
['PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), calendar_version)],
['PACKAGE_TARNAME', meson.project_name()],
['PACKAGE_URL', 'https://apps.gnome.org/Calendar/'],
['MAJOR_VERSION', calendar_major_version + '.' + '0'],
['PACKAGE_VERSION', calendar_version + rev],
['VERSION', calendar_version + rev],
['GETTEXT_PACKAGE', meson.project_name()],
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/calendar">
<file alias="appdata">@appid@.metainfo.xml</file>
</gresource>
</gresources>
@@ -2,11 +2,11 @@ appdata_conf = configuration_data()
appdata_conf.set('appid', application_id)
appdata = i18n.merge_file(
input: configure_file(
input: files('org.gnome.Calendar.appdata.xml.in.in'),
output: 'org.gnome.Calendar.appdata.xml.in',
input: files('org.gnome.Calendar.metainfo.xml.in.in'),
output: 'org.gnome.Calendar.metainfo.xml.in',
configuration: appdata_conf
),
output: '@0@.appdata.xml'.format(application_id),
output: '@0@.metainfo.xml'.format(application_id),
po_dir: po_dir,
install: true,
install_dir: calendar_datadir / 'metainfo'
@@ -22,3 +22,17 @@ if appstreamcli.found()
depends: appdata,
)
endif
## GResource
gresource = configure_file(
input: 'appdata.gresource.xml.in',
output: 'appdata.gresource.xml',
configuration: appdata_conf,
)
built_sources += gnome.compile_resources(
'appdata-resources',
gresource,
c_name: 'appdata',
dependencies: [gresource, appdata],
)
@@ -56,6 +56,8 @@
<url type="vcs-browser">https://gitlab.gnome.org/GNOME/gnome-calendar</url>
<url type="translate">https://l10n.gnome.org/module/gnome-calendar/</url>
<url type="contribute">https://welcome.gnome.org/app/Calendar/</url>
<url type="contact">https://matrix.to/#/#gnome-calendar:gnome.org</url>
<url type="help">https://discourse.gnome.org/tag/calendar</url>
<project_group>GNOME</project_group>
<developer_name>The GNOME Project</developer_name>
<developer id="org.gnome">
+8 -16
View File
@@ -229,22 +229,14 @@ gcal_application_show_about (GSimpleAction *simple,
copyright = build_about_copyright (self);
troubleshooting = build_system_information ();
about = g_object_new (ADW_TYPE_ABOUT_DIALOG,
"application-name", _("Calendar"),
"application-icon", APPLICATION_ID,
"developer-name", _("The GNOME Project"),
"version", VERSION,
"copyright", copyright,
"website", "https://apps.gnome.org/Calendar/",
"issue-url", "https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues",
"support-url", "https://discourse.gnome.org/tag/calendar",
"license-type", GTK_LICENSE_GPL_3_0,
"developers", developers,
"designers", designers,
"translator-credits", _("translator-credits"),
"debug-info", troubleshooting,
"debug-info-filename", "Calendar.txt",
NULL);
about = adw_about_dialog_new_from_appdata ("/org/gnome/calendar/appdata", MAJOR_VERSION);
adw_about_dialog_set_designers (ADW_ABOUT_DIALOG (about), designers);
adw_about_dialog_set_copyright (ADW_ABOUT_DIALOG (about), copyright);
adw_about_dialog_set_developers (ADW_ABOUT_DIALOG (about), developers);
adw_about_dialog_set_debug_info (ADW_ABOUT_DIALOG (about), troubleshooting);
adw_about_dialog_set_debug_info_filename (ADW_ABOUT_DIALOG (about), "Calendar.txt");
adw_about_dialog_set_translator_credits (ADW_ABOUT_DIALOG (about), _("translator-credits"));
weather_service = gcal_context_get_weather_service (self->context);
adw_about_dialog_add_legal_section (ADW_ABOUT_DIALOG (about),
+1
View File
@@ -64,6 +64,7 @@ calendar_incs = [
###################
sources = files()
subdir('appdata')
subdir('core')
subdir('gui')
subdir('search')