Class: Lich::Common::GUI::ManualFrontendSelector
- Inherits:
-
Object
- Object
- Lich::Common::GUI::ManualFrontendSelector
- Defined in:
- documented/common/gui/manual_frontend_selector.rb
Overview
Manual Login offers detected clients and an explicit custom-command path. Configuration surfaces use FrontendSelector to include unavailable clients.
Constant Summary collapse
- CUSTOM_ID =
'__custom__'
Instance Attribute Summary collapse
-
#widget ⇒ Object
readonly
Returns the value of attribute widget.
Instance Method Summary collapse
-
#custom? ⇒ Boolean
Whether an explicit custom command is required.
- #initialize(selected_id: nil, refresh: true, locator: FrontendLocator) ⇒ ManualFrontendSelector constructor
-
#launchable?(refresh: true) ⇒ Boolean
Whether the native selection can launch.
-
#native_launch_only? ⇒ Boolean
Whether custom launch is unsupported for this client.
- #on_change {|ManualFrontendSelector| ... } ⇒ void
-
#reload!(refresh: true) ⇒ ManualFrontendSelector
Retains the chosen client, or selects Custom if it disappears.
-
#selected_id ⇒ String
Custom uses Wrayth's protocol identity, not its executable.
Constructor Details
#initialize(selected_id: nil, refresh: true, locator: FrontendLocator) ⇒ ManualFrontendSelector
24 25 26 27 28 29 |
# File 'documented/common/gui/manual_frontend_selector.rb', line 24 def initialize(selected_id: nil, refresh: true, locator: FrontendLocator) @locator = locator @callbacks = [] @widget = Gtk::Box.new(:horizontal, 10) rebuild(selected_id, refresh: refresh) end |
Instance Attribute Details
#widget ⇒ Object (readonly)
Returns the value of attribute widget.
18 19 20 |
# File 'documented/common/gui/manual_frontend_selector.rb', line 18 def @widget end |
Instance Method Details
#custom? ⇒ Boolean
Returns whether an explicit custom command is required.
38 39 40 |
# File 'documented/common/gui/manual_frontend_selector.rb', line 38 def custom? @selection == CUSTOM_ID end |
#launchable?(refresh: true) ⇒ Boolean
Returns whether the native selection can launch.
49 50 51 |
# File 'documented/common/gui/manual_frontend_selector.rb', line 49 def launchable?(refresh: true) !custom? && FrontendLauncher.launchable?(selected_id, locator: @locator, refresh: refresh) end |
#native_launch_only? ⇒ Boolean
Returns whether custom launch is unsupported for this client.
43 44 45 |
# File 'documented/common/gui/manual_frontend_selector.rb', line 43 def native_launch_only? !custom? && Frontend.definition_for(selected_id).dig(:metadata, :native_launch_only) == true end |
#on_change {|ManualFrontendSelector| ... } ⇒ void
This method returns an undefined value.
55 56 57 58 |
# File 'documented/common/gui/manual_frontend_selector.rb', line 55 def on_change(&callback) @callbacks << callback nil end |
#reload!(refresh: true) ⇒ ManualFrontendSelector
Retains the chosen client, or selects Custom if it disappears.
63 64 65 66 67 |
# File 'documented/common/gui/manual_frontend_selector.rb', line 63 def reload!(refresh: true) rebuild(@selection, refresh: refresh) @callbacks.each { |callback| callback.call(self) } self end |
#selected_id ⇒ String
Custom uses Wrayth's protocol identity, not its executable.
33 34 35 |
# File 'documented/common/gui/manual_frontend_selector.rb', line 33 def selected_id custom? ? 'stormfront' : @selection end |