Module: Yast::HwinfoSystemSettingsDialogsInclude

Defined in:
../../src/include/hwinfo/system_settings_dialogs.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) initialize_hwinfo_system_settings_dialogs(include_target)



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File '../../src/include/hwinfo/system_settings_dialogs.rb', line 17

def initialize_hwinfo_system_settings_dialogs(include_target)
  Yast.import "UI"

  Yast.import "CWM"
  Yast.import "CWMTab"
  Yast.import "Label"
  Yast.import "Arch"
  Yast.import "Wizard"
  Yast.import "Mode"

  textdomain "tune"

  Yast.include include_target, "hwinfo/newid.rb"
  Yast.include include_target, "hwinfo/system_settings_ui.rb"

  @contents = VBox("tab")

  @tabs_descr = {
    "pci_id"          => {
      "header"       => NewPCIIDDialogCaption(),
      "contents"     => HBox(
        HSpacing(1),
        VBox(VSpacing(0.3), "pci_id_table_and_buttons", VSpacing(0.3)),
        HSpacing(1)
      ),
      "widget_names" => ["pci_id_table_and_buttons"]
    },
    "kernel_settings" => {
      "header"       => _("Kernel Settings"),
      "contents"     => HBox(
        HSpacing(1),
        VBox(VSpacing(0.3), Left("elevator"), VSpacing(1), Left("sysrq")),
        HSpacing(1)
      ),
      "widget_names" => ["elevator", "sysrq"]
    }
  }

  @initial_tab = "pci_id"

  @widget_names = ["tab"]
  @widget_descr = {
    "pci_id_table_and_buttons" => {
      "widget"        => :custom,
      "custom_widget" => NewPCIIDDialogContent(),
      "help"          => NewPCIIDDialogHelp(),
      "init"          => fun_ref(
        method(:InitNewPCIIDDialog),
        "void (string)"
      ),
      "handle"        => fun_ref(
        method(:HandleNewPCIIDDialog),
        "symbol (string, map)"
      )
    },
    # /usr/src/linux/Documentation/kernel-parameters.txt
    # http://www.redhat.com/magazine/008jun05/features/schedulers/
    #
    # elevator=    [IOSCHED]
    #		Format: {"cfq"|"deadline"|"noop"}
    #		See Documentation/block/as-iosched.txt
    #		and Documentation/block/deadline-iosched.txt for details.
    #
    #	'deadline' =>	Deadline. Database servers, especially those using "TCQ" disks should
    #			investigate performance with the 'deadline' IO scheduler. Any system with high
    #			disk performance requirements should do so, in fact.
    #	'noop' => NOOP
    #	'cfq' => Completely Fair Queuing (the default)
    "elevator"                 => {
      "widget"        => :custom,
      # combo box label
      "custom_widget" => ComboBox(
        Id("elevator"),
        _("Global &I/O Scheduler"),
        [
          # combo box item - I/O scheduler
          Item(Id(""), _("Not Configured")),
          # combo box item - I/O scheduler, do not translate the abbreviation in brackets
          Item(Id("cfq"), _("Completely Fair Queuing [cfq]")),
          # combo box item - I/O scheduler, do not translate the abbreviation in brackets
          Item(Id("noop"), _("NOOP [noop]")),
          # combo box item - I/O scheduler, do not translate the abbreviation in brackets
          Item(Id("deadline"), _("Deadline [deadline]"))
        ]
      ),
      "handle"        => fun_ref(
        method(:HandleElevatorSettings),
        "symbol (string, map)"
      ),
      "init"          => fun_ref(
        method(:InitElevatorSettings),
        "void (string)"
      ),
      "store"         => fun_ref(
        method(:StoreElevatorSettings),
        "void (string, map)"
      ),
      # help text for the scheduler widget, do not translate 'cfq'
      "help"          => _(
        "<p><b><big>Global I/O Scheduler</big></b><br>\n" +
          "Select the algorithm which orders and sends commands to disk\n" +
          "devices. This is a global option, it will be used for all disk devices in the\n" +
          "system. If the option is not configured, the default scheduler (usually 'cfq')\n" +
          "will be used. See the documentation in the /usr/src/linux/Documentation/block\n" +
          "directory (package kernel-source) for more information.</p>\n"
      )
    },
    # .sysconfig.sysctl
    "sysrq"                    => {
      "widget" => :checkbox,
      "label"  => _("Enable &SysRq Keys"),
      "store"  => fun_ref(method(:StoreSysRqSettings), "void (string, map)"),
      "init"   => fun_ref(method(:InitSysRqSettings), "void (string)"),
      # TRANSLATORS: Help text - over taken from /etc/sysconfig/sysctl file
      "help"   => _(
        "<p><b><big>Enable SysRq Keys</big></b><br>\n" +
          "If you enable SysRq keys, you will have some control over the system even if it\n" +
          "crashes (such as during kernel debugging). If it is enabled, the key combination\n" +
          "Alt-SysRq-<command_key> will start the respective command (e.g. reboot the\n" +
          "computer, dump kernel information). For further information, see\n" +
          "<tt>/usr/src/linux/Documentation/sysrq.txt</tt> (package kernel-source).</p>\n"
      )
    }
  }
end

- (Object) SystemSettingsDialog



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
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
200
201
202
203
204
# File '../../src/include/hwinfo/system_settings_dialogs.rb', line 143

def SystemSettingsDialog
  tab_order = ["kernel_settings"]

  # do not show PCI ID tab on s390
  if !Arch.s390
    tab_order = Builtins.prepend(tab_order, "pci_id")
  else
    # remove the PCI ID tab definition
    @tabs_descr = Builtins.remove(@tabs_descr, "pci_id")

    # set focus to kernel_settings tab
    @initial_tab = "kernel_settings"
  end

  Ops.set(
    @widget_descr,
    "tab",
    CWMTab.CreateWidget(
      {
        "tab_order"    => tab_order,
        "tabs"         => @tabs_descr,
        "widget_descr" => @widget_descr,
        "initial_tab"  => @initial_tab
      }
    )
  )

  # explicitly set no help (otherwise CWM logs an error)
  Ops.set(@widget_descr, ["tab", "help"], "")

  caption = _("Kernel Settings")

  Wizard.SetContentsButtons(
    "",
    VBox(),
    "",
    Label.BackButton,
    Label.NextButton
  )
  Wizard.DisableBackButton
  Wizard.SetDesktopIcon("powertweak")

  ret = CWM.ShowAndRun(
    {
      "widget_descr" => @widget_descr,
      "widget_names" => @widget_names,
      "contents"     => @contents,
      "caption"      => caption,
      # hide back button
      "back_button"  => nil,
      "abort_button" => Label.CancelButton,
      "next_button"  => Label.OKButton
    }
  )

  if ret != :back && ret != :abort && ret != :cancel
    @initial_tab = CWMTab.CurrentTab
  end
  Builtins.y2milestone("Returning %1", ret)

  ret
end