This commit is contained in:
ranfdev
2023-10-08 16:10:49 +02:00
parent b5b31d6f8c
commit 7866067845
7 changed files with 20 additions and 33 deletions

View File

@ -1,7 +1,7 @@
{ {
"id": "com.ranfdev.Notify.Devel", "id": "com.ranfdev.Notify.Devel",
"runtime": "org.gnome.Platform", "runtime": "org.gnome.Platform",
"runtime-version": "master", "runtime-version": "45",
"sdk": "org.gnome.Sdk", "sdk": "org.gnome.Sdk",
"sdk-extensions": [ "sdk-extensions": [
"org.freedesktop.Sdk.Extension.rust-stable", "org.freedesktop.Sdk.Extension.rust-stable",
@ -13,7 +13,6 @@
"--share=network", "--share=network",
"--socket=fallback-x11", "--socket=fallback-x11",
"--socket=wayland", "--socket=wayland",
"--socket=session-bus",
"--device=dri", "--device=dri",
"--env=RUST_LOG=notify=debug,ntfy_daemon=debug", "--env=RUST_LOG=notify=debug,ntfy_daemon=debug",
"--env=G_MESSAGES_DEBUG=none", "--env=G_MESSAGES_DEBUG=none",

View File

@ -4,32 +4,28 @@
<id>@app-id@</id> <id>@app-id@</id>
<metadata_license>CC0</metadata_license> <metadata_license>CC0</metadata_license>
<!-- Insert your license of choice here --> <!-- Insert your license of choice here -->
<!-- <project_license>MIT</project_license> --> <project_license>GPL-3.0-or-later</project_license>
<name>Notify</name> <name>Notify</name>
<summary>Write a GTK + Rust application</summary> <summary>Receive notifications from ntfy.sh.</summary>
<description> <description>
<p>A boilerplate template for GTK + Rust. It uses Meson as a build system and has flatpak support by default.</p> <p>Versatile GTK4 client designed to seamlessly interface with the ntfy.sh notification service</p>
</description> </description>
<screenshots> <screenshots>
<screenshot type="default"> <screenshot type="default">
<image>https://gitlab.gnome.org/bilelmoussaoui/notify/raw/master/data/resources/screenshots/screenshot1.png</image> <image>https://raw.githubusercontent.com/ranfdev/Notify/main/data/screenshots/1.png</image>
<caption>Main window</caption> <caption>Main window, welcome screen</caption>
</screenshot>
<screenshot>
<image>https://raw.githubusercontent.com/ranfdev/Notify/main/data/screenshots/2.png</image>
<caption>Main window, subscription view</caption>
</screenshot> </screenshot>
</screenshots> </screenshots>
<url type="homepage">https://gitlab.gnome.org/bilelmoussaoui/notify</url> <url type="homepage">https://github.com/ranfdev/Notify</url>
<url type="bugtracker">https://gitlab.gnome.org/bilelmoussaoui/notify/issues</url> <url type="bugtracker">https://github.com/ranfdev/Notify/issues</url>
<content_rating type="oars-1.0" /> <content_rating type="oars-1.0" />
<releases> <releases>
<release version="0.1.0" date="2019-07-11" /> <release version="0.1.0" date="2023-10-13" />
</releases> </releases>
<kudos>
<!--
GNOME Software kudos:
https://gitlab.gnome.org/GNOME/gnome-software/-/blob/main/doc/kudos.md
-->
<kudo>ModernToolkit</kudo>
<kudo>HiDpiIcon</kudo>
</kudos>
<developer_name>ranfdev</developer_name> <developer_name>ranfdev</developer_name>
<update_contact>ranfdev@gmail.com</update_contact> <update_contact>ranfdev@gmail.com</update_contact>
<translation type="gettext">@gettext-package@</translation> <translation type="gettext">@gettext-package@</translation>

BIN
data/screenshots/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
data/screenshots/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -15,7 +15,7 @@ fn emoji_map() -> &'static HashMap<String, String> {
} }
fn validate_topic(topic: &str) -> Result<&str, Error> { fn validate_topic(topic: &str) -> Result<&str, Error> {
let re = Regex::new(r"^([A-z]|[0-9]|_)+$").unwrap(); let re = Regex::new(r"^\w+$").unwrap();
if re.is_match(topic) { if re.is_match(topic) {
Ok(topic) Ok(topic)
} else { } else {

View File

@ -1,6 +1,8 @@
use std::path::Path;
use adw::subclass::prelude::*; use adw::subclass::prelude::*;
use capnp_rpc::{rpc_twoparty_capnp, twoparty, RpcSystem}; use capnp_rpc::{rpc_twoparty_capnp, twoparty, RpcSystem};
use futures::{AsyncRead, AsyncReadExt, AsyncWrite}; use futures::AsyncReadExt;
use gettextrs::gettext; use gettextrs::gettext;
use gio::SocketClient; use gio::SocketClient;
use gio::UnixSocketAddress; use gio::UnixSocketAddress;
@ -12,9 +14,6 @@ use tracing::{debug, info};
use crate::config::{APP_ID, PKGDATADIR, PROFILE, VERSION}; use crate::config::{APP_ID, PKGDATADIR, PROFILE, VERSION};
use crate::widgets::*; use crate::widgets::*;
trait RW: AsyncRead + AsyncWrite {}
impl<T: AsyncRead + AsyncWrite> RW for T {}
mod imp { mod imp {
use std::cell::RefCell; use std::cell::RefCell;
@ -184,7 +183,8 @@ impl NotifyApplication {
fn ensure_rpc_running(&self, socket_path: &Path) { fn ensure_rpc_running(&self, socket_path: &Path) {
let dbpath = glib::user_data_dir().join("com.ranfdev.Notify.sqlite"); let dbpath = glib::user_data_dir().join("com.ranfdev.Notify.sqlite");
info!(database_path = %dbpath.display()); info!(database_path = %dbpath.display());
ntfy_daemon::system_client::start(socket.to_owned(), dbpath.to_str().unwrap()).unwrap(); ntfy_daemon::system_client::start(socket_path.to_owned(), dbpath.to_str().unwrap())
.unwrap();
self.imp().hold_guard.set(self.hold()).unwrap(); self.imp().hold_guard.set(self.hold()).unwrap();
} }

View File

@ -4,9 +4,7 @@ use std::rc::Rc;
use adw::prelude::*; use adw::prelude::*;
use capnp::capability::Promise; use capnp::capability::Promise;
use capnp_rpc::pry; use capnp_rpc::pry;
use glib::once_cell::sync::Lazy;
use glib::subclass::prelude::*; use glib::subclass::prelude::*;
use glib::subclass::Signal;
use glib::Properties; use glib::Properties;
use gtk::{gio, glib}; use gtk::{gio, glib};
use ntfy_daemon::models; use ntfy_daemon::models;
@ -108,13 +106,7 @@ mod imp {
} }
#[glib::derived_properties] #[glib::derived_properties]
impl ObjectImpl for Subscription { impl ObjectImpl for Subscription {}
fn signals() -> &'static [Signal] {
static SIGNALS: Lazy<Vec<Signal>> =
Lazy::new(|| vec![Signal::builder("awarded").build()]);
SIGNALS.as_ref()
}
}
#[glib::object_subclass] #[glib::object_subclass]
impl ObjectSubclass for Subscription { impl ObjectSubclass for Subscription {