From f29e37cd53394b121dd24e0d493bd4796f4896a5 Mon Sep 17 00:00:00 2001 From: Stefan Hundhammer Date: Mon, 15 Nov 2021 18:32:30 +0100 Subject: [PATCH] Force loading the UI by default --- library/general/src/lib/ui/ui_extension_checker.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/library/general/src/lib/ui/ui_extension_checker.rb b/library/general/src/lib/ui/ui_extension_checker.rb index 47599a13e..bb8d6cbbd 100644 --- a/library/general/src/lib/ui/ui_extension_checker.rb +++ b/library/general/src/lib/ui/ui_extension_checker.rb @@ -30,11 +30,13 @@ class UIExtensionChecker # Constructor: Create a UI extension checker for the specified extension. # # @param ext_name [String] Short name of the UI extension ("pkg", "graph") + # @param force_ui [Boolean] Enforce creating a UI? # - def initialize(ext_name) + def initialize(ext_name, force_ui = true) textdomain "base" @ext_name = ext_name @ok = false + ensure_ui_created if force_ui @ui_plugin_info = UIPluginInfo.new ensure_ext_installed end @@ -67,6 +69,16 @@ def ensure_ext_installed @ok end + # Ensure that the UI is actually created: In CLI mode, that might be + # delayed because normally they should't create a UI at all. + # + def ensure_ui_created + # Just a UI call that doesn't do anything; this is already sufficient to + # load the UI main plug-in completely if it wasn't loaded yet. + # See also bsc#1192650 + UI.WidgetExists(:foo) + end + # Check if the UI extension plug-in is installed. # This also sets @ok. #