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:
parent
6418aa0695
commit
df100319f4
@ -83,136 +83,69 @@
|
|||||||
|
|
||||||
<!-- START: Sidebar for Projects -->
|
<!-- START: Sidebar for Projects -->
|
||||||
<property name="start-child">
|
<property name="start-child">
|
||||||
<object class="GtkStack" id="sidebar_stack">
|
<object class="GtkBox">
|
||||||
<property name="transition-type">slide-left-right</property>
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="width-request">200</property>
|
||||||
|
|
||||||
<!-- Full Sidebar -->
|
<!-- Sidebar Header -->
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkStackPage">
|
<object class="GtkBox">
|
||||||
<property name="name">full</property>
|
<property name="orientation">horizontal</property>
|
||||||
<property name="child">
|
<property name="spacing">6</property>
|
||||||
<object class="GtkBox">
|
<property name="margin-start">12</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="margin-end">12</property>
|
||||||
<property name="width-request">200</property>
|
<property name="margin-top">6</property>
|
||||||
|
<property name="margin-bottom">6</property>
|
||||||
|
|
||||||
<!-- Sidebar Header -->
|
<child>
|
||||||
<child>
|
<object class="GtkLabel">
|
||||||
<object class="GtkBox">
|
<property name="label">Projects</property>
|
||||||
<property name="orientation">horizontal</property>
|
<property name="xalign">0</property>
|
||||||
<property name="spacing">6</property>
|
<property name="hexpand">True</property>
|
||||||
<property name="margin-start">12</property>
|
<style>
|
||||||
<property name="margin-end">12</property>
|
<class name="heading"/>
|
||||||
<property name="margin-top">6</property>
|
</style>
|
||||||
<property name="margin-bottom">6</property>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel">
|
|
||||||
<property name="label">Projects</property>
|
|
||||||
<property name="xalign">0</property>
|
|
||||||
<property name="hexpand">True</property>
|
|
||||||
<style>
|
|
||||||
<class name="heading"/>
|
|
||||||
</style>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<object class="GtkButton" id="add_project_button">
|
|
||||||
<property name="icon-name">list-add-symbolic</property>
|
|
||||||
<property name="tooltip-text">Add Project</property>
|
|
||||||
<signal name="clicked" handler="on_add_project_clicked"/>
|
|
||||||
<style>
|
|
||||||
<class name="flat"/>
|
|
||||||
</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>
|
|
||||||
|
|
||||||
<!-- Projects List -->
|
|
||||||
<child>
|
|
||||||
<object class="GtkScrolledWindow">
|
|
||||||
<property name="vexpand">True</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkListBox" id="projects_listbox">
|
|
||||||
<style>
|
|
||||||
<class name="navigation-sidebar"/>
|
|
||||||
</style>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<!-- Save Current Request Button -->
|
|
||||||
<child>
|
|
||||||
<object class="GtkButton" id="save_request_button">
|
|
||||||
<property name="label">Save Current Request</property>
|
|
||||||
<property name="margin-start">12</property>
|
|
||||||
<property name="margin-end">12</property>
|
|
||||||
<property name="margin-bottom">12</property>
|
|
||||||
<signal name="clicked" handler="on_save_request_clicked"/>
|
|
||||||
<style>
|
|
||||||
<class name="suggested-action"/>
|
|
||||||
</style>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</property>
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="add_project_button">
|
||||||
|
<property name="icon-name">list-add-symbolic</property>
|
||||||
|
<property name="tooltip-text">Add Project</property>
|
||||||
|
<signal name="clicked" handler="on_add_project_clicked"/>
|
||||||
|
<style>
|
||||||
|
<class name="flat"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<!-- Slim Sidebar -->
|
<!-- Projects List -->
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkStackPage">
|
<object class="GtkScrolledWindow">
|
||||||
<property name="name">slim</property>
|
<property name="vexpand">True</property>
|
||||||
<property name="child">
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkListBox" id="projects_listbox">
|
||||||
<property name="orientation">vertical</property>
|
<style>
|
||||||
<property name="width-request">60</property>
|
<class name="navigation-sidebar"/>
|
||||||
|
</style>
|
||||||
<!-- 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>
|
</object>
|
||||||
</property>
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<!-- Save Current Request Button -->
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="save_request_button">
|
||||||
|
<property name="label">Save Current Request</property>
|
||||||
|
<property name="margin-start">12</property>
|
||||||
|
<property name="margin-end">12</property>
|
||||||
|
<property name="margin-bottom">12</property>
|
||||||
|
<signal name="clicked" handler="on_save_request_clicked"/>
|
||||||
|
<style>
|
||||||
|
<class name="suggested-action"/>
|
||||||
|
</style>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|||||||
@ -47,7 +47,6 @@ widgets_sources = [
|
|||||||
'widgets/history_item.py',
|
'widgets/history_item.py',
|
||||||
'widgets/project_item.py',
|
'widgets/project_item.py',
|
||||||
'widgets/request_item.py',
|
'widgets/request_item.py',
|
||||||
'widgets/slim_project_item.py',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
install_data(widgets_sources, install_dir: moduledir / 'widgets')
|
install_data(widgets_sources, install_dir: moduledir / 'widgets')
|
||||||
|
|||||||
@ -8,6 +8,5 @@
|
|||||||
<file preprocess="xml-stripblanks">widgets/history-item.ui</file>
|
<file preprocess="xml-stripblanks">widgets/history-item.ui</file>
|
||||||
<file preprocess="xml-stripblanks">widgets/project-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/request-item.ui</file>
|
||||||
<file preprocess="xml-stripblanks">widgets/slim-project-item.ui</file>
|
|
||||||
</gresource>
|
</gresource>
|
||||||
</gresources>
|
</gresources>
|
||||||
|
|||||||
@ -21,6 +21,5 @@ from .header_row import HeaderRow
|
|||||||
from .history_item import HistoryItem
|
from .history_item import HistoryItem
|
||||||
from .project_item import ProjectItem
|
from .project_item import ProjectItem
|
||||||
from .request_item import RequestItem
|
from .request_item import RequestItem
|
||||||
from .slim_project_item import SlimProjectItem
|
|
||||||
|
|
||||||
__all__ = ['HeaderRow', 'HistoryItem', 'ProjectItem', 'RequestItem', 'SlimProjectItem']
|
__all__ = ['HeaderRow', 'HistoryItem', 'ProjectItem', 'RequestItem']
|
||||||
|
|||||||
@ -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>
|
|
||||||
@ -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')
|
|
||||||
@ -26,7 +26,6 @@ from .icon_picker_dialog import IconPickerDialog
|
|||||||
from .widgets.header_row import HeaderRow
|
from .widgets.header_row import HeaderRow
|
||||||
from .widgets.history_item import HistoryItem
|
from .widgets.history_item import HistoryItem
|
||||||
from .widgets.project_item import ProjectItem
|
from .widgets.project_item import ProjectItem
|
||||||
from .widgets.slim_project_item import SlimProjectItem
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
@ -45,13 +44,9 @@ class RosterWindow(Adw.ApplicationWindow):
|
|||||||
split_pane = Gtk.Template.Child()
|
split_pane = Gtk.Template.Child()
|
||||||
|
|
||||||
# Sidebar widgets
|
# Sidebar widgets
|
||||||
sidebar_stack = Gtk.Template.Child()
|
|
||||||
projects_listbox = Gtk.Template.Child()
|
projects_listbox = Gtk.Template.Child()
|
||||||
slim_projects_box = Gtk.Template.Child()
|
|
||||||
add_project_button = Gtk.Template.Child()
|
add_project_button = Gtk.Template.Child()
|
||||||
save_request_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
|
# Containers for tabs
|
||||||
request_tabs_container = Gtk.Template.Child()
|
request_tabs_container = Gtk.Template.Child()
|
||||||
@ -458,13 +453,10 @@ class RosterWindow(Adw.ApplicationWindow):
|
|||||||
# Clear existing
|
# Clear existing
|
||||||
while child := self.projects_listbox.get_first_child():
|
while child := self.projects_listbox.get_first_child():
|
||||||
self.projects_listbox.remove(child)
|
self.projects_listbox.remove(child)
|
||||||
while child := self.slim_projects_box.get_first_child():
|
|
||||||
self.slim_projects_box.remove(child)
|
|
||||||
|
|
||||||
# Load and populate
|
# Load and populate
|
||||||
projects = self.project_manager.load_projects()
|
projects = self.project_manager.load_projects()
|
||||||
for project in projects:
|
for project in projects:
|
||||||
# Full project item
|
|
||||||
item = ProjectItem(project)
|
item = ProjectItem(project)
|
||||||
item.connect('edit-requested', self._on_project_edit, project)
|
item.connect('edit-requested', self._on_project_edit, project)
|
||||||
item.connect('delete-requested', self._on_project_delete, 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)
|
item.connect('request-delete-requested', self._on_delete_request, project)
|
||||||
self.projects_listbox.append(item)
|
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()
|
@Gtk.Template.Callback()
|
||||||
def on_add_project_clicked(self, button):
|
def on_add_project_clicked(self, button):
|
||||||
"""Show dialog to create project."""
|
"""Show dialog to create project."""
|
||||||
@ -709,19 +696,3 @@ class RosterWindow(Adw.ApplicationWindow):
|
|||||||
|
|
||||||
dialog.connect("response", on_response)
|
dialog.connect("response", on_response)
|
||||||
dialog.present(self)
|
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")
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user