Skip to content

Commit

Permalink
Make it compatible with current gnome 40
Browse files Browse the repository at this point in the history
  • Loading branch information
wengxt committed Mar 14, 2021
1 parent dcbca17 commit f0afbfe
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 21 deletions.
1 change: 0 additions & 1 deletion indicator.js
Expand Up @@ -26,7 +26,6 @@ class Indicator_KimIndicator extends PanelMenu.Button {
style_class: 'system-status-icon' });
hbox.add_child(this.labelIcon);
hbox.add_child(this.mainIcon);
hbox.add_child(PopupMenu.arrowIcon(St.Side.BOTTOM));
this.add_actor(hbox);
this._setIcon('input-keyboard', '');

Expand Down
2 changes: 1 addition & 1 deletion metadata.json.in
@@ -1,6 +1,6 @@
{
"extension-id": "kimpanel",
"shell-version": ["3.38"],
"shell-version": ["40.beta", "40"],
"uuid": "kimpanel@kde.org",
"name": "Input Method Panel",
"description": "Input Method Panel using KDE's kimpanel protocol for Gnome-Shell",
Expand Down
36 changes: 17 additions & 19 deletions prefs.js
@@ -1,3 +1,4 @@
imports.gi.versions['Gtk'] = '4.0';
const Gtk = imports.gi.Gtk;

const Gettext = imports.gettext.domain('gnome-shell-extensions-kimpanel');
Expand Down Expand Up @@ -28,54 +29,51 @@ function createBoolSetting(setting) {
var hbox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL });

var setting_label = new Gtk.Label({label: settings_bool[setting].label,
xalign: 0 });
xalign: 0, halign: Gtk.Align.FILL, hexpand: true });

var setting_switch = new Gtk.Switch({active: settings.get_boolean(setting)});
setting_switch.connect('notify::active', function(button) {
settings.set_boolean(setting, button.active);
});

hbox.pack_start(setting_label, true, true, 0);
hbox.add(setting_switch);
hbox.append(setting_label);
hbox.append(setting_switch);

return hbox;
}

function createFontSelection() {
var hbox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL });

var setting_label = new Gtk.Label( { label: _("Font"), xalign: 0});

var setting_label = new Gtk.Label( { label: _("Font"), xalign: 0, halign: Gtk.Align.FILL, hexpand: true});

var font = settings.get_string('font') || "Sans 12";

var button = new Gtk.FontButton( { font_name:font } );
var button = new Gtk.FontButton( { font:font } );

button.connect("font-set", function(button){
settings.set_string('font',button.get_font_name());
button.connect("font-set", function(button){
settings.set_string('font',button.font);
});

hbox.pack_start(setting_label, true, true, 0);
hbox.add(button);
hbox.append(setting_label);
hbox.append(button);

return hbox;
}

function buildPrefsWidget() {
var frame = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL,
border_width: 10 });
var vbox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL,
margin: 20, margin_top:10 });
var frame = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
var vbox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, margin_top: 10, margin_start: 20, margin_end: 20 });

var setting = null;
for (setting in settings_bool) {
var hbox = createBoolSetting(setting);
vbox.add(hbox);
vbox.append(hbox);
}
var hbox = createFontSelection();
vbox.add(hbox);
frame.add(vbox);
frame.show_all();
vbox.append(hbox);

frame.append(vbox);
frame.show();
return frame;
}

0 comments on commit f0afbfe

Please sign in to comment.