Fix header bar height matching properly
- Revert show-title=False on main header (was hiding tabs) - Use CSS to force both header bars to exact same height (46px) - Remove vertical padding from header bars - Keep tab bar compact to fit within fixed height
This commit is contained in:
parent
91b4c68b49
commit
74250c36b7
@ -95,7 +95,6 @@
|
|||||||
<!-- Main Header Bar -->
|
<!-- Main Header Bar -->
|
||||||
<child>
|
<child>
|
||||||
<object class="AdwHeaderBar">
|
<object class="AdwHeaderBar">
|
||||||
<property name="show-title">False</property>
|
|
||||||
<property name="show-start-title-buttons">False</property>
|
<property name="show-start-title-buttons">False</property>
|
||||||
<property name="show-end-title-buttons">False</property>
|
<property name="show-end-title-buttons">False</property>
|
||||||
|
|
||||||
|
|||||||
@ -133,14 +133,17 @@ class RosterWindow(Adw.ApplicationWindow):
|
|||||||
"""Setup custom CSS for UI styling."""
|
"""Setup custom CSS for UI styling."""
|
||||||
css_provider = Gtk.CssProvider()
|
css_provider = Gtk.CssProvider()
|
||||||
css_provider.load_from_data(b"""
|
css_provider.load_from_data(b"""
|
||||||
/* Reduce header bar padding and height */
|
/* Force both header bars to same height */
|
||||||
headerbar {
|
headerbar {
|
||||||
min-height: 38px;
|
min-height: 46px;
|
||||||
|
max-height: 46px;
|
||||||
|
padding-top: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
padding-left: 0px;
|
padding-left: 0px;
|
||||||
padding-right: 6px;
|
padding-right: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compact tab bar */
|
/* Compact tab bar to fit in header bar */
|
||||||
tabbar {
|
tabbar {
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
@ -149,11 +152,13 @@ class RosterWindow(Adw.ApplicationWindow):
|
|||||||
|
|
||||||
tabbar > scrolledwindow {
|
tabbar > scrolledwindow {
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
tabbar tab {
|
tabbar tab {
|
||||||
min-height: 26px;
|
min-height: 28px;
|
||||||
padding: 2px 8px;
|
padding: 4px 10px;
|
||||||
margin: 0 1px;
|
margin: 0 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,9 +229,10 @@ class RosterWindow(Adw.ApplicationWindow):
|
|||||||
del self.page_to_widget[page]
|
del self.page_to_widget[page]
|
||||||
|
|
||||||
# Check if we need to create a new tab
|
# Check if we need to create a new tab
|
||||||
if self.tab_view.get_n_pages() == 1: # This page is still counted
|
remaining_tabs = len(self.page_to_tab)
|
||||||
# Schedule creating new tab BEFORE closing this one
|
if remaining_tabs == 0:
|
||||||
GLib.idle_add(self._create_new_tab)
|
# Schedule creating exactly one new tab
|
||||||
|
GLib.timeout_add(50, self._create_new_tab_once)
|
||||||
|
|
||||||
# Close the page
|
# Close the page
|
||||||
tab_view.close_page_finish(page, True)
|
tab_view.close_page_finish(page, True)
|
||||||
@ -243,12 +249,22 @@ class RosterWindow(Adw.ApplicationWindow):
|
|||||||
del self.page_to_tab[page]
|
del self.page_to_tab[page]
|
||||||
del self.page_to_widget[page]
|
del self.page_to_widget[page]
|
||||||
|
|
||||||
# If this will be the last tab, create a new one BEFORE returning
|
# If this will be the last tab, create a new one
|
||||||
if self.tab_view.get_n_pages() == 1: # This page is still counted
|
# Check after we've removed our tracking to get accurate count
|
||||||
GLib.idle_add(self._create_new_tab)
|
remaining_tabs = len(self.page_to_tab)
|
||||||
|
if remaining_tabs == 0:
|
||||||
|
# Use a single-shot timer to create exactly one new tab
|
||||||
|
GLib.timeout_add(50, self._create_new_tab_once)
|
||||||
|
|
||||||
return False # Allow close
|
return False # Allow close
|
||||||
|
|
||||||
|
def _create_new_tab_once(self):
|
||||||
|
"""Create a new tab (one-time callback)."""
|
||||||
|
# Only create if there really are no tabs
|
||||||
|
if self.tab_view.get_n_pages() == 0:
|
||||||
|
self._create_new_tab()
|
||||||
|
return False # Don't repeat
|
||||||
|
|
||||||
|
|
||||||
def _is_empty_new_request_tab(self):
|
def _is_empty_new_request_tab(self):
|
||||||
"""Check if current tab is an empty 'New Request' tab."""
|
"""Check if current tab is an empty 'New Request' tab."""
|
||||||
@ -338,10 +354,15 @@ class RosterWindow(Adw.ApplicationWindow):
|
|||||||
|
|
||||||
def _on_tab_modified_changed(self, page, modified):
|
def _on_tab_modified_changed(self, page, modified):
|
||||||
"""Update tab indicator when modified state changes."""
|
"""Update tab indicator when modified state changes."""
|
||||||
|
# Update the tab title with/without modified indicator
|
||||||
|
tab = self.page_to_tab.get(page)
|
||||||
|
if tab:
|
||||||
if modified:
|
if modified:
|
||||||
page.set_indicator_icon(Gio.ThemedIcon.new("dot-symbolic"))
|
# Add star to title
|
||||||
|
page.set_title(f"*{tab.name}")
|
||||||
else:
|
else:
|
||||||
page.set_indicator_icon(None)
|
# Remove star from title
|
||||||
|
page.set_title(tab.name)
|
||||||
|
|
||||||
def _switch_to_tab(self, tab_id):
|
def _switch_to_tab(self, tab_id):
|
||||||
"""Switch to a tab by its ID."""
|
"""Switch to a tab by its ID."""
|
||||||
@ -745,12 +766,9 @@ class RosterWindow(Adw.ApplicationWindow):
|
|||||||
widget.original_request = original
|
widget.original_request = original
|
||||||
widget.modified = False
|
widget.modified = False
|
||||||
|
|
||||||
# Update tab page title
|
# Update tab page title (widget.modified is now False, so no star)
|
||||||
page.set_title(name)
|
page.set_title(name)
|
||||||
|
|
||||||
# This will trigger the modified-changed signal and clear the indicator
|
|
||||||
self._on_tab_modified_changed(page, False)
|
|
||||||
|
|
||||||
def _show_overwrite_dialog(self, project, name, existing_request_id, request):
|
def _show_overwrite_dialog(self, project, name, existing_request_id, request):
|
||||||
"""Show dialog asking if user wants to overwrite existing request."""
|
"""Show dialog asking if user wants to overwrite existing request."""
|
||||||
dialog = Adw.AlertDialog()
|
dialog = Adw.AlertDialog()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user