Class: Yast::CWMServiceStartClass
- Inherits:
-
Module
- Object
- Module
- Yast::CWMServiceStartClass
- Defined in:
- ../../src/modules/CWMServiceStart.rb
Instance Method Summary (collapse)
-
- (String) AutoStartHelp
Get the help text to the auto start widget.
-
- (String) AutoStartHelpTemplate
Get the template for the help text to the auto start widget.
-
- (String) AutoStartHelpXinetdTemplate
Get the template for the help text to the auto start widget.
-
- (Object) AutoStartInit(widget, key)
Init function of the widget.
-
- (Object) AutoStartInitWrapper(key)
Init function of the widget.
-
- (Object) AutoStartStore(widget, key, event)
Store function of the widget.
-
- (Object) AutoStartStoreWrapper(key, event)
Store function of the widget.
-
- (String) AutoStartXinetdHelp
Get the help text to the auto start widget.
-
- (Hash) CreateAutoStartWidget(settings)
Get the widget description map of the widget for service auto starting settings.
-
- (Hash) CreateLdapWidget(settings)
Get the widget description map of the LDAP enablement widget TODO: Find a file to move to.
-
- (Hash) CreateStartStopWidget(settings)
Get the widget description map for immediate service start/stop and appropriate actions.
-
- (String) EnableLdapHelp
Get the help text to the LDAP enablement widget.
-
- (String) EnableLdapHelpTemplate
Get the template for the help text to the LDAP enablement widget.
-
- (Object) HandleLdap(widget, event_id)
Handle the “Use LDAP” check box param event_id any the ID of the occurred event.
-
- (Symbol) LdapHandle(widget, key, event)
Handle function of the widget.
-
- (Symbol) LdapHandleWrapper(key, event)
Handle function of the widget.
-
- (Object) LdapInit(widget, key)
Init function of the widget.
-
- (Object) LdapInitWrapper(key)
Init function of the widget.
- - (Object) main
-
- (Object) StartStopHandle(widget, key, event)
Handle the immediate start and stop of the service.
-
- (Object) StartStopHandleWrapper(key, event)
Handle the immediate start and stop of the service.
-
- (String) StartStopHelp(restart_displayed)
Get the help text to the start/stop widget.
-
- (String) StartStopHelpTemplate(restart_displayed)
Get the template for the help text to the start/stop widget.
-
- (Object) StartStopInit(widget, key)
Init function of the widget.
-
- (Object) StartStopInitWrapper(key)
Init function of the widget.
-
- (Object) UpdateLdapWidget(widget)
Update the widget displaying if LDAP support is active.
-
- (Object) UpdateServiceStatusWidget(widget)
Update the displayed status of the service.
Instance Method Details
- (String) AutoStartHelp
Get the help text to the auto start widget
253 254 255 256 257 258 259 260 261 |
# File '../../src/modules/CWMServiceStart.rb', line 253 def AutoStartHelp Builtins.sformat( AutoStartHelpTemplate(), # part of help text - radio button label, NO SHORTCUT!!! _("During Boot"), # part of help text - radio button label, NO SHORTCUT!!! _("Manually") ) end |
- (String) AutoStartHelpTemplate
Get the template for the help text to the auto start widget
221 222 223 224 225 226 227 228 229 230 231 232 |
# File '../../src/modules/CWMServiceStart.rb', line 221 def AutoStartHelpTemplate # help text for service auto start widget # %1 and %2 are button labels # %1 is eg. "On -- Start Service when Booting" # %2 is eg. "Off -- Start Service Manually" # (both without quotes) _( "<p><b><big>Service Start</big></b><br>\n" + "To start the service every time your computer is booted, set\n" + "<b>%1</b>. Otherwise set <b>%2</b>.</p>" ) end |
- (String) AutoStartHelpXinetdTemplate
Get the template for the help text to the auto start widget
236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File '../../src/modules/CWMServiceStart.rb', line 236 def AutoStartHelpXinetdTemplate # help text for service auto start widget # %1, %2 and %3 are button labels # %1 is eg. "On -- Start Service when Booting" # %2 is eg. "Off -- Start Service Manually" # %3 is eg. "Start Service via xinetd" # (both without quotes) _( "<p><b><big>Service Start</big></b><br>\n" + "To start the service every time your computer is booted, set\n" + "<b>%1</b>. To start the service via the xinetd daemon, set <b>%3</b>.\n" + "Otherwise set <b>%2</b>.</p>" ) end |
- (Object) AutoStartInit(widget, key)
Init function of the widget
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File '../../src/modules/CWMServiceStart.rb', line 130 def AutoStartInit(, key) = deep_copy() if !UI.WidgetExists(Id("_cwm_service_startup")) Builtins.y2error("Widget _cwm_service_startup does not exist") return end get_auto_start = Convert.convert( Ops.get(, "get_service_auto_start"), :from => "any", :to => "boolean ()" ) auto_start = get_auto_start.call UI.ChangeWidget( Id("_cwm_service_startup"), :CurrentButton, auto_start ? "_cwm_startup_auto" : "_cwm_startup_manual" ) if Builtins.haskey(, "get_service_start_via_xinetd") start_via_xinetd = Convert.convert( Ops.get(, "get_service_start_via_xinetd"), :from => "any", :to => "boolean ()" ) if start_via_xinetd.call UI.ChangeWidget( Id("_cwm_service_startup"), :CurrentButton, "_cwm_startup_xinetd" ) end end nil end |
- (Object) AutoStartInitWrapper(key)
Init function of the widget
203 204 205 206 207 |
# File '../../src/modules/CWMServiceStart.rb', line 203 def AutoStartInitWrapper(key) AutoStartInit(CWM.GetProcessedWidget, key) nil end |
- (Object) AutoStartStore(widget, key, event)
Store function of the widget
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File '../../src/modules/CWMServiceStart.rb', line 169 def AutoStartStore(, key, event) = deep_copy() event = deep_copy(event) if !UI.WidgetExists(Id("_cwm_service_startup")) Builtins.y2error("Widget _cwm_service_startup does not exist") return end auto_start = UI.QueryWidget(Id("_cwm_service_startup"), :CurrentButton) == "_cwm_startup_auto" set_auto_start = Convert.convert( Ops.get(, "set_service_auto_start"), :from => "any", :to => "void (boolean)" ) set_auto_start.call(auto_start) if !auto_start && Builtins.haskey(, "set_service_start_via_xinetd") start_via_xinetd = Convert.convert( Ops.get(, "set_service_start_via_xinetd"), :from => "any", :to => "void (boolean)" ) start_via_xinetd.call( UI.QueryWidget(Id("_cwm_service_startup"), :CurrentButton) == "_cwm_startup_xinetd" ) end nil end |
- (Object) AutoStartStoreWrapper(key, event)
Store function of the widget
212 213 214 215 216 217 |
# File '../../src/modules/CWMServiceStart.rb', line 212 def AutoStartStoreWrapper(key, event) event = deep_copy(event) AutoStartStore(CWM.GetProcessedWidget, key, event) nil end |
- (String) AutoStartXinetdHelp
Get the help text to the auto start widget
265 266 267 268 269 270 271 272 273 274 275 |
# File '../../src/modules/CWMServiceStart.rb', line 265 def AutoStartXinetdHelp Builtins.sformat( AutoStartHelpTemplate(), # part of help text - radio button label, NO SHORTCUT!!! _("During Boot"), # part of help text - radio button label, NO SHORTCUT!!! _("Manually"), # part of help text - radio button label, NO SHORTCUT!!! _("Via xinetd") ) end |
- (Hash) CreateAutoStartWidget(settings)
Get the widget description map of the widget for service auto starting settings <pre>
-
“get_service_auto_start” : boolean () – function that returns if the service is set for automatical start-up
-
“set_service_auto_start” : void (boolean) – function that takes as an argument boolean value saying if the service is started automatically during booting
-
“get_service_start_via_xinetd” : boolean () – function that returns if the service is to be started via xinetd. At most one of this function and "get_service_auto_start" returns true (if started via xinetd, not starting automatically
-
“set_service_start_via_xinetd” : void (boolean) - function that takes as an argument boolean value saying if the service is started via xinetd
-
“start_auto_button” : string – label of the radio button to start the service automatically when booting
-
“start_xinetd_button” : string – label of the radio button to start the service via xinetd
-
“start_manual_button” : string – label of the radio button to start the service only manually
-
“help” : string – custom help for the widget. If not specified, generic help is used
</pre> Additional settings: - "help" : string -- help to the whole widget. If not specified, generic help is used (button labels are patched correctly) </pre>
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 |
# File '../../src/modules/CWMServiceStart.rb', line 309 def CreateAutoStartWidget(settings) settings = deep_copy(settings) help = "" # radio button = Ops.get_locale( settings, "start_auto_button", _("During Boot") ) # radio button = Ops.get_locale( settings, "start_manual_button", _("Manually") ) # radio button = Ops.get_locale( settings, "start_xinetd_button", _("Via &xinetd") ) xinetd_available = Builtins.haskey( settings, "get_service_start_via_xinetd" ) if Builtins.haskey(settings, "help") help = Ops.get_string(settings, "help", "") else help = xinetd_available ? AutoStartXinetdHelp() : AutoStartHelp() end items = VBox( VSpacing(0.4), Left( RadioButton(Id("_cwm_startup_auto"), Opt(:notify), ) ) ) if xinetd_available items = Builtins.add( items, Left( RadioButton( Id("_cwm_startup_xinetd"), Opt(:notify), ) ) ) end items = Builtins.add( items, Left( RadioButton( Id("_cwm_startup_manual"), Opt(:notify), ) ) ) items = Builtins.add(items, VSpacing(0.4)) # Frame label (service starting) booting = VBox( # frame Frame( _("Service Start"), Left(RadioButtonGroup(Id("_cwm_service_startup"), items)) ) ) if !(Builtins.haskey(settings, "set_service_auto_start") && Builtins.haskey(settings, "get_service_auto_start")) booting = VBox() help = "" end ret = Convert.convert( Builtins.union( settings, { "widget" => :custom, "custom_widget" => booting, "help" => help, "init" => fun_ref( method(:AutoStartInitWrapper), "void (string)" ), "store" => fun_ref( method(:AutoStartStoreWrapper), "void (string, map)" ) } ), :from => "map", :to => "map <string, any>" ) deep_copy(ret) end |
- (Hash) CreateLdapWidget(settings)
Get the widget description map of the LDAP enablement widget TODO: Find a file to move to <pre>
LDAP support: - "get_use_ldap" : boolean () -- function to return current status of the LDAP support. If not set, LDAP check-box is not shown. - "set_use_ldap" : void (boolean) -- function to set the LDAP usage and report errors in case of fails. Status will be rechecked via "get_use_ldap". If not set, LDAP check-box is not shown. - "use_ldap_checkbox" : string -- label of the chcek box to set if LDAP support is active. - "help" : string -- help to the widget. If not specified, generic help is used (button labels are patched correctly) </pre>
765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 |
# File '../../src/modules/CWMServiceStart.rb', line 765 def CreateLdapWidget(settings) settings = deep_copy(settings) help = "" # check box use_ldap_checkbox = Ops.get_locale( settings, "use_ldap_checkbox", _("&LDAP Support Active") ) if Builtins.haskey(settings, "help") help = Ops.get_string(settings, "help", "") else help = EnableLdapHelp() end # check box ldap_settings = VBox( VSpacing(1), Left(CheckBox(Id("_cwm_use_ldap"), Opt(:notify), use_ldap_checkbox)) ) if !(Builtins.haskey(settings, "get_use_ldap") && Builtins.haskey(settings, "set_use_ldap")) ldap_settings = VBox() help = "" end ret = Convert.convert( Builtins.union( settings, { "widget" => :custom, "custom_widget" => ldap_settings, "help" => help, "init" => fun_ref( method(:LdapInitWrapper), "void (string)" ), "handle" => fun_ref( method(:LdapHandleWrapper), "symbol (string, map)" ), "handle_events" => ["_cwm_use_ldap"] } ), :from => "map", :to => "map <string, any>" ) deep_copy(ret) end |
- (Hash) CreateStartStopWidget(settings)
Get the widget description map for immediate service start/stop and appropriate actions <pre>
-
“service_id” : string – service identifier for Service:: functions. If not specified, immediate actions buttons are not displayed.
-
“save_now_action” : void () – function that causes saving of all settings and restarting the service. If key is missing, the button is not displayed
-
“start_now_action” : void () – function that causes starting the service If not specified, generic function using "service_id" is used instead
-
“stop_now_action” : void () – function that causes stopping the service If not specified, generic function using "service_id" is used instead
-
“service_running_label” : string – label to be displayed if the service is running.
-
“service_not_running_label” : string – label to be displayed if the service is stopped.
-
“start_now_button” : string – label for the push button for immediate service start
-
“stop_now_button” : string – label for the push button for immediate service stop
-
“save_now_button” : string – label for the push button for immediate settings saving and service restarting
-
“help” : string – help to the widget. If not specified, generic help is used (button labels are patched correctly) </pre>
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 |
# File '../../src/modules/CWMServiceStart.rb', line 571 def CreateStartStopWidget(settings) settings = deep_copy(settings) help = "" # push button for immediate service starting = Ops.get_locale( settings, "start_now_button", _("&Start the Service Now") ) # push button for immediate service stopping = Ops.get_locale( settings, "stop_now_button", _("S&top the Service Now") ) = Ops.get_locale( settings, "save_now_button", # push button for immediate saving of the settings and service starting _("S&ave Changes and Restart Service Now") ) display_save_now = Builtins.haskey(settings, "save_now_action") if Builtins.haskey(settings, "help") help = Ops.get_string(settings, "help", "") else help = StartStopHelp(display_save_now) end = display_save_now ? PushButton( Id("_cwm_save_settings_now"), Opt(:hstretch), ) : VBox() immediate_actions = VBox( # Frame label (stoping starting service) Frame( _("Switch On and Off"), Left( HSquash( VBox( HBox( # Current status Label(_("Current Status: ")), ReplacePoint(Id("_cwm_service_status_rp"), Label("")), HStretch() ), PushButton( Id("_cwm_start_service_now"), Opt(:hstretch), ), PushButton( Id("_cwm_stop_service_now"), Opt(:hstretch), ), ) ) ) ) ) if !Builtins.haskey(settings, "service_id") immediate_actions = VBox() help = "" end ret = Convert.convert( Builtins.union( settings, { "widget" => :custom, "custom_widget" => immediate_actions, "help" => help, "init" => fun_ref( method(:StartStopInitWrapper), "void (string)" ), "handle" => fun_ref( method(:StartStopHandleWrapper), "symbol (string, map)" ), "handle_events" => [ :timeout, "_cwm_start_service_now", "_cwm_stop_service_now", "_cwm_save_settings_now" ] } ), :from => "map", :to => "map <string, any>" ) if Builtins.haskey(settings, "service_id") Ops.set(ret, "ui_timeout", 5000) end deep_copy(ret) end |
- (String) EnableLdapHelp
Get the help text to the LDAP enablement widget
740 741 742 743 744 745 746 |
# File '../../src/modules/CWMServiceStart.rb', line 740 def EnableLdapHelp Builtins.sformat( EnableLdapHelpTemplate(), # part of help text - check box label, NO SHORTCUT!!! _("LDAP Support Active") ) end |
- (String) EnableLdapHelpTemplate
Get the template for the help text to the LDAP enablement widget
728 729 730 731 732 733 734 735 736 |
# File '../../src/modules/CWMServiceStart.rb', line 728 def EnableLdapHelpTemplate # help text for LDAP enablement widget # %1 is button label, eg. "LDAP Support Active" (without quotes) _( "<p><b><big>LDAP Support</big></b><br>\n" + "To store the settings in LDAP instead of native configuration files,\n" + "set <b>%1</b>.</p>" ) end |
- (Object) HandleLdap(widget, event_id)
Handle the “Use LDAP” check box param event_id any the ID of the occurred event
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File '../../src/modules/CWMServiceStart.rb', line 104 def HandleLdap(, event_id) = deep_copy() event_id = deep_copy(event_id) if event_id == "_cwm_use_ldap" set_use_ldap = Convert.convert( Ops.get(, "set_use_ldap"), :from => "any", :to => "void (boolean)" ) use_ldap = Convert.to_boolean( UI.QueryWidget(Id("_cwm_use_ldap"), :Value) ) set_use_ldap.call(use_ldap) UpdateLdapWidget() end nil end |
- (Symbol) LdapHandle(widget, key, event)
Handle function of the widget
696 697 698 699 700 701 702 703 704 705 |
# File '../../src/modules/CWMServiceStart.rb', line 696 def LdapHandle(, key, event) = deep_copy() event = deep_copy(event) ret = Ops.get(event, "ID") if ret == "_cwm_use_ldap" HandleLdap(, ret) return nil end nil end |
- (Symbol) LdapHandleWrapper(key, event)
Handle function of the widget
721 722 723 724 |
# File '../../src/modules/CWMServiceStart.rb', line 721 def LdapHandleWrapper(key, event) event = deep_copy(event) LdapHandle(CWM.GetProcessedWidget, key, event) end |
- (Object) LdapInit(widget, key)
Init function of the widget
684 685 686 687 688 689 |
# File '../../src/modules/CWMServiceStart.rb', line 684 def LdapInit(, key) = deep_copy() UpdateLdapWidget() nil end |
- (Object) LdapInitWrapper(key)
Init function of the widget
710 711 712 713 714 |
# File '../../src/modules/CWMServiceStart.rb', line 710 def LdapInitWrapper(key) LdapInit(CWM.GetProcessedWidget, key) nil end |
- (Object) main
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File '../../src/modules/CWMServiceStart.rb', line 35 def main Yast.import "UI" textdomain "base" Yast.import "CWM" Yast.import "Mode" Yast.import "ProductFeatures" Yast.import "Service" # private variables # Label saying that service is running @service_is_running = "" # Label saying that service is stopped @service_is_stopped = "" # Last status of the service @last_status = nil end |
- (Object) StartStopHandle(widget, key, event)
Handle the immediate start and stop of the service
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 |
# File '../../src/modules/CWMServiceStart.rb', line 418 def StartStopHandle(, key, event) = deep_copy() event = deep_copy(event) event_id = Ops.get(event, "ID") if event_id == "_cwm_start_service_now" if Builtins.haskey(, "start_now_action") start_now_func = Convert.convert( Ops.get(, "start_now_action"), :from => "any", :to => "void ()" ) start_now_func.call else Service.Restart(Ops.get_string(, "service_id", "")) end Builtins.sleep(500) elsif event_id == "_cwm_stop_service_now" if Builtins.haskey(, "stop_now_action") stop_now_func = Convert.convert( Ops.get(, "stop_now_action"), :from => "any", :to => "void ()" ) stop_now_func.call else Service.Stop(Ops.get_string(, "service_id", "")) end Builtins.sleep(500) elsif event_id == "_cwm_save_settings_now" func = Convert.convert( Ops.get(, "save_now_action"), :from => "any", :to => "void ()" ) func.call Builtins.sleep(500) end UpdateServiceStatusWidget() nil end |
- (Object) StartStopHandleWrapper(key, event)
Handle the immediate start and stop of the service
484 485 486 487 |
# File '../../src/modules/CWMServiceStart.rb', line 484 def StartStopHandleWrapper(key, event) event = deep_copy(event) StartStopHandle(CWM.GetProcessedWidget, key, event) end |
- (String) StartStopHelp(restart_displayed)
Get the help text to the start/stop widget
529 530 531 532 533 534 535 536 537 538 539 |
# File '../../src/modules/CWMServiceStart.rb', line 529 def StartStopHelp(restart_displayed) Builtins.sformat( StartStopHelpTemplate(restart_displayed), # part of help text - push button label, NO SHORTCUT!!! _("Start the Service Now"), # part of help text - push button label, NO SHORTCUT!!! _("Stop the Service Now"), # part of help text - push button label, NO SHORTCUT!!! _("Save Changes and Restart Service Now") ) end |
- (String) StartStopHelpTemplate(restart_displayed)
Get the template for the help text to the start/stop widget
500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 |
# File '../../src/modules/CWMServiceStart.rb', line 500 def StartStopHelpTemplate(restart_displayed) # help text for service status displaying and switching widget 1/2 # %1 and %2 are push button labels # %1 is eg. "Start the Service Now" # %2 is eg. "Stop the Service Now" # (both without quotes) help = _( "<p><b><big>Switch On or Off</big></b><br>\n" + "To start or stop the service immediately, use \n" + "<b>%1</b> or <b>%2</b>.</p>" ) if restart_displayed # help text for service start widget 2/2, optional # %3 is push button label, eg. "Save Changes and Restart Service Now" # (without quotes) # note: %3 is correct, do not replace with %1!!! help = Ops.add( help, _( "<p>To save all changes and restart the\nservice immediately, use <b>%3</b>.</p>\n" ) ) end help end |
- (Object) StartStopInit(widget, key)
Init function of the widget
462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 |
# File '../../src/modules/CWMServiceStart.rb', line 462 def StartStopInit(, key) = deep_copy() @last_status = nil @service_is_running = # service status - label Ops.get_locale(, "service_running_label", _("Service is running")) @service_is_stopped = # service status - label Ops.get_locale( , "service_not_running_label", _("Service is not running") ) UpdateServiceStatusWidget() nil end |
- (Object) StartStopInitWrapper(key)
Init function of the widget
491 492 493 494 495 |
# File '../../src/modules/CWMServiceStart.rb', line 491 def StartStopInitWrapper(key) StartStopInit(CWM.GetProcessedWidget, key) nil end |
- (Object) UpdateLdapWidget(widget)
Update the widget displaying if LDAP support is active
87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File '../../src/modules/CWMServiceStart.rb', line 87 def UpdateLdapWidget() = deep_copy() return if !UI.WidgetExists(Id("_cwm_use_ldap")) get_use_ldap = Convert.convert( Ops.get(, "get_use_ldap"), :from => "any", :to => "boolean ()" ) use_ldap = get_use_ldap.call UI.ChangeWidget(Id("_cwm_use_ldap"), :Value, use_ldap) nil end |
- (Object) UpdateServiceStatusWidget(widget)
Update the displayed status of the service
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File '../../src/modules/CWMServiceStart.rb', line 61 def UpdateServiceStatusWidget() = deep_copy() return if !UI.WidgetExists(Id("_cwm_service_status_rp")) if Mode.config UI.ChangeWidget(Id("_cwm_start_service_now"), :Enabled, false) UI.ChangeWidget(Id("_cwm_stop_service_now"), :Enabled, false) # service status - label UI.ReplaceWidget(Id("_cwm_service_status_rp"), Label(_("Unavailable"))) else status = 0 == Service.Status(Ops.get_string(, "service_id", "")) if status != @last_status UI.ChangeWidget(Id("_cwm_start_service_now"), :Enabled, !status) UI.ChangeWidget(Id("_cwm_stop_service_now"), :Enabled, status) UI.ReplaceWidget( Id("_cwm_service_status_rp"), Label(status ? @service_is_running : @service_is_stopped) ) @last_status = status end end nil end |