Maximize header space and enable tab scrolling

Remove application title from main header bar and wrap tabs in scrollable container. This prevents window resizing when many tabs are open and follows modern GNOME app patterns.
This commit is contained in:
Pavel Baksy 2025-12-23 12:36:59 +01:00
parent 2ff4a39e04
commit 0a5c1c59af
2 changed files with 14 additions and 6 deletions

View File

@ -4,7 +4,6 @@
<requires lib="Adw" version="1.0"/> <requires lib="Adw" version="1.0"/>
<template class="RosterWindow" parent="AdwApplicationWindow"> <template class="RosterWindow" parent="AdwApplicationWindow">
<property name="title">Roster</property>
<property name="default-width">1200</property> <property name="default-width">1200</property>
<property name="default-height">800</property> <property name="default-height">800</property>
<property name="content"> <property name="content">
@ -96,12 +95,20 @@
<!-- Main Header Bar --> <!-- Main Header Bar -->
<child> <child>
<object class="AdwHeaderBar"> <object class="AdwHeaderBar">
<!-- Tab bar container on the left (hidden when only 1 tab) --> <property name="show-title">False</property>
<!-- Tab bar in scrollable container (hidden when only 1 tab) -->
<child type="start"> <child type="start">
<object class="GtkScrolledWindow" id="tab_bar_scroll">
<property name="hscrollbar-policy">automatic</property>
<property name="vscrollbar-policy">never</property>
<property name="propagate-natural-width">true</property>
<property name="visible">False</property>
<child>
<object class="GtkBox" id="tab_bar_container"> <object class="GtkBox" id="tab_bar_container">
<property name="orientation">horizontal</property> <property name="orientation">horizontal</property>
<property name="spacing">0</property> <property name="spacing">0</property>
<property name="visible">False</property> </object>
</child>
</object> </object>
</child> </child>

View File

@ -44,6 +44,7 @@ class RosterWindow(Adw.ApplicationWindow):
url_entry = Gtk.Template.Child() url_entry = Gtk.Template.Child()
send_button = Gtk.Template.Child() send_button = Gtk.Template.Child()
new_request_button = Gtk.Template.Child() new_request_button = Gtk.Template.Child()
tab_bar_scroll = Gtk.Template.Child()
tab_bar_container = Gtk.Template.Child() tab_bar_container = Gtk.Template.Child()
# Panes # Panes
@ -426,7 +427,7 @@ class RosterWindow(Adw.ApplicationWindow):
"""Show/hide tab bar based on number of tabs.""" """Show/hide tab bar based on number of tabs."""
num_tabs = len(self.tab_manager.tabs) num_tabs = len(self.tab_manager.tabs)
# Show tab bar only if we have 2 or more tabs # Show tab bar only if we have 2 or more tabs
self.tab_bar_container.set_visible(num_tabs >= 2) self.tab_bar_scroll.set_visible(num_tabs >= 2)
# Update tab bar with buttons # Update tab bar with buttons
if num_tabs >= 2: if num_tabs >= 2: