Skip to content

Commit

Permalink
use active and not running for services (bsc#1080738#c3)
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger authored and joseivanlopez committed Jul 17, 2018
1 parent f568776 commit b7ac631
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions library/general/src/lib/ui/service_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ServiceStatus
include Yast::Logger

# @param service [Object] An object providing the following methods:
# #name, #start, #stop, #enabled?, #running?
# #name, #start, #stop, #enabled?, #active?
# For systemd compliant services, just do
# Yast::SystemdService.find("name_of_the_service")
# Note that this widget will #start and #stop the service by itself but
Expand All @@ -44,7 +44,7 @@ class ServiceStatus
# written.
# @param reload_flag [Boolean] Initial value for the "reload" checkbox.
# Keep in mind it will always be displayed as unchecked if the service
# is not running, despite the real value.
# is not active, despite the real value.
# @param reload_flag_label [Symbol] Type of label for the "reload" checkbox.
# :reload means the service will be reloaded.
# :restart means the service will be restarted.
Expand Down Expand Up @@ -104,8 +104,8 @@ def handle_input(input)
# Updates the widget to reflect the current status of the service and the
# settings
def refresh
Yast::UI.ChangeWidget(Id("#{id_prefix}_reload"), :Enabled, @service.running?)
Yast::UI.ChangeWidget(Id("#{id_prefix}_reload"), :Value, @service.running? && @reload_flag)
Yast::UI.ChangeWidget(Id("#{id_prefix}_reload"), :Enabled, @service.active?)
Yast::UI.ChangeWidget(Id("#{id_prefix}_reload"), :Value, @service.active? && @reload_flag)
Yast::UI.ChangeWidget(Id("#{id_prefix}_enabled"), :Value, @enabled_flag)
Yast::UI.ReplaceWidget(Id("#{id_prefix}_status"), status_widget)
end
Expand All @@ -126,6 +126,7 @@ def reload_flag?

# Content for the help
def help
# TRANSLATORS: do not modify %{reload_label}
_(
"<p><b><big>Current status</big></b><br>\n"\
"Displays the current status of the service. The status will remain "\
Expand Down Expand Up @@ -174,19 +175,20 @@ def on_boot_widget
# Widget to configure reloading of the running service
def reload_widget
opts = [:notify]
opts << :disabled unless @service.running?
opts << :disabled unless @service.active?
Left(
CheckBox(
Id("#{id_prefix}_reload"),
Opt(*opts),
@reload_label,
@service.running? && @reload_flag
@service.active? && @reload_flag
)
)
end

def label_and_action_widgets
if @service.running?
# use active and not running. See https://bugzilla.suse.com/show_bug.cgi?id=1080738#c3
if @service.active?
[
# TRANSLATORS: status of a service
Label(_("running")),
Expand Down

0 comments on commit b7ac631

Please sign in to comment.