Skip to content

Commit 77a25f2

Browse files
committed
remove useless notify_notification_close call
1 parent f54fdc3 commit 77a25f2

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

libnotilus/src/notilus.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,12 @@ NotifyNotification *init(const char *app_name) {
1212
}
1313

1414
int notify(NotifyNotification *notification, const char *summary, const char *body, const char *icon, NotifyUrgency urgency) {
15-
if (!notify_notification_close(notification, NULL)) {
16-
return 1;
17-
}
1815
if (!notify_notification_update(notification, summary, body, icon)) {
19-
return 2;
16+
return 1;
2017
}
2118
notify_notification_set_urgency(notification, urgency);
2219
if (!notify_notification_show(notification, NULL)) {
23-
return 3;
20+
return 2;
2421
}
2522
return 0;
2623
}

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ impl<'a> Bato {
102102
let capacity = energy_full as u64;
103103
let energy = energy_now as u64;
104104
let battery_level = u32::try_from(100_u64 * energy / capacity)?;
105+
self.check_status(&status);
105106
if status == "Discharging"
106107
&& !self.low_notified
107108
&& battery_level <= self.config.low_level
@@ -130,7 +131,6 @@ impl<'a> Bato {
130131
if status == "Discharging" && self.full_notified {
131132
self.full_notified = false;
132133
}
133-
self.check_status(&status);
134134
self.previous_status = status;
135135
Ok(())
136136
}

src/notify.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,8 @@ pub fn send(notification: *mut NotifyNotification, data: &Notification) {
5656
i = notify(notification, data.summary.as_ptr(), body, icon, urgency);
5757
}
5858
match i {
59-
1 => eprintln!("bato error: in libnotilus, fail to close the notification"),
60-
2 => eprintln!("bato error: in libnotilus, fail to update the notification"),
61-
3 => eprintln!("bato error: in libnotilus, fail to show the notification"),
59+
1 => eprintln!("bato error: in libnotilus, fail to update the notification"),
60+
2 => eprintln!("bato error: in libnotilus, fail to show the notification"),
6261
_ => {}
6362
};
6463
}

0 commit comments

Comments
 (0)