Skip to content

Commit

Permalink
remove any trace of capnp
Browse files Browse the repository at this point in the history
  • Loading branch information
ranfdev committed Nov 21, 2024
1 parent eac70af commit 6f67f86
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 62 deletions.
38 changes: 0 additions & 38 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ tracing-subscriber = "0.3"
adw = { version = "0.7", package = "libadwaita", features = ["v1_6"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
capnp = "0.18.0"
capnp-rpc = "0.18.0"
anyhow = "1.0.71"
chrono = "0.4.26"
rand = "0.8.5"
Expand Down
11 changes: 0 additions & 11 deletions build-aux/com.ranfdev.Notify.Devel.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,6 @@
]
},
"modules": [
{
"name": "capnp",
"buildsystem": "cmake",
"sources": [
{
"type": "archive",
"url": "https://capnproto.org/capnproto-c++-0.10.4.tar.gz",
"sha256": "981e7ef6dbe3ac745907e55a78870fbb491c5d23abd4ebc04e20ec235af4458c"
}
]
},
{
"name": "blueprint-compiler",
"buildsystem": "meson",
Expand Down
20 changes: 10 additions & 10 deletions src/subscription.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::cell::{Cell, OnceCell, RefCell};
use std::future::Future;
use std::rc::Rc;

use adw::prelude::*;
use capnp::capability::Promise;
use glib::subclass::prelude::*;
use glib::Properties;
use gtk::{gio, glib};
Expand Down Expand Up @@ -137,9 +137,9 @@ impl Subscription {
self._set_display_name(display_name.to_string());
}

fn load(&self) -> Promise<(), capnp::Error> {
fn load(&self) -> impl Future<Output = anyhow::Result<()>> {
let this = self.clone();
Promise::from_future(async move {
async move {
let remote_subscription = this.imp().client.get().unwrap();
let model = remote_subscription.model().await;

Expand All @@ -161,7 +161,7 @@ impl Subscription {
this.handle_event(ev);
}
Ok(())
})
}
}

fn handle_event(&self, ev: ListenerEvent) {
Expand Down Expand Up @@ -198,13 +198,13 @@ impl Subscription {
self.notify_display_name();
}
#[instrument(skip_all)]
pub fn set_display_name(&self, value: String) -> Promise<(), anyhow::Error> {
pub fn set_display_name(&self, value: String) -> impl Future<Output = anyhow::Result<()>> {
let this = self.clone();
Promise::from_future(async move {
async move {
this._set_display_name(value);
this.send_updated_info().await?;
Ok(())
})
}
}

async fn send_updated_info(&self) -> anyhow::Result<()> {
Expand Down Expand Up @@ -240,14 +240,14 @@ impl Subscription {
self.notify_unread_count();
}

pub fn set_muted(&self, value: bool) -> Promise<(), anyhow::Error> {
pub fn set_muted(&self, value: bool) -> impl Future<Output = anyhow::Result<()>> {
let this = self.clone();
Promise::from_future(async move {
async move {
this.imp().muted.replace(value);
this.notify_muted();
this.send_updated_info().await?;
Ok(())
})
}
}
pub async fn flag_all_as_read(&self) -> anyhow::Result<()> {
let imp = self.imp();
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/advanced_message_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ impl AdvancedMessageDialog {
&mut buffer.start_iter(),
&mut buffer.end_iter(),
true,
)).map_err(|e| capnp::Error::failed(e.to_string()))?;
))?;
thisc.imp().subscription.get().unwrap()
.publish_msg(msg).await
};
Expand Down

0 comments on commit 6f67f86

Please sign in to comment.