From 7951b4911f3e488fcd4bd5885637c545159f0745 Mon Sep 17 00:00:00 2001 From: Sander Sweers Date: Wed, 18 Oct 2023 19:47:00 +0200 Subject: [PATCH] ConnectionNotifier: Catch GLib.Error if update fails KDE considers icon changes (fixed upstream) excessive. This so abrt (or similar tools) doesn't trigger. --- blueman/plugins/applet/ConnectionNotifier.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/blueman/plugins/applet/ConnectionNotifier.py b/blueman/plugins/applet/ConnectionNotifier.py index 7e2b57639..f3076f24d 100644 --- a/blueman/plugins/applet/ConnectionNotifier.py +++ b/blueman/plugins/applet/ConnectionNotifier.py @@ -1,3 +1,4 @@ +import logging from gettext import gettext as _ from typing import Any, Dict, Union @@ -5,6 +6,7 @@ from blueman.gui.Notification import Notification, _NotificationBubble, _NotificationDialog from blueman.main.BatteryWatcher import BatteryWatcher from blueman.plugins.AppletPlugin import AppletPlugin +from gi.repository import GLib class ConnectionNotifier(AppletPlugin): @@ -36,5 +38,8 @@ def on_device_property_changed(self, path: str, key: str, value: Any) -> None: def _on_battery_update(self, path: str, value: int) -> None: notification = self._notifications[path] if notification: - notification.set_message(f"{_('Connected')} {value}%") - notification.set_notification_icon("battery") + try: + notification.set_message(f"{_('Connected')} {value}%") + notification.set_notification_icon("battery") + except GLib.Error: + logging.error("Failed to update notification", exc_info=True)