|
| 1 | +imports.gi.versions['Gtk'] = '4.0'; |
1 | 2 | const Gtk = imports.gi.Gtk; |
2 | 3 |
|
3 | 4 | const Gettext = imports.gettext.domain('gnome-shell-extensions-kimpanel'); |
@@ -28,54 +29,51 @@ function createBoolSetting(setting) { |
28 | 29 | var hbox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL }); |
29 | 30 |
|
30 | 31 | var setting_label = new Gtk.Label({label: settings_bool[setting].label, |
31 | | - xalign: 0 }); |
| 32 | + xalign: 0, halign: Gtk.Align.FILL, hexpand: true }); |
32 | 33 |
|
33 | 34 | var setting_switch = new Gtk.Switch({active: settings.get_boolean(setting)}); |
34 | 35 | setting_switch.connect('notify::active', function(button) { |
35 | 36 | settings.set_boolean(setting, button.active); |
36 | 37 | }); |
37 | 38 |
|
38 | | - hbox.pack_start(setting_label, true, true, 0); |
39 | | - hbox.add(setting_switch); |
| 39 | + hbox.append(setting_label); |
| 40 | + hbox.append(setting_switch); |
40 | 41 |
|
41 | 42 | return hbox; |
42 | 43 | } |
43 | 44 |
|
44 | 45 | function createFontSelection() { |
45 | 46 | var hbox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL }); |
46 | | - |
47 | | - var setting_label = new Gtk.Label( { label: _("Font"), xalign: 0}); |
48 | 47 |
|
| 48 | + var setting_label = new Gtk.Label( { label: _("Font"), xalign: 0, halign: Gtk.Align.FILL, hexpand: true}); |
49 | 49 |
|
50 | 50 | var font = settings.get_string('font') || "Sans 12"; |
51 | 51 |
|
52 | | - var button = new Gtk.FontButton( { font_name:font } ); |
| 52 | + var button = new Gtk.FontButton( { font:font } ); |
53 | 53 |
|
54 | | - button.connect("font-set", function(button){ |
55 | | - settings.set_string('font',button.get_font_name()); |
| 54 | + button.connect("font-set", function(button){ |
| 55 | + settings.set_string('font',button.font); |
56 | 56 | }); |
57 | 57 |
|
58 | | - hbox.pack_start(setting_label, true, true, 0); |
59 | | - hbox.add(button); |
| 58 | + hbox.append(setting_label); |
| 59 | + hbox.append(button); |
60 | 60 |
|
61 | 61 | return hbox; |
62 | 62 | } |
63 | 63 |
|
64 | 64 | function buildPrefsWidget() { |
65 | | - var frame = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, |
66 | | - border_width: 10 }); |
67 | | - var vbox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, |
68 | | - margin: 20, margin_top:10 }); |
| 65 | + var frame = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL }); |
| 66 | + var vbox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, margin_top: 10, margin_start: 20, margin_end: 20 }); |
69 | 67 |
|
70 | 68 | var setting = null; |
71 | 69 | for (setting in settings_bool) { |
72 | 70 | var hbox = createBoolSetting(setting); |
73 | | - vbox.add(hbox); |
| 71 | + vbox.append(hbox); |
74 | 72 | } |
75 | 73 | var hbox = createFontSelection(); |
76 | | - vbox.add(hbox); |
77 | | - |
78 | | - frame.add(vbox); |
79 | | - frame.show_all(); |
| 74 | + vbox.append(hbox); |
| 75 | + |
| 76 | + frame.append(vbox); |
| 77 | + frame.show(); |
80 | 78 | return frame; |
81 | 79 | } |
0 commit comments