MCPcopy Create free account
hub / github.com/emasab/shelltile / createBoolSetting

Function createBoolSetting

prefs.js:172–205  ·  view source on GitHub ↗
(settings, setting)

Source from the content-addressed store, hash-verified

170}
171
172function createBoolSetting(settings, setting){
173
174 let settingsV = settings[setting];
175 let settingsId = setting;
176
177 let hbox = new Gtk.Box({
178 orientation: Gtk.Orientation.HORIZONTAL,
179 margin_top: 5
180 });
181
182 let setting_label = new Gtk.Label({
183 label: settingsV.label,
184 xalign: 0,
185 hexpand: true,
186 margin_right: 20
187 });
188
189 let setting_switch = new Gtk.Switch({
190 active: gsettings.get_boolean(settingsId)
191 });
192 setting_switch.connect('notify::active', function (button){
193 gsettings.set_boolean(settingsId, button.active);
194 });
195
196 if (settingsV.help){
197 setting_label.set_tooltip_text(settingsV.help)
198 setting_switch.set_tooltip_text(settingsV.help)
199 }
200
201 hbox.pack_start(setting_label, true, true, 0);
202 hbox.add(setting_switch);
203
204 return hbox;
205}
206
207function createIntSetting(settings, setting){
208

Callers 1

buildHboxFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected