♻️ refactor(dashboard): move ScrolledWindow to notification component for better structure

This commit is contained in:
sankalp committed 2025-07-27 01:33:56 +05:45
1 parent 3e82082ae2
commit e0756beaea
2 files changed
+20 -20

No files matched your search

+1 -18
View File
@@ -1,6 +1,5 @@
from fabric.widgets.box import Box from fabric.widgets.box import Box
from fabric.widgets.revealer import Revealer from fabric.widgets.revealer import Revealer
from fabric.widgets.scrolledwindow import ScrolledWindow
from fabric.core.service import Property from fabric.core.service import Property
from modules.dashboard.bluetooth import Bluetooth from modules.dashboard.bluetooth import Bluetooth
@@ -32,22 +31,6 @@ class Dashboard(Box):
# Create real notifications component # Create real notifications component
self.dashboard_notifications = DashboardNotifications() self.dashboard_notifications = DashboardNotifications()
# Create scrolled window for notifications (matching dock notifications style)
self.notifications_scrolled = ScrolledWindow(
name="notification-history-scrolled-window",
child=self.dashboard_notifications,
h_scrollbar_policy="never",
v_scrollbar_policy="automatic",
min_content_size=(400, 200),
max_content_size=(450, 300),
h_expand=True,
v_expand=True,
h_align="fill",
v_align="fill",
propagate_width=False,
propagate_height=False,
)
self.tiles = Box( self.tiles = Box(
children=[ children=[
self.wifi, self.wifi,
@@ -66,7 +49,7 @@ class Dashboard(Box):
spacing=8, spacing=8,
h_expand=True, h_expand=True,
v_expand=True, v_expand=True,
children=[self.notifications_scrolled], children=[self.dashboard_notifications],
style_classes=["notification-history-popup"], style_classes=["notification-history-popup"],
), ),
child_revealed=True, child_revealed=True,
+19 -2
View File
@@ -7,6 +7,7 @@ from fabric.widgets.box import Box
from fabric.widgets.label import Label from fabric.widgets.label import Label
from fabric.widgets.button import Button from fabric.widgets.button import Button
from fabric.widgets.centerbox import CenterBox from fabric.widgets.centerbox import CenterBox
from fabric.widgets.scrolledwindow import ScrolledWindow
from gi.repository import GLib, Gtk from gi.repository import GLib, Gtk
import os import os
import json import json
@@ -238,9 +239,25 @@ class DashboardNotifications(Box):
children=[self.no_notifications_label], children=[self.no_notifications_label],
) )
# Add components to main container # Create scrolled window for notifications list only
self.notifications_scrolled = ScrolledWindow(
name="notification-history-scrolled-window",
child=self.notifications_list,
h_scrollbar_policy="never",
v_scrollbar_policy="automatic",
min_content_size=(400, 200),
max_content_size=(450, 300),
h_expand=True,
v_expand=True,
h_align="fill",
v_align="fill",
propagate_width=False,
propagate_height=False,
)
# Add components to main container - header outside, scrolled list inside
self.add(self.history_header) self.add(self.history_header)
self.add(self.notifications_list) self.add(self.notifications_scrolled)
# Add the no notifications box initially to the notifications list # Add the no notifications box initially to the notifications list
self.notifications_list.add(self.no_notifications_box) self.notifications_list.add(self.no_notifications_box)