From 0d5bb837f548ade93daf5dced1ef12f3f542c653 Mon Sep 17 00:00:00 2001 From: vesp Date: Mon, 22 Dec 2025 00:49:54 +0100 Subject: [PATCH] Add header change tracking to tab modification detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, changes to HTTP headers (adding, editing, or removing headers) were not being tracked, causing tabs to not show the modified indicator (•) when only header values changed. Changes: - Add 'changed' signal to HeaderRow widget that emits when key or value entries change - Connect HeaderRow 'changed' signal to window's _on_request_changed handler - Real-time tab modification tracking now includes all header edits This completes the comprehensive change tracking system for tabs: - URL changes ✓ - Method changes ✓ - Body changes ✓ - Syntax changes ✓ - Header changes ✓ (now fixed) --- src/widgets/header_row.py | 13 +++++++++++-- src/window.py | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/widgets/header_row.py b/src/widgets/header_row.py index a789a75..39cf0fe 100644 --- a/src/widgets/header_row.py +++ b/src/widgets/header_row.py @@ -30,14 +30,23 @@ class HeaderRow(Gtk.Box): value_entry = Gtk.Template.Child() remove_button = Gtk.Template.Child() - # Signal emitted when remove button clicked + # Signals __gsignals__ = { - 'remove-requested': (GObject.SIGNAL_RUN_FIRST, None, ()) + 'remove-requested': (GObject.SIGNAL_RUN_FIRST, None, ()), + 'changed': (GObject.SIGNAL_RUN_FIRST, None, ()) } def __init__(self): super().__init__() + # Connect to entry changes to emit our own changed signal + self.key_entry.connect('changed', self._on_entry_changed) + self.value_entry.connect('changed', self._on_entry_changed) + + def _on_entry_changed(self, entry): + """Handle changes to key or value entries.""" + self.emit('changed') + @Gtk.Template.Callback() def on_remove_clicked(self, button): """Handle remove button click.""" diff --git a/src/window.py b/src/window.py index e93bc08..bfcd043 100644 --- a/src/window.py +++ b/src/window.py @@ -837,6 +837,7 @@ class RosterWindow(Adw.ApplicationWindow): row = HeaderRow() row.set_header(key, value) row.connect('remove-requested', self._on_header_remove) + row.connect('changed', self._on_request_changed) self.headers_listbox.append(row) # Mark as changed if we're adding a non-empty header