Class: Lich::Common::GUI::FrontendManagerTab

Inherits:
Object
  • Object
show all
Defined in:
documented/common/gui/frontend_manager_tab.rb

Overview

GTK editor for built-in frontend launch overrides and custom frontends. Detection is presented as status only; this tab never launches a frontend or changes account/character associations.

Constant Summary collapse

ID_COLUMN =
0
LABEL_COLUMN =
1
TYPE_COLUMN =
2
STATUS_COLUMN =
3
LAUNCH_COLUMN =
4
ARGUMENTS_COLUMN =
5
CAPABILITIES_PER_ROW =
3
DEFAULT_CATALOG_HEIGHT =
210

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data_dir:, settings: FrontendSettings, frontend: Frontend, locator: FrontendLocator, on_changed: nil) ⇒ FrontendManagerTab

Initializes the frontend settings editor and populates its catalog list.

Parameters:

  • data_dir (String) —

    Lich data directory containing frontends.yml

  • settings (FrontendSettings) (defaults to: FrontendSettings) —

    persistence and catalog application module

  • frontend (Frontend) (defaults to: Frontend) —

    frontend catalog module

  • locator (FrontendLocator) (defaults to: FrontendLocator) —

    executable discovery module

  • on_changed (Proc, nil) (defaults to: nil) —

    zero-argument callback after save/delete/reload



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'documented/common/gui/frontend_manager_tab.rb', line 38

def initialize(
  data_dir:,
  settings: FrontendSettings,
  frontend: Frontend,
  locator: FrontendLocator,
  on_changed: nil
)
  @data_dir = data_dir
  @settings = settings
  @frontend = frontend
  @locator = locator
  @on_changed = on_changed
  @editing_new = false
  @selected_id = nil
  @row_iters = {}

  @widget = build_widget
  populate_list
end

Instance Attribute Details

#widget ⇒ Object (readonly)

Returns the value of attribute widget.



28
29
30
# File 'documented/common/gui/frontend_manager_tab.rb', line 28

def widget
  @widget
end

Instance Method Details

#reload! ⇒ Boolean

Reloads frontends.yml, refreshes detection, and retains selection when possible.

Returns:

  • (Boolean) —

    true on success



60
61
62
63
64
65
66
67
68
69
70
71
# File 'documented/common/gui/frontend_manager_tab.rb', line 60

def reload!
  preferred_id = @selected_id
  @settings.load!(data_dir: @data_dir)
  @locator.refresh!
  populate_list(preferred_id: preferred_id)
  report_status('Frontend configuration reloaded.')
  notify_changed
  true
rescue StandardError => error
  report_error(error.message)
  false
end