Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add emblem for connected state #1812

Merged
merged 1 commit into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions blueman/gui/manager/ManagerDeviceList.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,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)
Expand Down Expand Up @@ -644,8 +645,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()
Expand Down
5 changes: 3 additions & 2 deletions data/icons/hicolor/scalable/emblems/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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)
85 changes: 85 additions & 0 deletions data/icons/hicolor/scalable/emblems/blueman-connected-emblem.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.