From 803e9b7afd094cb8aef03dd3532206ecf1bef723 Mon Sep 17 00:00:00 2001 From: Christopher Schramm Date: Wed, 3 Aug 2022 16:00:15 +0200 Subject: [PATCH] Add emblem for connected state --- blueman/gui/manager/ManagerDeviceList.py | 14 +-- .../hicolor/scalable/emblems/Makefile.am | 5 +- .../emblems/blueman-connected-emblem.svg | 85 +++++++++++++++++++ 3 files changed, 96 insertions(+), 8 deletions(-) create mode 100644 data/icons/hicolor/scalable/emblems/blueman-connected-emblem.svg diff --git a/blueman/gui/manager/ManagerDeviceList.py b/blueman/gui/manager/ManagerDeviceList.py index ab9918d99..e94623f5e 100644 --- a/blueman/gui/manager/ManagerDeviceList.py +++ b/blueman/gui/manager/ManagerDeviceList.py @@ -254,15 +254,16 @@ def get_icon_info(self, icon_name: str, size: int = 48, fallback: bool = True) - return icon_info - def make_device_icon(self, icon_info: Gtk.IconInfo, is_paired: bool = False, is_trusted: bool = False, - is_blocked: bool = False) -> cairo.Surface: + def _make_device_icon(self, icon_info: Gtk.IconInfo, is_paired: bool, is_connected: bool, is_trusted: bool, + is_blocked: bool) -> cairo.Surface: window = self.get_window() scale = self.get_scale_factor() target = icon_info.load_surface(window) ctx = cairo.Context(target) - if is_paired: - _icon_info = self.get_icon_info("blueman-paired-emblem", 16, False) + if is_connected or is_paired: + icon = "blueman-connected-emblem" if is_connected else "blueman-paired-emblem" + _icon_info = self.get_icon_info(icon, 16, False) assert _icon_info is not None paired_surface = _icon_info.load_surface(window) ctx.set_source_surface(paired_surface, 1 / scale, 1 / scale) @@ -628,8 +629,9 @@ def _set_cell_data(self, _col: Gtk.TreeViewColumn, cell: Gtk.CellRenderer, model tree_iter: Gtk.TreeIter, data: Optional[str]) -> None: tree_iter = model.convert_iter_to_child_iter(tree_iter) if data is None: - row = self.get(tree_iter, "icon_info", "trusted", "paired", "blocked") - surface = self.make_device_icon(row["icon_info"], row["paired"], row["trusted"], row["blocked"]) + row = self.get(tree_iter, "icon_info", "paired", "connected", "trusted", "blocked") + surface = self._make_device_icon(row["icon_info"], row["paired"], + row["connected"], row["trusted"], row["blocked"]) cell.set_property("surface", surface) else: window = self.get_window() diff --git a/data/icons/hicolor/scalable/emblems/Makefile.am b/data/icons/hicolor/scalable/emblems/Makefile.am index 9bb2875d4..782a94a1b 100644 --- a/data/icons/hicolor/scalable/emblems/Makefile.am +++ b/data/icons/hicolor/scalable/emblems/Makefile.am @@ -5,8 +5,9 @@ context = emblems iconsdir = $(themedir)/$(size)/$(context) icons_DATA = \ - blueman-blocked-emblem.svg \ - blueman-paired-emblem.svg \ + blueman-blocked-emblem.svg \ + blueman-connected-emblem.svg \ + blueman-paired-emblem.svg \ blueman-trusted-emblem.svg EXTRA_DIST = $(icons_DATA) diff --git a/data/icons/hicolor/scalable/emblems/blueman-connected-emblem.svg b/data/icons/hicolor/scalable/emblems/blueman-connected-emblem.svg new file mode 100644 index 000000000..a7e187cbe --- /dev/null +++ b/data/icons/hicolor/scalable/emblems/blueman-connected-emblem.svg @@ -0,0 +1,85 @@ + + + + + + image/svg+xml + + + + + + + + + + + + +