✨ feat(dashboard): make Bluetooth and Network tiles toggleable via content area click

This commit is contained in:
sankalp committed 2025-07-27 05:30:38 +05:45
1 parent 7aef900ab7
commit 341523ca24
3 files changed
+45 -1

No files matched your search

+16
View File
@@ -104,6 +104,9 @@ class Bluetooth(Tile):
# Initialize state
self._update_tile_state()
# Override the type_box button behavior to toggle Bluetooth
self._setup_content_button()
def _update_tile_state(self):
"""Update tile visual state based on Bluetooth status."""
self.state = self.bluetooth_client.enabled
@@ -119,6 +122,19 @@ class Bluetooth(Tile):
# Update tile icon based on Bluetooth state
self._update_tile_icon()
def _setup_content_button(self):
"""Setup the content button to toggle Bluetooth instead of showing menu."""
if hasattr(self, 'type_box'):
# Disconnect the existing click handler
self.type_box.disconnect_by_func(self.handle_click)
# Connect to Bluetooth toggle handler
self.type_box.connect("clicked", self._on_bluetooth_toggle)
def _on_bluetooth_toggle(self, *_):
"""Handle Bluetooth toggle when clicking on the main content area."""
# Toggle Bluetooth state
self.bluetooth_client.enabled = not self.bluetooth_client.enabled
def _update_tile_icon(self):
"""Update the tile icon based on Bluetooth status and connected devices."""
if not self.bluetooth_client.enabled: