Keep project expanded after request reorder; hide request menu button until hover

This commit is contained in:
Pavel Baksy 2026-06-02 17:11:47 +02:00
parent 25b3f9b20a
commit 71f01edde0
2 changed files with 24 additions and 0 deletions

View File

@ -32,6 +32,7 @@
<property name="tooltip-text">Options</property>
<style>
<class name="flat"/>
<class name="request-menu-button"/>
</style>
</object>
</child>

View File

@ -224,6 +224,16 @@ class RosterWindow(Adw.ApplicationWindow):
min-width: 0;
}
/* Request menu button: hidden by default, visible on row hover or when open */
.request-menu-button {
opacity: 0;
transition: opacity 150ms ease;
}
row:hover .request-menu-button,
.request-menu-button:checked {
opacity: 1;
}
/* Method chips in sidebar request list */
.method-chip {
border-radius: 4px;
@ -961,6 +971,14 @@ class RosterWindow(Adw.ApplicationWindow):
def _load_projects(self) -> None:
"""Load and display projects."""
# Remember which projects are currently expanded
expanded_ids = set()
child = self.projects_listbox.get_first_child()
while child:
if isinstance(child, ProjectItem) and child.expanded:
expanded_ids.add(child.project.id)
child = child.get_next_sibling()
# Clear existing
while child := self.projects_listbox.get_first_child():
self.projects_listbox.remove(child)
@ -984,6 +1002,11 @@ class RosterWindow(Adw.ApplicationWindow):
item.connect('request-move-up-requested', self._on_request_move_up, project)
item.connect('request-move-down-requested', self._on_request_move_down, project)
item.connect('request-move-to-project-requested', self._on_request_move_to_project, project)
if project.id in expanded_ids:
item.expanded = True
item.requests_revealer.set_transition_duration(0)
item.requests_revealer.set_reveal_child(True)
GLib.idle_add(lambda r=item.requests_revealer: (r.set_transition_duration(250), False)[1])
self.projects_listbox.append(item)
def on_add_project_clicked(self, button):