Remove foldable sidebar functionality

Simplify left sidebar by removing fold/unfold functionality while
keeping all project icon selection features:
- Remove GtkStack-based sidebar switching
- Remove fold/unfold buttons
- Delete SlimProjectItem widget
- Keep IconPickerDialog and project icons
- Keep Edit Project dialog with icon selection

The sidebar is now a static pane that cannot be folded or hidden.
This commit is contained in:
vesp 2025-12-18 16:19:30 +01:00
parent 6418aa0695
commit df100319f4
7 changed files with 55 additions and 219 deletions

View File

@ -83,14 +83,6 @@
<!-- START: Sidebar for Projects -->
<property name="start-child">
<object class="GtkStack" id="sidebar_stack">
<property name="transition-type">slide-left-right</property>
<!-- Full Sidebar -->
<child>
<object class="GtkStackPage">
<property name="name">full</property>
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="width-request">200</property>
@ -126,17 +118,6 @@
</style>
</object>
</child>
<child>
<object class="GtkButton" id="fold_sidebar_button">
<property name="icon-name">sidebar-show-right-symbolic</property>
<property name="tooltip-text">Fold Sidebar</property>
<signal name="clicked" handler="on_fold_sidebar_clicked"/>
<style>
<class name="flat"/>
</style>
</object>
</child>
</object>
</child>
@ -169,54 +150,6 @@
</child>
</object>
</property>
</object>
</child>
<!-- Slim Sidebar -->
<child>
<object class="GtkStackPage">
<property name="name">slim</property>
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="width-request">60</property>
<!-- Unfold Button -->
<child>
<object class="GtkButton" id="unfold_sidebar_button">
<property name="icon-name">sidebar-show-left-symbolic</property>
<property name="tooltip-text">Unfold Sidebar</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<signal name="clicked" handler="on_unfold_sidebar_clicked"/>
<style>
<class name="flat"/>
</style>
</object>
</child>
<!-- Slim Projects List -->
<child>
<object class="GtkScrolledWindow">
<property name="vexpand">True</property>
<child>
<object class="GtkBox" id="slim_projects_box">
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</child>
</object>
</property>
<!-- END: Request/Response Split -->
<property name="end-child">

View File

@ -47,7 +47,6 @@ widgets_sources = [
'widgets/history_item.py',
'widgets/project_item.py',
'widgets/request_item.py',
'widgets/slim_project_item.py',
]
install_data(widgets_sources, install_dir: moduledir / 'widgets')

View File

@ -8,6 +8,5 @@
<file preprocess="xml-stripblanks">widgets/history-item.ui</file>
<file preprocess="xml-stripblanks">widgets/project-item.ui</file>
<file preprocess="xml-stripblanks">widgets/request-item.ui</file>
<file preprocess="xml-stripblanks">widgets/slim-project-item.ui</file>
</gresource>
</gresources>

View File

@ -21,6 +21,5 @@ from .header_row import HeaderRow
from .history_item import HistoryItem
from .project_item import ProjectItem
from .request_item import RequestItem
from .slim_project_item import SlimProjectItem
__all__ = ['HeaderRow', 'HistoryItem', 'ProjectItem', 'RequestItem', 'SlimProjectItem']
__all__ = ['HeaderRow', 'HistoryItem', 'ProjectItem', 'RequestItem']

View File

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<template class="SlimProjectItem" parent="GtkButton">
<property name="tooltip-text">Project</property>
<property name="width-request">48</property>
<property name="height-request">48</property>
<signal name="clicked" handler="on_clicked"/>
<style>
<class name="flat"/>
</style>
<child>
<object class="GtkImage" id="project_icon">
<property name="icon-name">folder-symbolic</property>
<property name="icon-size">large</property>
</object>
</child>
</template>
</interface>

View File

@ -1,44 +0,0 @@
# slim_project_item.py
#
# Copyright 2025 Pavel Baksy
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: GPL-3.0-or-later
from gi.repository import Gtk, GObject
@Gtk.Template(resource_path='/cz/vesp/roster/widgets/slim-project-item.ui')
class SlimProjectItem(Gtk.Button):
"""Slim widget showing only project icon (for folded sidebar)."""
__gtype_name__ = 'SlimProjectItem'
project_icon = Gtk.Template.Child()
__gsignals__ = {
'project-clicked': (GObject.SIGNAL_RUN_FIRST, None, ()),
}
def __init__(self, project):
super().__init__()
self.project = project
self.project_icon.set_from_icon_name(project.icon)
self.set_tooltip_text(project.name)
@Gtk.Template.Callback()
def on_clicked(self, button):
"""Handle click - unfold sidebar and show this project."""
self.emit('project-clicked')

View File

@ -26,7 +26,6 @@ from .icon_picker_dialog import IconPickerDialog
from .widgets.header_row import HeaderRow
from .widgets.history_item import HistoryItem
from .widgets.project_item import ProjectItem
from .widgets.slim_project_item import SlimProjectItem
from datetime import datetime
import threading
@ -45,13 +44,9 @@ class RosterWindow(Adw.ApplicationWindow):
split_pane = Gtk.Template.Child()
# Sidebar widgets
sidebar_stack = Gtk.Template.Child()
projects_listbox = Gtk.Template.Child()
slim_projects_box = Gtk.Template.Child()
add_project_button = Gtk.Template.Child()
save_request_button = Gtk.Template.Child()
fold_sidebar_button = Gtk.Template.Child()
unfold_sidebar_button = Gtk.Template.Child()
# Containers for tabs
request_tabs_container = Gtk.Template.Child()
@ -458,13 +453,10 @@ class RosterWindow(Adw.ApplicationWindow):
# Clear existing
while child := self.projects_listbox.get_first_child():
self.projects_listbox.remove(child)
while child := self.slim_projects_box.get_first_child():
self.slim_projects_box.remove(child)
# Load and populate
projects = self.project_manager.load_projects()
for project in projects:
# Full project item
item = ProjectItem(project)
item.connect('edit-requested', self._on_project_edit, project)
item.connect('delete-requested', self._on_project_delete, project)
@ -473,11 +465,6 @@ class RosterWindow(Adw.ApplicationWindow):
item.connect('request-delete-requested', self._on_delete_request, project)
self.projects_listbox.append(item)
# Slim project item
slim_item = SlimProjectItem(project)
slim_item.connect('project-clicked', self._on_slim_project_clicked)
self.slim_projects_box.append(slim_item)
@Gtk.Template.Callback()
def on_add_project_clicked(self, button):
"""Show dialog to create project."""
@ -709,19 +696,3 @@ class RosterWindow(Adw.ApplicationWindow):
dialog.connect("response", on_response)
dialog.present(self)
# Sidebar fold/unfold methods
@Gtk.Template.Callback()
def on_fold_sidebar_clicked(self, button):
"""Fold the sidebar to slim view."""
self.sidebar_stack.set_visible_child_name("slim")
@Gtk.Template.Callback()
def on_unfold_sidebar_clicked(self, button):
"""Unfold the sidebar to full view."""
self.sidebar_stack.set_visible_child_name("full")
def _on_slim_project_clicked(self, slim_item):
"""Handle click on slim project item - unfold sidebar."""
self.sidebar_stack.set_visible_child_name("full")