Skip to content

Commit 6581eb5

Browse files
committed
about window: show data from appdata file
1 parent 98811de commit 6581eb5

File tree

5 files changed

+36
-40
lines changed

5 files changed

+36
-40
lines changed

data/meson.build

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,6 @@ if desktop_file_validate.found()
2727
)
2828
endif
2929

30-
# Appdata
31-
appdata_conf = configuration_data()
32-
appdata_conf.set('app-id', application_id)
33-
appdata_conf.set('gettext-package', gettext_package)
34-
appdata_file = i18n.merge_file(
35-
input: configure_file(
36-
input: '@[email protected]'.format(base_id),
37-
output: '@BASENAME@',
38-
configuration: appdata_conf
39-
),
40-
output: '@[email protected]'.format(application_id),
41-
po_dir: podir,
42-
install: true,
43-
install_dir: datadir / 'metainfo'
44-
)
45-
# Validate Appdata
46-
if appstream_util.found()
47-
test(
48-
'validate-appdata', appstream_util,
49-
args: [
50-
'validate', '--nonet', appdata_file.full_path()
51-
],
52-
depends: appdata_file,
53-
)
54-
endif
55-
5630
# GSchema
5731
gschema_conf = configuration_data()
5832
gschema_conf.set('app-id', application_id)

data/com.ranfdev.Notify.metainfo.xml.in.in renamed to data/resources/com.ranfdev.Notify.metainfo.xml.in.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
</screenshots>
2323
<url type="homepage">https://github.com/ranfdev/Notify</url>
2424
<url type="bugtracker">https://github.com/ranfdev/Notify/issues</url>
25+
<url type="donation">https://github.com/sponsors/ranfdev</url>
26+
2527
<content_rating type="oars-1.0" />
2628
<releases>
2729
<release version="0.1.2" date="2023-11-07">

data/resources/meson.build

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,40 @@ blueprints = custom_target('blueprints',
1010
command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
1111
)
1212

13+
# Appdata
14+
appdata_conf = configuration_data()
15+
appdata_conf.set('app-id', application_id)
16+
appdata_conf.set('gettext-package', gettext_package)
17+
appdata_file = i18n.merge_file(
18+
input: configure_file(
19+
input: '@[email protected]'.format(base_id),
20+
output: '@BASENAME@',
21+
configuration: appdata_conf
22+
),
23+
output: 'metainfo.xml',
24+
po_dir: podir,
25+
install: true,
26+
install_dir: datadir / 'metainfo'
27+
)
28+
# Validate Appdata
29+
if appstream_util.found()
30+
test(
31+
'validate-appdata', appstream_util,
32+
args: [
33+
'validate', '--nonet', appdata_file.full_path()
34+
],
35+
depends: appdata_file,
36+
)
37+
endif
38+
1339
resources = gnome.compile_resources(
1440
'resources',
1541
'resources.gresource.xml',
1642
gresource_bundle: true,
1743
source_dir: meson.current_build_dir(),
1844
install: true,
1945
install_dir: pkgdatadir,
20-
dependencies: blueprints,
46+
dependencies: [blueprints, appdata_file],
2147
)
48+
49+

data/resources/resources.gresource.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<file compressed="true" preprocess="xml-stripblanks">ui/window.ui</file>
77
<file compressed="true" preprocess="xml-stripblanks">ui/subscription_info_dialog.ui</file>
88
<file compressed="true">style.css</file>
9-
9+
<file compressed="true">metainfo.xml</file>
1010
</gresource>
1111
<gresource prefix="/com/ranfdev/Notify/icons/16x16/status/">
1212
<file preprocess="xml-stripblanks" alias="dice3-symbolic.svg">../icons/dice3-symbolic.svg</file>

src/application.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use adw::subclass::prelude::*;
88
use capnp_rpc::{rpc_twoparty_capnp, twoparty, RpcSystem};
99
use futures::stream::Stream;
1010
use futures::AsyncReadExt;
11-
use gettextrs::gettext;
1211
use gio::SocketClient;
1312
use gio::UnixSocketAddress;
1413
use gtk::prelude::*;
@@ -207,17 +206,10 @@ impl NotifyApplication {
207206
}
208207

209208
fn show_about_dialog(&self) {
210-
let dialog = adw::AboutWindow::builder()
211-
.application_icon(APP_ID)
212-
.application_name("Notify")
213-
.license_type(gtk::License::Gpl30)
214-
.version(VERSION)
215-
.transient_for(&self.main_window())
216-
.translator_credits(gettext("translator-credits"))
217-
.modal(true)
218-
.developers(vec!["ranfdev"])
219-
.artists(vec!["ranfdev"])
220-
.build();
209+
let dialog = adw::AboutWindow::from_appdata("/com/ranfdev/Notify/metainfo.xml", None);
210+
if let Some(w) = self.imp().window.borrow().upgrade() {
211+
dialog.set_transient_for(Some(&w));
212+
}
221213

222214
dialog.present();
223215
}

0 commit comments

Comments
 (0)