refactor: drop dead fields and stale comments

This commit is contained in:
Eduard Tolosa 2026-06-25 18:19:18 -05:00
parent 306cedfd68
commit 6796a44802
2 changed files with 4 additions and 20 deletions

View file

@ -68,9 +68,6 @@ export default class StrataExtension extends Extension {
/** @type {Set<number>} Pending GLib.idle_add source IDs to flush on disable. */
_idleSources = new Set();
/** @type {number | null} Keyboard shortcut binding ID */
_shortcutId = null;
enable() {
this._shuttingDown = false;
this._daemonRestartAttempts = 0;
@ -198,8 +195,6 @@ export default class StrataExtension extends Extension {
});
}
/** Single in-flight transfer at a time - prevents queuing multiple concurrent
* transfer_async + base64_encode operations that would stall the main thread. */
_readClipboard() {
if (this._clipboardTransferPending) return;
const selection = global.display.get_selection();
@ -228,11 +223,7 @@ export default class StrataExtension extends Extension {
const bytes = outputStream.steal_as_bytes();
const size = bytes.get_size();
if (size === 0) return;
const MAX_TEXT = this._maxTextBytes;
const MAX_IMAGE = this._maxImageBytes;
if (size > (mime.startsWith('image/') ? MAX_IMAGE : MAX_TEXT)) return;
// Send raw bytes as a D-Bus `ay` so we avoid blocking
// synchronous base64 work on the GJS main thread.
if (size > (mime.startsWith('image/') ? this._maxImageBytes : this._maxTextBytes)) return;
this._proxy?.SubmitItemRemote(mime, bytes.get_data(), () => {});
} catch (e) {
logError('Clipboard read error', e);
@ -406,7 +397,7 @@ export default class StrataExtension extends Extension {
return;
}
this._connectSignals();
this._panel = new StrataPanel(proxy, this._settings, this._indicator);
this._panel = new StrataPanel(proxy, this._settings);
// Push config now if the daemon is already up, and
// again on every owner transition so a respawned
// daemon picks up the latest values.

View file

@ -22,10 +22,9 @@ function logError(label, err) {
}
export class StrataPanel {
constructor(proxy, settings, indicator = null) {
constructor(proxy, settings) {
this._proxy = proxy;
this._settings = settings;
this._indicator = indicator; // PanelMenu.Button - used to avoid toggle-reopen race
this._pageSize = settings.get_int('page-size');
this._pageSizeChangedId = settings.connect('changed::page-size',
() => { this._pageSize = settings.get_int('page-size'); });
@ -37,7 +36,7 @@ export class StrataPanel {
this._thumbCache = new Map();
/** Pagination state for the non-search view. */
this._loadedOffset = 0; // how many items we've already pulled
this._hasMore = true; // false once daemon returns < PAGE_SIZE
this._hasMore = true; // false once daemon returns less than a full page
this._loadingMore = false; // re-entrancy guard for scroll-driven loads
/** Search state. */
this._searchQuery = ''; // current search string ('' = no search)
@ -153,14 +152,12 @@ export class StrataPanel {
return Clutter.EVENT_PROPAGATE;
});
// Panel box
this._box = new St.BoxLayout({
style_class: 'strata-panel',
vertical: true,
reactive: true,
});
// Header row: title + clear button
const header = new St.BoxLayout({
style_class: 'strata-header',
x_expand: true,
@ -180,7 +177,6 @@ export class StrataPanel {
header.add_child(title);
header.add_child(clearBtn);
// Search box
this._searchEntry = new St.Entry({
hint_text: 'Search…',
style_class: 'strata-search',
@ -203,7 +199,6 @@ export class StrataPanel {
return Clutter.EVENT_PROPAGATE;
});
// Item list
this._scrollView = new St.ScrollView({
style_class: 'strata-scroll',
x_expand: true,
@ -225,13 +220,11 @@ export class StrataPanel {
vadj.connect('notify::upper', () => this._maybeLoadMore());
}
// Assemble
this._box.add_child(header);
this._box.add_child(this._searchEntry);
this._box.add_child(this._scrollView);
this._overlay.add_child(this._box);
// ESC to close
this._overlay.connect('key-press-event', (_actor, event) => {
if (event.get_key_symbol() === Clutter.KEY_Escape) {
this.close();