Skip to content

Commit

Permalink
ConnectionNotifier: Catch GLib.Error if update fails
Browse files Browse the repository at this point in the history
KDE considers icon changes (fixed upstream) excessive. This so abrt (or
similar tools) doesn't trigger.
  • Loading branch information
infirit committed Oct 20, 2023
1 parent 3abab33 commit 7951b49
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions blueman/plugins/applet/ConnectionNotifier.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import logging
from gettext import gettext as _
from typing import Any, Dict, Union

from blueman.bluez.Device import Device
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):
Expand Down Expand Up @@ -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)

0 comments on commit 7951b49

Please sign in to comment.