MCPcopy Create free account
hub / github.com/material-shell/material-shell / getDefaultLayoutComboBox

Function getDefaultLayoutComboBox

src/prefs/prefs.ts:49–75  ·  view source on GitHub ↗
(
    tilingLayouts: string[],
    setting: Gio.Settings
)

Source from the content-addressed store, hash-verified

47}
48
49function getDefaultLayoutComboBox(
50 tilingLayouts: string[],
51 setting: Gio.Settings
52) {
53 const widget = new Gtk.ComboBoxText();
54 const refreshComboBox = () => {
55 widget.remove_all();
56 tilingLayouts.forEach((layoutKey) => {
57 if (setting.get_boolean(layoutKey)) {
58 widget.append(layoutKey, layoutKey);
59 }
60 });
61 };
62 tilingLayouts.forEach((layoutKey) => {
63 if (setting.get_boolean(layoutKey)) {
64 widget.append(layoutKey, layoutKey);
65 }
66 setting.connect(`changed::${layoutKey}`, refreshComboBox);
67 });
68 setting.bind(
69 'default-layout',
70 widget as any as GObject.Object,
71 'active-id',
72 Gio.SettingsBindFlags.DEFAULT
73 );
74 return widget;
75}
76
77export default class MyExtensionPreferences extends ExtensionPreferences {
78 private loadPages(templateDirectory: Gio.File) {

Callers 1

constructorMethod · 0.85

Calls 4

appendMethod · 0.95
get_booleanMethod · 0.65
connectMethod · 0.65
bindMethod · 0.65

Tested by

no test coverage detected