Skip to content
Open
9 changes: 6 additions & 3 deletions ddterm/app/accellabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class DDTermAccelLabel extends Gtk.Label {

#realize() {
this.#hierarchy_handler =
this.connect('hierarchy-changed', this.#update_hierarchy.bind(this));
this.connect('notify::root', this.#update_hierarchy.bind(this));

this.#update_hierarchy();
}
Expand Down Expand Up @@ -97,7 +97,7 @@ class DDTermAccelLabel extends Gtk.Label {
this.#keys_handler = null;
}

this.#toplevel = this.get_toplevel();
this.#toplevel = this.root;

if (this.#toplevel instanceof Gtk.Window) {
this.#keys_handler =
Expand All @@ -119,7 +119,10 @@ class DDTermAccelLabel extends Gtk.Label {

for (const shortcut of toplevel.application?.get_accels_for_action(action) || []) {
try {
return Gtk.accelerator_get_label(...Gtk.accelerator_parse(shortcut));
const [ok, key, mods] = Gtk.accelerator_parse(shortcut);

if (ok)
return Gtk.accelerator_get_label(key, mods);
} catch (ex) {
logError(ex);
}
Expand Down
23 changes: 11 additions & 12 deletions ddterm/app/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import GObject from 'gi://GObject';
import Gio from 'gi://Gio';
import Gdk from 'gi://Gdk';
import Gtk from 'gi://Gtk';
import Handy from 'gi://Handy';
import Adw from 'gi://Adw';

import Gettext from 'gettext';
import Gi from 'gi';
Expand Down Expand Up @@ -78,7 +78,7 @@ export const Application = GObject.registerClass({
),
},
},
class Application extends Gtk.Application {
class Application extends Adw.Application {
_init(params) {
super._init(params);

Expand Down Expand Up @@ -266,9 +266,6 @@ class Application extends Gtk.Application {
this.add_action(this.settings.create_action(key));
});

Handy.init();
this.style_manager = Handy.StyleManager.get_default();

this.settings.connect(
'changed::theme-variant',
this.update_color_scheme.bind(this)
Expand All @@ -279,8 +276,8 @@ class Application extends Gtk.Application {
const css_provider = Gtk.CssProvider.new();
css_provider.load_from_file(get_resource_file('style.css'));

Gtk.StyleContext.add_provider_for_screen(
Gdk.Screen.get_default(),
Gtk.StyleContext.add_provider_for_display(
Gdk.Display.get_default(),
css_provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
);
Expand Down Expand Up @@ -358,7 +355,8 @@ class Application extends Gtk.Application {
this.bind_shortcut(action, key);
});

Gtk.IconTheme.get_default().append_search_path(get_resource_file('icons').get_path());
const icon_theme = Gtk.IconTheme.get_for_display(Gdk.Display.get_default());
icon_theme.add_search_path(get_resource_file('icons').get_path());

this.session_file_path = GLib.build_filenamev([
GLib.get_user_cache_dir(),
Expand Down Expand Up @@ -579,6 +577,7 @@ class Application extends Gtk.Application {
terminal_settings: this.terminal_settings,
extension_dbus: this.extension_dbus,
display_config: this.display_config,
hide_on_close: true,
});

this.window.connect('destroy', source => {
Expand Down Expand Up @@ -616,7 +615,7 @@ class Application extends Gtk.Application {
application: this,
});

this.prefs_dialog.connect('destroy', source => {
this.prefs_dialog.connect('close-request', source => {
if (source === this.prefs_dialog)
this.prefs_dialog = null;
});
Expand Down Expand Up @@ -661,9 +660,9 @@ class Application extends Gtk.Application {

update_color_scheme() {
const mapping = {
'system': Handy.ColorScheme.PREFER_LIGHT,
'dark': Handy.ColorScheme.FORCE_DARK,
'light': Handy.ColorScheme.FORCE_LIGHT,
'system': Adw.ColorScheme.DEFAULT,
'dark': Adw.ColorScheme.FORCE_DARK,
'light': Adw.ColorScheme.FORCE_LIGHT,
};

const variant = this.settings.get_string('theme-variant');
Expand Down
Loading
Loading