mirror of
https://github.com/szymon-jozef/libnotify-rs.git
synced 2026-10-27 11:10:47 +01:00
refactor: split modules into separate dirs
This commit is contained in:
@@ -11,8 +11,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
None,
|
None,
|
||||||
&ctx,
|
&ctx,
|
||||||
)?
|
)?
|
||||||
.set_urgency(libnotify_rs::notification::Urgency::Critical)
|
.set_urgency(libnotify_rs::api::notification::Urgency::Critical)
|
||||||
.set_timeout(libnotify_rs::notification::Timeout::Never)
|
.set_timeout(libnotify_rs::api::notification::Timeout::Never)
|
||||||
.set_category("Coffee")?;
|
.set_category("Coffee")?;
|
||||||
|
|
||||||
notification_builder.show()?;
|
notification_builder.show()?;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use glib::MainLoop;
|
use glib::MainLoop;
|
||||||
use libnotify_rs::{
|
use libnotify_rs::{
|
||||||
functions::{init, uninit},
|
api::functions::{init, uninit},
|
||||||
notification::Notification,
|
api::notification::Notification,
|
||||||
};
|
};
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use libnotify_rs::functions::{self, uninit};
|
use libnotify_rs::api::functions::{self, uninit};
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
functions::init("Morbius")?;
|
functions::init("Morbius")?;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use libnotify_rs::{
|
use libnotify_rs::api::{
|
||||||
functions::{init, uninit},
|
functions::{init, uninit},
|
||||||
notification::Notification,
|
notification::{self, Notification},
|
||||||
};
|
};
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
@@ -11,8 +11,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
None,
|
None,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
notify.set_timeout(libnotify_rs::notification::Timeout::Custom(1000 * 10)); // 10 secs
|
notify.set_timeout(notification::Timeout::Custom(1000 * 10)); // 10 secs
|
||||||
notify.set_urgency(libnotify_rs::notification::Urgency::Critical); // coffee is very important
|
notify.set_urgency(notification::Urgency::Critical); // coffee is very important
|
||||||
notify.set_category("Coffee")?;
|
notify.set_category("Coffee")?;
|
||||||
|
|
||||||
notify.show()?;
|
notify.show()?;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use crate::utils::c_str_to_rs_str_and_free;
|
use super::utils::c_str_to_rs_str_and_free;
|
||||||
|
|
||||||
use crate::libnotify::*;
|
use super::libnotify::*;
|
||||||
|
|
||||||
/* Initting
|
/* Initting
|
||||||
*
|
*
|
||||||
4
src/api/mod.rs
Normal file
4
src/api/mod.rs
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
pub mod functions;
|
||||||
|
mod libnotify;
|
||||||
|
pub mod notification;
|
||||||
|
mod utils;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
use crate::libnotify::*;
|
use super::libnotify::*;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
pub enum Urgency {
|
pub enum Urgency {
|
||||||
@@ -7,7 +7,7 @@ pub unsafe fn c_str_to_rs_str_and_free(c_str: *mut std::os::raw::c_char) -> Opti
|
|||||||
.to_string_lossy()
|
.to_string_lossy()
|
||||||
.to_string();
|
.to_string();
|
||||||
|
|
||||||
unsafe { crate::libnotify::g_free(c_str as *mut std::ffi::c_void) };
|
unsafe { super::libnotify::g_free(c_str as *mut std::ffi::c_void) };
|
||||||
|
|
||||||
Some(normal_string)
|
Some(normal_string)
|
||||||
}
|
}
|
||||||
10
src/lib.rs
10
src/lib.rs
@@ -3,9 +3,7 @@
|
|||||||
#![allow(non_camel_case_types)]
|
#![allow(non_camel_case_types)]
|
||||||
#![allow(non_snake_case)]
|
#![allow(non_snake_case)]
|
||||||
|
|
||||||
pub mod builder;
|
pub mod api;
|
||||||
pub mod context;
|
pub mod wrappers;
|
||||||
pub mod functions;
|
|
||||||
mod libnotify;
|
pub use wrappers::{builder, context};
|
||||||
pub mod notification;
|
|
||||||
mod utils;
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
context::LibnotifyContext,
|
api::notification::{HintValue, Notification, Timeout, Urgency},
|
||||||
notification::{HintValue, Notification, Timeout, Urgency},
|
wrappers::context::LibnotifyContext,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct NotificationBuilder<'a> {
|
pub struct NotificationBuilder<'a> {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
use crate::functions::{init, is_initted, set_app_icon, set_app_name, uninit};
|
use crate::api::functions::{init, is_initted, set_app_icon, set_app_name, uninit};
|
||||||
|
|
||||||
pub struct LibnotifyContext {}
|
pub struct LibnotifyContext {}
|
||||||
|
|
||||||
2
src/wrappers/mod.rs
Normal file
2
src/wrappers/mod.rs
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
pub mod builder;
|
||||||
|
pub mod context;
|
||||||
Reference in New Issue
Block a user