mirror of
https://github.com/szymon-jozef/libnotify-rs.git
synced 2026-10-27 19:20:43 +01:00
feat: add get_app_name function
This commit is contained in:
@@ -35,6 +35,7 @@ where
|
||||
}
|
||||
|
||||
/// Uninitializes libnotify.
|
||||
///
|
||||
/// This should be called when the program no longer needs libnotify for the rest of its lifecycle, typically just before exitting.
|
||||
pub fn uninit() {
|
||||
unsafe {
|
||||
@@ -47,10 +48,25 @@ pub fn is_initted() -> bool {
|
||||
unsafe { notify_is_initted() != 0 }
|
||||
}
|
||||
|
||||
/* Getting
|
||||
/* Getters
|
||||
*
|
||||
*/
|
||||
|
||||
/// Gets the application name registered.
|
||||
pub fn get_app_name() -> Option<String> {
|
||||
let app_name_c: *const std::os::raw::c_char = unsafe { notify_get_app_name() };
|
||||
|
||||
if app_name_c.is_null() {
|
||||
return None;
|
||||
} else {
|
||||
Some(
|
||||
unsafe { std::ffi::CStr::from_ptr(app_name_c) }
|
||||
.to_string_lossy()
|
||||
.to_string(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Gets the application icon registered.
|
||||
// Available since: 0.8.4
|
||||
pub fn get_app_icon() -> Option<String> {
|
||||
|
||||
Reference in New Issue
Block a user